16 #ifndef QGSMODELDESIGNERDIALOG_H
17 #define QGSMODELDESIGNERDIALOG_H
21 #include "ui_qgsmodeldesignerdialogbase.h"
24 #include "qgsprocessingmodelchilddependency.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 );
100 virtual void repaintModel(
bool showControls =
true ) = 0;
101 virtual void addAlgorithm(
const QString &algorithmId,
const QPointF &pos ) = 0;
102 virtual void addInput(
const QString &inputId,
const QPointF &pos ) = 0;
103 virtual void exportAsScriptAlgorithm() = 0;
105 virtual void saveModel(
bool saveAs =
false ) = 0;
107 QToolBar *toolbar() {
return mToolbar; }
108 QAction *actionOpen() {
return mActionOpen; }
109 QAction *actionSaveInProject() {
return mActionSaveInProject; }
110 QAction *actionEditHelp() {
return mActionEditHelp; }
111 QAction *actionRun() {
return mActionRun; }
113 QGraphicsView *view() {
return mView; }
115 void setDirty(
bool dirty );
127 bool checkForUnsavedChanges();
132 void setLastRunChildAlgorithmResults(
const QVariantMap &results );
137 void setLastRunChildAlgorithmInputs(
const QVariantMap &inputs );
144 void exportToImage();
147 void exportAsPython();
148 void toggleComments(
bool show );
149 void updateWindowTitle();
150 void deleteSelected();
151 void populateZoomToMenu();
153 void reorderInputs();
154 void setPanelVisibility(
bool hidden );
164 std::unique_ptr< QgsProcessingModelAlgorithm > mModel;
167 QgsModelerToolboxModel *mAlgorithmsModel =
nullptr;
169 QActionGroup *mToolsActionGroup =
nullptr;
173 QgsModelGraphicsScene *mScene =
nullptr;
175 bool mHasChanged =
false;
176 QUndoStack *mUndoStack =
nullptr;
177 std::unique_ptr< QgsModelUndoCommand > mActiveCommand;
179 QAction *mUndoAction =
nullptr;
180 QAction *mRedoAction =
nullptr;
181 QUndoView *mUndoView =
nullptr;
184 QMenu *mGroupMenu =
nullptr;
186 QAction *mActionCut =
nullptr;
187 QAction *mActionCopy =
nullptr;
188 QAction *mActionPaste =
nullptr;
189 int mBlockUndoCommands = 0;
190 int mIgnoreUndoStackChanges = 0;
194 int mBlockRepaints = 0;
196 QVariantMap mChildResults;
197 QVariantMap mChildInputs;
199 bool isDirty()
const;
201 void fillInputsTree();
202 void updateVariablesGui();
206 PanelStatus(
bool visible =
true,
bool active =
false )
207 : isVisible( visible )
213 QMap< QString, PanelStatus > mPanelStatus;
218 class GUI_EXPORT QgsModelChildDependenciesWidget :
public QWidget
224 QgsModelChildDependenciesWidget( QWidget *parent, QgsProcessingModelAlgorithm *model,
const QString &childId );
225 QList< QgsProcessingModelChildDependency > value()
const {
return mValue; }
226 void setValue(
const QList< QgsProcessingModelChildDependency > &value );
233 void updateSummaryText();
235 QLineEdit *mLineEdit =
nullptr;
236 QToolButton *mToolButton =
nullptr;
238 QgsProcessingModelAlgorithm *mModel =
nullptr;
241 QList< QgsProcessingModelChildDependency > mValue;
243 friend class TestProcessingGui;
A bar for displaying non-blocking messages to the user.