16 #ifndef QGSMODELDESIGNERDIALOG_H
17 #define QGSMODELDESIGNERDIALOG_H
21 #include "ui_qgsmodeldesignerdialogbase.h"
24 #include "qgsprocessingmodelchilddependency.h"
27 class QgsProcessingModelAlgorithm;
28 class QgsModelUndoCommand;
40 explicit QgsModelerToolboxModel( QObject *parent =
nullptr );
41 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
42 Qt::DropActions supportedDragActions()
const override;
54 class GUI_EXPORT QgsModelDesignerDialog :
public QMainWindow,
public Ui::QgsModelDesignerDialogBase
59 QgsModelDesignerDialog( QWidget *parent
SIP_TRANSFERTHIS =
nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
60 ~QgsModelDesignerDialog()
override;
62 void closeEvent( QCloseEvent *event )
override;
67 void beginUndoCommand(
const QString &text,
int id = 0 );
72 void endUndoCommand();
77 QgsProcessingModelAlgorithm *model();
84 void setModel( QgsProcessingModelAlgorithm *model
SIP_TRANSFER );
89 void loadModel(
const QString &path );
94 void setModelScene( QgsModelGraphicsScene *scene
SIP_TRANSFER );
99 virtual void repaintModel(
bool showControls =
true ) = 0;
100 virtual void addAlgorithm(
const QString &algorithmId,
const QPointF &pos ) = 0;
101 virtual void addInput(
const QString &inputId,
const QPointF &pos ) = 0;
102 virtual void exportAsScriptAlgorithm() = 0;
104 virtual void saveModel(
bool saveAs =
false ) = 0;
106 QToolBar *toolbar() {
return mToolbar; }
107 QAction *actionOpen() {
return mActionOpen; }
108 QAction *actionSaveInProject() {
return mActionSaveInProject; }
109 QAction *actionEditHelp() {
return mActionEditHelp; }
110 QAction *actionRun() {
return mActionRun; }
112 QGraphicsView *view() {
return mView; }
114 void setDirty(
bool dirty );
126 bool checkForUnsavedChanges();
131 void setLastRunChildAlgorithmResults(
const QVariantMap &results );
136 void setLastRunChildAlgorithmInputs(
const QVariantMap &inputs );
143 void exportToImage();
146 void exportAsPython();
147 void toggleComments(
bool show );
148 void updateWindowTitle();
149 void deleteSelected();
150 void populateZoomToMenu();
152 void reorderInputs();
162 std::unique_ptr< QgsProcessingModelAlgorithm > mModel;
165 QgsModelerToolboxModel *mAlgorithmsModel =
nullptr;
167 QgsModelGraphicsScene *mScene =
nullptr;
169 bool mHasChanged =
false;
170 QUndoStack *mUndoStack =
nullptr;
171 std::unique_ptr< QgsModelUndoCommand > mActiveCommand;
173 QAction *mUndoAction =
nullptr;
174 QAction *mRedoAction =
nullptr;
175 QUndoView *mUndoView =
nullptr;
178 QMenu *mGroupMenu =
nullptr;
180 QAction *mActionCut =
nullptr;
181 QAction *mActionCopy =
nullptr;
182 QAction *mActionPaste =
nullptr;
183 int mBlockUndoCommands = 0;
184 int mIgnoreUndoStackChanges = 0;
188 int mBlockRepaints = 0;
190 QVariantMap mChildResults;
191 QVariantMap mChildInputs;
193 bool isDirty()
const;
195 void fillInputsTree();
196 void updateVariablesGui();
201 class GUI_EXPORT QgsModelChildDependenciesWidget :
public QWidget
207 QgsModelChildDependenciesWidget( QWidget *parent, QgsProcessingModelAlgorithm *model,
const QString &childId );
208 QList< QgsProcessingModelChildDependency > value()
const {
return mValue; }
209 void setValue(
const QList< QgsProcessingModelChildDependency > &value );
216 void updateSummaryText();
218 QLineEdit *mLineEdit =
nullptr;
219 QToolButton *mToolButton =
nullptr;
221 QgsProcessingModelAlgorithm *mModel =
nullptr;
224 QList< QgsProcessingModelChildDependency > mValue;
226 friend class TestProcessingGui;
230 #endif // QGSMODELDESIGNERDIALOG_H