16#ifndef QGSMODELDESIGNERDIALOG_H
17#define QGSMODELDESIGNERDIALOG_H
19#include "ui_qgsmodeldesignerdialogbase.h"
30class QgsProcessingModelAlgorithm;
31class QgsModelUndoCommand;
36class QgsProcessingAlgorithmWidgetBase;
49 explicit QgsModelerToolboxModel( QObject *parent =
nullptr );
50 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
51 Qt::DropActions supportedDragActions()
const override;
62class GUI_EXPORT QgsModelDesignerDialog :
public QMainWindow,
63 public QgsProcessingFeedbackGenerator,
66 public Ui::QgsModelDesignerDialogBase
70 QgsModelDesignerDialog( QWidget *parent
SIP_TRANSFERTHIS =
nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
71 ~QgsModelDesignerDialog()
override;
73 void closeEvent( QCloseEvent *event )
override;
78 QgsProcessingModelAlgorithm *model();
85 void setModel( QgsProcessingModelAlgorithm *model
SIP_TRANSFER );
90 void loadModel(
const QString &path );
98 void setModelScene( QgsModelGraphicsScene *scene
SIP_TRANSFER );
106 QgsModelGraphicsScene *modelScene();
109 QgsProcessingFeedback *createFeedback() override
SIP_FACTORY;
110 QgsProcessingParameterWidgetContext createWidgetContext() override;
126 void saveInProject();
138 QgsProcessingContext *processingContext() const override;
147 void exportToImage();
150 void exportAsPython();
151 void toggleComments(
bool show );
152 void toggleFeatureCount(
bool show );
153 void updateWindowTitle();
154 void deleteSelected();
155 void populateZoomToMenu();
157 void reorderInputs();
158 void reorderOutputs();
159 void setPanelVisibility(
bool hidden );
161 void runSelectedSteps();
162 void runFromChild( const QString &
id );
163 void run( const QSet<QString> &childAlgorithmSubset = QSet<QString>() );
164 void showChildAlgorithmOutputs( const QString &childId );
165 void showChildAlgorithmLog( const QString &childId );
166 void onItemFocused( QgsModelComponentGraphicItem *item );
168 void cancelRunningModel();
176 enum class SaveAction
185 void beginUndoCommand(
const QString &text,
const QString &
id = QString(), QgsModelUndoCommand::CommandOperation operation = QgsModelUndoCommand::CommandOperation::Unknown );
190 void endUndoCommand();
196 void abortUndoCommand();
198 void repaintModel(
bool showControls =
true );
200 void setDirty(
bool dirty );
205 bool validateSave( SaveAction action );
212 bool checkForUnsavedChanges();
217 void setLastRunResult(
const QgsProcessingModelResult &result );
226 void setModelName(
const QString &name );
228 bool saveModel(
bool saveAs =
false );
230 QPointF getPositionForParameterItem()
const;
231 QPointF getPositionForAlgorithmItem()
const;
237 void autoGenerateParameterName( QgsProcessingParameterDefinition *parameter )
const;
239 void addAlgorithm(
const QString &algorithmId,
const QPointF &pos );
240 void addInput(
const QString ¶meterType,
const QPointF &pos );
242 QgsProcessingAlgorithmWidget *createExecutionWidget();
244 void exportAsScriptAlgorithm();
246 std::unique_ptr< QgsProcessingContext > mContext;
248 std::unique_ptr<QgsProcessingModelAlgorithm> mModel;
250 QgsScreenHelper *mScreenHelper =
nullptr;
252 QgsMessageBar *mMessageBar =
nullptr;
253 QgsModelerToolboxModel *mAlgorithmsModel =
nullptr;
255 QPointer<QgsProcessingAlgorithmWidget> mAlgorithmWidget;
257 QVector<QPointer<QgsProcessingAlgorithmWidget>> mAlgorithmWidgetsToCleanUp;
259 QActionGroup *mToolsActionGroup =
nullptr;
261 QgsModelViewToolPan *mPanTool =
nullptr;
262 QObjectUniquePtr<QgsModelViewToolSelect> mSelectTool;
263 QgsModelGraphicsScene *mScene =
nullptr;
265 bool mHasChanged =
false;
266 QUndoStack *mUndoStack =
nullptr;
267 std::unique_ptr<QgsModelUndoCommand> mActiveCommand;
269 QAction *mUndoAction =
nullptr;
270 QAction *mRedoAction =
nullptr;
271 QUndoView *mUndoView =
nullptr;
272 QgsDockWidget *mUndoDock =
nullptr;
274 QMenu *mGroupMenu =
nullptr;
276 QAction *mActionCut =
nullptr;
277 QAction *mActionCopy =
nullptr;
278 QAction *mActionPaste =
nullptr;
279 int mBlockUndoCommands = 0;
280 int mIgnoreUndoStackChanges = 0;
282 QgsDockWidget *mConfigWidgetDock =
nullptr;
283 QgsModelDesignerConfigDockWidget *mConfigWidget =
nullptr;
287 int mBlockRepaints = 0;
289 QgsProcessingModelResult mLastResult;
290 QSet< QString > mOutdatedChildResults;
292 bool isDirty()
const;
294 void fillInputsTree();
295 void updateVariablesGui();
299 PanelStatus(
bool visible =
true,
bool active =
false )
300 : isVisible( visible )
306 QMap<QString, PanelStatus> mPanelStatus;
308 QgsProcessingContext mLayerStore;
313class GUI_EXPORT QgsModelChildDependenciesWidget :
public QWidget
318 QgsModelChildDependenciesWidget( QWidget *parent, QgsProcessingModelAlgorithm *model,
const QString &childId );
319 QList<QgsProcessingModelChildDependency> value()
const {
return mValue; }
320 void setValue(
const QList<QgsProcessingModelChildDependency> &value );
336 void updateSummaryText();
338 QLineEdit *mLineEdit =
nullptr;
339 QToolButton *mToolButton =
nullptr;
341 QgsProcessingModelAlgorithm *mModel =
nullptr;
344 QList<QgsProcessingModelChildDependency> mValue;
346 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.
An interface for objects which can create Processing widget contexts.
A utility class for dynamic handling of changes to screen properties.