16#ifndef QGSMODELDESIGNERDIALOG_H
17#define QGSMODELDESIGNERDIALOG_H
19#include "ui_qgsmodeldesignerdialogbase.h"
27class QgsProcessingModelAlgorithm;
28class QgsModelUndoCommand;
33class QgsProcessingAlgorithmDialogBase;
43 explicit QgsModelerToolboxModel( QObject *parent =
nullptr );
44 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
45 Qt::DropActions supportedDragActions()
const override;
56class GUI_EXPORT QgsModelDesignerDialog :
public QMainWindow,
public Ui::QgsModelDesignerDialogBase
60 QgsModelDesignerDialog( QWidget *parent
SIP_TRANSFERTHIS =
nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
61 ~QgsModelDesignerDialog()
override;
63 void closeEvent( QCloseEvent *event )
override;
68 void beginUndoCommand(
const QString &text,
int id = 0 );
73 void endUndoCommand();
79 void abortUndoCommand();
84 QgsProcessingModelAlgorithm *model();
91 void setModel( QgsProcessingModelAlgorithm *model
SIP_TRANSFER );
96 void loadModel(
const QString &path );
101 void setModelScene( QgsModelGraphicsScene *scene
SIP_TRANSFER );
108 enum class SaveAction
125 virtual void repaintModel(
bool showControls =
true ) = 0;
126 virtual void addAlgorithm(
const QString &algorithmId,
const QPointF &pos ) = 0;
128 virtual void addInput(
const QString &inputId,
const QPointF &pos ) = 0;
130 virtual void exportAsScriptAlgorithm() = 0;
132 virtual bool saveModel(
bool saveAs =
false ) = 0;
134 virtual QgsProcessingAlgorithmDialogBase *createExecutionDialog() = 0
SIP_TRANSFERBACK;
136 QToolBar *toolbar() {
return mToolbar; }
137 QAction *actionOpen() {
return mActionOpen; }
138 QAction *actionSaveInProject() {
return mActionSaveInProject; }
139 QAction *actionRun() {
return mActionRun; }
140 QgsMessageBar *messageBar() {
return mMessageBar; }
141 QGraphicsView *view() {
return mView; }
143 void setDirty(
bool dirty );
148 bool validateSave( SaveAction action );
155 bool checkForUnsavedChanges();
160 void setLastRunResult(
const QgsProcessingModelResult &result );
169 void setModelName(
const QString &name );
177 void exportToImage();
180 void exportAsPython();
181 void toggleComments(
bool show );
182 void updateWindowTitle();
183 void deleteSelected();
184 void populateZoomToMenu();
186 void reorderInputs();
187 void reorderOutputs();
188 void setPanelVisibility(
bool hidden );
190 void runSelectedSteps();
191 void runFromChild(
const QString &
id );
192 void run(
const QSet<QString> &childAlgorithmSubset = QSet<QString>() );
193 void showChildAlgorithmOutputs(
const QString &childId );
194 void showChildAlgorithmLog(
const QString &childId );
203 std::unique_ptr<QgsProcessingModelAlgorithm> mModel;
205 QgsScreenHelper *mScreenHelper =
nullptr;
207 QgsMessageBar *mMessageBar =
nullptr;
208 QgsModelerToolboxModel *mAlgorithmsModel =
nullptr;
210 QActionGroup *mToolsActionGroup =
nullptr;
212 QgsModelViewToolPan *mPanTool =
nullptr;
213 QgsModelViewToolSelect *mSelectTool =
nullptr;
214 QgsModelGraphicsScene *mScene =
nullptr;
216 bool mHasChanged =
false;
217 QUndoStack *mUndoStack =
nullptr;
218 std::unique_ptr<QgsModelUndoCommand> mActiveCommand;
220 QAction *mUndoAction =
nullptr;
221 QAction *mRedoAction =
nullptr;
222 QUndoView *mUndoView =
nullptr;
223 QgsDockWidget *mUndoDock =
nullptr;
225 QMenu *mGroupMenu =
nullptr;
227 QAction *mActionCut =
nullptr;
228 QAction *mActionCopy =
nullptr;
229 QAction *mActionPaste =
nullptr;
230 int mBlockUndoCommands = 0;
231 int mIgnoreUndoStackChanges = 0;
235 int mBlockRepaints = 0;
237 QgsProcessingModelResult mLastResult;
239 bool isDirty()
const;
241 void fillInputsTree();
242 void updateVariablesGui();
246 PanelStatus(
bool visible =
true,
bool active =
false )
247 : isVisible( visible )
253 QMap<QString, PanelStatus> mPanelStatus;
255 QgsProcessingContext mLayerStore;
259class GUI_EXPORT QgsModelChildDependenciesWidget :
public QWidget
264 QgsModelChildDependenciesWidget( QWidget *parent, QgsProcessingModelAlgorithm *model,
const QString &childId );
265 QList<QgsProcessingModelChildDependency> value()
const {
return mValue; }
266 void setValue(
const QList<QgsProcessingModelChildDependency> &value );
272 void updateSummaryText();
274 QLineEdit *mLineEdit =
nullptr;
275 QToolButton *mToolButton =
nullptr;
277 QgsProcessingModelAlgorithm *mModel =
nullptr;
280 QList<QgsProcessingModelChildDependency> mValue;
282 friend class TestProcessingGui;
A bar for displaying non-blocking messages to the user.
A utility class for dynamic handling of changes to screen properties.