16#ifndef QGSMODELDESIGNERDIALOG_H
17#define QGSMODELDESIGNERDIALOG_H
19#include "ui_qgsmodeldesignerdialogbase.h"
29class QgsProcessingModelAlgorithm;
30class QgsModelUndoCommand;
35class QgsProcessingAlgorithmDialogBase;
48 explicit QgsModelerToolboxModel( QObject *parent =
nullptr );
49 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
50 Qt::DropActions supportedDragActions()
const override;
61class GUI_EXPORT QgsModelDesignerDialog :
public QMainWindow,
public Ui::QgsModelDesignerDialogBase
65 QgsModelDesignerDialog( QWidget *parent
SIP_TRANSFERTHIS =
nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
66 ~QgsModelDesignerDialog()
override;
68 void closeEvent( QCloseEvent *event )
override;
73 void beginUndoCommand(
const QString &text,
const QString &
id = QString(), QgsModelUndoCommand::CommandOperation operation
SIP_PYARGREMOVE = QgsModelUndoCommand::CommandOperation::Unknown );
78 void endUndoCommand();
84 void abortUndoCommand();
89 QgsProcessingModelAlgorithm *model();
96 void setModel( QgsProcessingModelAlgorithm *model
SIP_TRANSFER );
101 void loadModel(
const QString &path );
108 void setModelScene( QgsModelGraphicsScene *scene
SIP_TRANSFER );
116 QgsModelGraphicsScene *modelScene();
123 enum class SaveAction
140 virtual void repaintModel(
bool showControls =
true ) = 0;
141 virtual void addAlgorithm(
const QString &algorithmId,
const QPointF &pos ) = 0;
143 virtual void addInput(
const QString &inputId,
const QPointF &pos ) = 0;
145 virtual void exportAsScriptAlgorithm() = 0;
147 virtual bool saveModel(
bool saveAs =
false ) = 0;
149 virtual QgsProcessingAlgorithmDialogBase *createExecutionDialog() = 0
SIP_TRANSFERBACK;
154 virtual QgsProcessingParameterWidgetContext createWidgetContext() = 0;
160 void registerProcessingContextGenerator( QgsProcessingContextGenerator *generator );
162 QToolBar *toolbar() {
return mToolbar; }
163 QAction *actionOpen() {
return mActionOpen; }
164 QAction *actionSaveInProject() {
return mActionSaveInProject; }
165 QAction *actionRun() {
return mActionRun; }
166 QgsMessageBar *messageBar() {
return mMessageBar; }
167 QgsModelGraphicsView *view() {
return mView; }
169 void setDirty(
bool dirty );
174 bool validateSave( SaveAction action );
181 bool checkForUnsavedChanges();
186 void setLastRunResult(
const QgsProcessingModelResult &result );
195 void setModelName(
const QString &name );
203 void exportToImage();
206 void exportAsPython();
207 void toggleComments(
bool show );
208 void toggleFeatureCount(
bool show );
209 void updateWindowTitle();
210 void deleteSelected();
211 void populateZoomToMenu();
213 void reorderInputs();
214 void reorderOutputs();
215 void setPanelVisibility(
bool hidden );
217 void runSelectedSteps();
218 void runFromChild(
const QString &
id );
219 void run(
const QSet<QString> &childAlgorithmSubset = QSet<QString>() );
220 void showChildAlgorithmOutputs(
const QString &childId );
221 void showChildAlgorithmLog(
const QString &childId );
222 void onItemFocused( QgsModelComponentGraphicItem *item );
225 std::unique_ptr<QgsProcessingModelAlgorithm> mModel;
227 QgsScreenHelper *mScreenHelper =
nullptr;
229 QgsMessageBar *mMessageBar =
nullptr;
230 QgsModelerToolboxModel *mAlgorithmsModel =
nullptr;
232 QActionGroup *mToolsActionGroup =
nullptr;
234 QgsModelViewToolPan *mPanTool =
nullptr;
235 QObjectUniquePtr<QgsModelViewToolSelect> mSelectTool;
236 QgsModelGraphicsScene *mScene =
nullptr;
238 bool mHasChanged =
false;
239 QUndoStack *mUndoStack =
nullptr;
240 std::unique_ptr<QgsModelUndoCommand> mActiveCommand;
242 QAction *mUndoAction =
nullptr;
243 QAction *mRedoAction =
nullptr;
244 QUndoView *mUndoView =
nullptr;
245 QgsDockWidget *mUndoDock =
nullptr;
247 QMenu *mGroupMenu =
nullptr;
249 QAction *mActionCut =
nullptr;
250 QAction *mActionCopy =
nullptr;
251 QAction *mActionPaste =
nullptr;
252 int mBlockUndoCommands = 0;
253 int mIgnoreUndoStackChanges = 0;
255 QgsDockWidget *mConfigWidgetDock =
nullptr;
256 QgsModelDesignerConfigDockWidget *mConfigWidget =
nullptr;
258 QgsProcessingContextGenerator *mProcessingContextGenerator =
nullptr;
262 int mBlockRepaints = 0;
264 QgsProcessingModelResult mLastResult;
266 bool isDirty()
const;
268 void fillInputsTree();
269 void updateVariablesGui();
273 PanelStatus(
bool visible =
true,
bool active =
false )
274 : isVisible( visible )
280 QMap<QString, PanelStatus> mPanelStatus;
282 QgsProcessingContext mLayerStore;
286class GUI_EXPORT QgsModelChildDependenciesWidget :
public QWidget
291 QgsModelChildDependenciesWidget( QWidget *parent, QgsProcessingModelAlgorithm *model,
const QString &childId );
292 QList<QgsProcessingModelChildDependency> value()
const {
return mValue; }
293 void setValue(
const QList<QgsProcessingModelChildDependency> &value );
299 void updateSummaryText();
301 QLineEdit *mLineEdit =
nullptr;
302 QToolButton *mToolButton =
nullptr;
304 QgsProcessingModelAlgorithm *mModel =
nullptr;
307 QList<QgsProcessingModelChildDependency> mValue;
309 friend class TestProcessingGui;
A bar for displaying non-blocking messages to the user.
An interface for objects which can create Processing contexts.
Contains settings which reflect the context in which a Processing parameter widget is shown.
A utility class for dynamic handling of changes to screen properties.