16 #ifndef QGSMODELDESIGNERDIALOG_H
17 #define QGSMODELDESIGNERDIALOG_H
21 #include "ui_qgsmodeldesignerdialogbase.h"
27 class QgsProcessingModelAlgorithm;
28 class QgsModelUndoCommand;
41 explicit QgsModelerToolboxModel( QObject *parent =
nullptr );
42 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
43 Qt::DropActions supportedDragActions()
const override;
55 class 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();
78 QgsProcessingModelAlgorithm *model();
85 void setModel( QgsProcessingModelAlgorithm *model
SIP_TRANSFER );
90 void loadModel(
const QString &path );
95 void setModelScene( QgsModelGraphicsScene *scene
SIP_TRANSFER );
102 enum class SaveAction
120 virtual void repaintModel(
bool showControls =
true ) = 0;
121 virtual void addAlgorithm(
const QString &algorithmId,
const QPointF &pos ) = 0;
122 virtual void addInput(
const QString &inputId,
const QPointF &pos ) = 0;
123 virtual void exportAsScriptAlgorithm() = 0;
125 virtual bool saveModel(
bool saveAs =
false ) = 0;
127 QToolBar *toolbar() {
return mToolbar; }
128 QAction *actionOpen() {
return mActionOpen; }
129 QAction *actionSaveInProject() {
return mActionSaveInProject; }
130 QAction *actionEditHelp() {
return mActionEditHelp; }
131 QAction *actionRun() {
return mActionRun; }
133 QGraphicsView *view() {
return mView; }
135 void setDirty(
bool dirty );
140 bool validateSave( SaveAction action );
147 bool checkForUnsavedChanges();
152 void setLastRunChildAlgorithmResults(
const QVariantMap &results );
157 void setLastRunChildAlgorithmInputs(
const QVariantMap &inputs );
166 void setModelName(
const QString &name );
174 void exportToImage();
177 void exportAsPython();
178 void toggleComments(
bool show );
179 void updateWindowTitle();
180 void deleteSelected();
181 void populateZoomToMenu();
183 void reorderInputs();
184 void setPanelVisibility(
bool hidden );
194 std::unique_ptr< QgsProcessingModelAlgorithm > mModel;
197 QgsModelerToolboxModel *mAlgorithmsModel =
nullptr;
199 QActionGroup *mToolsActionGroup =
nullptr;
203 QgsModelGraphicsScene *mScene =
nullptr;
205 bool mHasChanged =
false;
206 QUndoStack *mUndoStack =
nullptr;
207 std::unique_ptr< QgsModelUndoCommand > mActiveCommand;
209 QAction *mUndoAction =
nullptr;
210 QAction *mRedoAction =
nullptr;
211 QUndoView *mUndoView =
nullptr;
214 QMenu *mGroupMenu =
nullptr;
216 QAction *mActionCut =
nullptr;
217 QAction *mActionCopy =
nullptr;
218 QAction *mActionPaste =
nullptr;
219 int mBlockUndoCommands = 0;
220 int mIgnoreUndoStackChanges = 0;
224 int mBlockRepaints = 0;
226 QVariantMap mChildResults;
227 QVariantMap mChildInputs;
229 bool isDirty()
const;
231 void fillInputsTree();
232 void updateVariablesGui();
236 PanelStatus(
bool visible =
true,
bool active =
false )
237 : isVisible( visible )
243 QMap< QString, PanelStatus > mPanelStatus;
248 class GUI_EXPORT QgsModelChildDependenciesWidget :
public QWidget
254 QgsModelChildDependenciesWidget( QWidget *parent, QgsProcessingModelAlgorithm *model,
const QString &childId );
255 QList< QgsProcessingModelChildDependency > value()
const {
return mValue; }
256 void setValue(
const QList< QgsProcessingModelChildDependency > &value );
263 void updateSummaryText();
265 QLineEdit *mLineEdit =
nullptr;
266 QToolButton *mToolButton =
nullptr;
268 QgsProcessingModelAlgorithm *mModel =
nullptr;
271 QList< QgsProcessingModelChildDependency > mValue;
273 friend class TestProcessingGui;
A bar for displaying non-blocking messages to the user.