16#ifndef QGSMODELDESIGNERDIALOG_H
17#define QGSMODELDESIGNERDIALOG_H
19#include "ui_qgsmodeldesignerdialogbase.h"
28class QgsProcessingModelAlgorithm;
29class QgsModelUndoCommand;
34class QgsProcessingAlgorithmDialogBase;
47 explicit QgsModelerToolboxModel( QObject *parent =
nullptr );
48 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
49 Qt::DropActions supportedDragActions()
const override;
60class GUI_EXPORT QgsModelDesignerDialog :
public QMainWindow,
public Ui::QgsModelDesignerDialogBase
64 QgsModelDesignerDialog( QWidget *parent
SIP_TRANSFERTHIS =
nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
65 ~QgsModelDesignerDialog()
override;
67 void closeEvent( QCloseEvent *event )
override;
72 void beginUndoCommand(
const QString &text,
const QString &
id = QString(), QgsModelUndoCommand::CommandOperation operation
SIP_PYARGREMOVE = QgsModelUndoCommand::CommandOperation::Unknown );
77 void endUndoCommand();
83 void abortUndoCommand();
88 QgsProcessingModelAlgorithm *model();
95 void setModel( QgsProcessingModelAlgorithm *model
SIP_TRANSFER );
100 void loadModel(
const QString &path );
107 void setModelScene( QgsModelGraphicsScene *scene
SIP_TRANSFER );
115 QgsModelGraphicsScene *modelScene();
122 enum class SaveAction
139 virtual void repaintModel(
bool showControls =
true ) = 0;
140 virtual void addAlgorithm(
const QString &algorithmId,
const QPointF &pos ) = 0;
142 virtual void addInput(
const QString &inputId,
const QPointF &pos ) = 0;
144 virtual void exportAsScriptAlgorithm() = 0;
146 virtual bool saveModel(
bool saveAs =
false ) = 0;
148 virtual QgsProcessingAlgorithmDialogBase *createExecutionDialog() = 0
SIP_TRANSFERBACK;
153 virtual QgsProcessingParameterWidgetContext createWidgetContext() = 0;
159 void registerProcessingContextGenerator( QgsProcessingContextGenerator *generator );
161 QToolBar *toolbar() {
return mToolbar; }
162 QAction *actionOpen() {
return mActionOpen; }
163 QAction *actionSaveInProject() {
return mActionSaveInProject; }
164 QAction *actionRun() {
return mActionRun; }
165 QgsMessageBar *messageBar() {
return mMessageBar; }
166 QGraphicsView *view() {
return mView; }
168 void setDirty(
bool dirty );
173 bool validateSave( SaveAction action );
180 bool checkForUnsavedChanges();
185 void setLastRunResult(
const QgsProcessingModelResult &result );
194 void setModelName(
const QString &name );
202 void exportToImage();
205 void exportAsPython();
206 void toggleComments(
bool show );
207 void toggleFeatureCount(
bool show );
208 void updateWindowTitle();
209 void deleteSelected();
210 void populateZoomToMenu();
212 void reorderInputs();
213 void reorderOutputs();
214 void setPanelVisibility(
bool hidden );
216 void runSelectedSteps();
217 void runFromChild(
const QString &
id );
218 void run(
const QSet<QString> &childAlgorithmSubset = QSet<QString>() );
219 void showChildAlgorithmOutputs(
const QString &childId );
220 void showChildAlgorithmLog(
const QString &childId );
221 void onItemFocused( QgsModelComponentGraphicItem *item );
224 std::unique_ptr<QgsProcessingModelAlgorithm> mModel;
226 QgsScreenHelper *mScreenHelper =
nullptr;
228 QgsMessageBar *mMessageBar =
nullptr;
229 QgsModelerToolboxModel *mAlgorithmsModel =
nullptr;
231 QActionGroup *mToolsActionGroup =
nullptr;
233 QgsModelViewToolPan *mPanTool =
nullptr;
234 QgsModelViewToolSelect *mSelectTool =
nullptr;
235 QgsModelGraphicsScene *mScene =
nullptr;
237 bool mHasChanged =
false;
238 QUndoStack *mUndoStack =
nullptr;
239 std::unique_ptr<QgsModelUndoCommand> mActiveCommand;
241 QAction *mUndoAction =
nullptr;
242 QAction *mRedoAction =
nullptr;
243 QUndoView *mUndoView =
nullptr;
244 QgsDockWidget *mUndoDock =
nullptr;
246 QMenu *mGroupMenu =
nullptr;
248 QAction *mActionCut =
nullptr;
249 QAction *mActionCopy =
nullptr;
250 QAction *mActionPaste =
nullptr;
251 int mBlockUndoCommands = 0;
252 int mIgnoreUndoStackChanges = 0;
254 QgsDockWidget *mConfigWidgetDock =
nullptr;
255 QgsModelDesignerConfigDockWidget *mConfigWidget =
nullptr;
257 QgsProcessingContextGenerator *mProcessingContextGenerator =
nullptr;
261 int mBlockRepaints = 0;
263 QgsProcessingModelResult mLastResult;
265 bool isDirty()
const;
267 void fillInputsTree();
268 void updateVariablesGui();
272 PanelStatus(
bool visible =
true,
bool active =
false )
273 : isVisible( visible )
279 QMap<QString, PanelStatus> mPanelStatus;
281 QgsProcessingContext mLayerStore;
285class GUI_EXPORT QgsModelChildDependenciesWidget :
public QWidget
290 QgsModelChildDependenciesWidget( QWidget *parent, QgsProcessingModelAlgorithm *model,
const QString &childId );
291 QList<QgsProcessingModelChildDependency> value()
const {
return mValue; }
292 void setValue(
const QList<QgsProcessingModelChildDependency> &value );
298 void updateSummaryText();
300 QLineEdit *mLineEdit =
nullptr;
301 QToolButton *mToolButton =
nullptr;
303 QgsProcessingModelAlgorithm *mModel =
nullptr;
306 QList<QgsProcessingModelChildDependency> mValue;
308 friend class TestProcessingGui;
A bar for displaying non-blocking messages to the user.
An interface for objects which can create Processing contexts.
Contains settings which reflect the context in which a Processing parameter widget is shown.
A utility class for dynamic handling of changes to screen properties.