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 toggleFeatureCount(
bool show );
183 void updateWindowTitle();
184 void deleteSelected();
185 void populateZoomToMenu();
187 void reorderInputs();
188 void reorderOutputs();
189 void setPanelVisibility(
bool hidden );
191 void runSelectedSteps();
192 void runFromChild(
const QString &
id );
193 void run(
const QSet<QString> &childAlgorithmSubset = QSet<QString>() );
194 void showChildAlgorithmOutputs(
const QString &childId );
195 void showChildAlgorithmLog(
const QString &childId );
204 std::unique_ptr<QgsProcessingModelAlgorithm> mModel;
206 QgsScreenHelper *mScreenHelper =
nullptr;
208 QgsMessageBar *mMessageBar =
nullptr;
209 QgsModelerToolboxModel *mAlgorithmsModel =
nullptr;
211 QActionGroup *mToolsActionGroup =
nullptr;
213 QgsModelViewToolPan *mPanTool =
nullptr;
214 QgsModelViewToolSelect *mSelectTool =
nullptr;
215 QgsModelGraphicsScene *mScene =
nullptr;
217 bool mHasChanged =
false;
218 QUndoStack *mUndoStack =
nullptr;
219 std::unique_ptr<QgsModelUndoCommand> mActiveCommand;
221 QAction *mUndoAction =
nullptr;
222 QAction *mRedoAction =
nullptr;
223 QUndoView *mUndoView =
nullptr;
224 QgsDockWidget *mUndoDock =
nullptr;
226 QMenu *mGroupMenu =
nullptr;
228 QAction *mActionCut =
nullptr;
229 QAction *mActionCopy =
nullptr;
230 QAction *mActionPaste =
nullptr;
231 int mBlockUndoCommands = 0;
232 int mIgnoreUndoStackChanges = 0;
236 int mBlockRepaints = 0;
238 QgsProcessingModelResult mLastResult;
240 bool isDirty()
const;
242 void fillInputsTree();
243 void updateVariablesGui();
247 PanelStatus(
bool visible =
true,
bool active =
false )
248 : isVisible( visible )
254 QMap<QString, PanelStatus> mPanelStatus;
256 QgsProcessingContext mLayerStore;
260class GUI_EXPORT QgsModelChildDependenciesWidget :
public QWidget
265 QgsModelChildDependenciesWidget( QWidget *parent, QgsProcessingModelAlgorithm *model,
const QString &childId );
266 QList<QgsProcessingModelChildDependency> value()
const {
return mValue; }
267 void setValue(
const QList<QgsProcessingModelChildDependency> &value );
273 void updateSummaryText();
275 QLineEdit *mLineEdit =
nullptr;
276 QToolButton *mToolButton =
nullptr;
278 QgsProcessingModelAlgorithm *mModel =
nullptr;
281 QList<QgsProcessingModelChildDependency> mValue;
283 friend class TestProcessingGui;
A bar for displaying non-blocking messages to the user.
A utility class for dynamic handling of changes to screen properties.