16#ifndef QGSMODELDESIGNERDIALOG_H
17#define QGSMODELDESIGNERDIALOG_H
21#include "ui_qgsmodeldesignerdialogbase.h"
27class QgsProcessingModelAlgorithm;
28class QgsModelUndoCommand;
42 explicit QgsModelerToolboxModel( QObject *parent =
nullptr );
43 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
44 Qt::DropActions supportedDragActions()
const override;
56class GUI_EXPORT QgsModelDesignerDialog :
public QMainWindow,
public Ui::QgsModelDesignerDialogBase
61 QgsModelDesignerDialog( QWidget *parent
SIP_TRANSFERTHIS =
nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
62 ~QgsModelDesignerDialog()
override;
64 void closeEvent( QCloseEvent *event )
override;
69 void beginUndoCommand(
const QString &text,
int id = 0 );
74 void endUndoCommand();
79 QgsProcessingModelAlgorithm *model();
86 void setModel( QgsProcessingModelAlgorithm *model
SIP_TRANSFER );
91 void loadModel(
const QString &path );
96 void setModelScene( QgsModelGraphicsScene *scene
SIP_TRANSFER );
103 enum class SaveAction
121 virtual void repaintModel(
bool showControls =
true ) = 0;
122 virtual void addAlgorithm(
const QString &algorithmId,
const QPointF &pos ) = 0;
124 virtual void addInput(
const QString &inputId,
const QPointF &pos ) = 0;
126 virtual void exportAsScriptAlgorithm() = 0;
128 virtual bool saveModel(
bool saveAs =
false ) = 0;
130 QToolBar *toolbar() {
return mToolbar; }
131 QAction *actionOpen() {
return mActionOpen; }
132 QAction *actionSaveInProject() {
return mActionSaveInProject; }
133 QAction *actionRun() {
return mActionRun; }
135 QGraphicsView *view() {
return mView; }
137 void setDirty(
bool dirty );
142 bool validateSave( SaveAction action );
149 bool checkForUnsavedChanges();
154 void setLastRunChildAlgorithmResults(
const QVariantMap &results );
159 void setLastRunChildAlgorithmInputs(
const QVariantMap &inputs );
168 void setModelName(
const QString &name );
176 void exportToImage();
179 void exportAsPython();
180 void toggleComments(
bool show );
181 void updateWindowTitle();
182 void deleteSelected();
183 void populateZoomToMenu();
185 void reorderInputs();
186 void reorderOutputs();
187 void setPanelVisibility(
bool hidden );
198 std::unique_ptr< QgsProcessingModelAlgorithm > mModel;
203 QgsModelerToolboxModel *mAlgorithmsModel =
nullptr;
205 QActionGroup *mToolsActionGroup =
nullptr;
209 QgsModelGraphicsScene *mScene =
nullptr;
211 bool mHasChanged =
false;
212 QUndoStack *mUndoStack =
nullptr;
213 std::unique_ptr< QgsModelUndoCommand > mActiveCommand;
215 QAction *mUndoAction =
nullptr;
216 QAction *mRedoAction =
nullptr;
217 QUndoView *mUndoView =
nullptr;
220 QMenu *mGroupMenu =
nullptr;
222 QAction *mActionCut =
nullptr;
223 QAction *mActionCopy =
nullptr;
224 QAction *mActionPaste =
nullptr;
225 int mBlockUndoCommands = 0;
226 int mIgnoreUndoStackChanges = 0;
230 int mBlockRepaints = 0;
232 QVariantMap mChildResults;
233 QVariantMap mChildInputs;
235 bool isDirty()
const;
237 void fillInputsTree();
238 void updateVariablesGui();
242 PanelStatus(
bool visible =
true,
bool active =
false )
243 : isVisible( visible )
249 QMap< QString, PanelStatus > mPanelStatus;
254class GUI_EXPORT QgsModelChildDependenciesWidget :
public QWidget
260 QgsModelChildDependenciesWidget( QWidget *parent, QgsProcessingModelAlgorithm *model,
const QString &childId );
261 QList< QgsProcessingModelChildDependency > value()
const {
return mValue; }
262 void setValue(
const QList< QgsProcessingModelChildDependency > &value );
269 void updateSummaryText();
271 QLineEdit *mLineEdit =
nullptr;
272 QToolButton *mToolButton =
nullptr;
274 QgsProcessingModelAlgorithm *mModel =
nullptr;
277 QList< QgsProcessingModelChildDependency > mValue;
279 friend class TestProcessingGui;
A bar for displaying non-blocking messages to the user.
A utility class for dynamic handling of changes to screen properties.