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;
123 virtual void addInput(
const QString &inputId,
const QPointF &pos ) = 0;
124 virtual void exportAsScriptAlgorithm() = 0;
126 virtual bool saveModel(
bool saveAs =
false ) = 0;
128 QToolBar *toolbar() {
return mToolbar; }
129 QAction *actionOpen() {
return mActionOpen; }
130 QAction *actionSaveInProject() {
return mActionSaveInProject; }
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 );
195 std::unique_ptr< QgsProcessingModelAlgorithm > mModel;
200 QgsModelerToolboxModel *mAlgorithmsModel =
nullptr;
202 QActionGroup *mToolsActionGroup =
nullptr;
206 QgsModelGraphicsScene *mScene =
nullptr;
208 bool mHasChanged =
false;
209 QUndoStack *mUndoStack =
nullptr;
210 std::unique_ptr< QgsModelUndoCommand > mActiveCommand;
212 QAction *mUndoAction =
nullptr;
213 QAction *mRedoAction =
nullptr;
214 QUndoView *mUndoView =
nullptr;
217 QMenu *mGroupMenu =
nullptr;
219 QAction *mActionCut =
nullptr;
220 QAction *mActionCopy =
nullptr;
221 QAction *mActionPaste =
nullptr;
222 int mBlockUndoCommands = 0;
223 int mIgnoreUndoStackChanges = 0;
227 int mBlockRepaints = 0;
229 QVariantMap mChildResults;
230 QVariantMap mChildInputs;
232 bool isDirty()
const;
234 void fillInputsTree();
235 void updateVariablesGui();
239 PanelStatus(
bool visible =
true,
bool active =
false )
240 : isVisible( visible )
246 QMap< QString, PanelStatus > mPanelStatus;
251class GUI_EXPORT QgsModelChildDependenciesWidget :
public QWidget
257 QgsModelChildDependenciesWidget( QWidget *parent, QgsProcessingModelAlgorithm *model,
const QString &childId );
258 QList< QgsProcessingModelChildDependency > value()
const {
return mValue; }
259 void setValue(
const QList< QgsProcessingModelChildDependency > &value );
266 void updateSummaryText();
268 QLineEdit *mLineEdit =
nullptr;
269 QToolButton *mToolButton =
nullptr;
271 QgsProcessingModelAlgorithm *mModel =
nullptr;
274 QList< QgsProcessingModelChildDependency > mValue;
276 friend class TestProcessingGui;
A bar for displaying non-blocking messages to the user.
A utility class for dynamic handling of changes to screen properties.