Class: QgsModelDesignerDialog

Model designer dialog base class.

Warning

Not stable API

Added in version 3.14.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: addAlgorithm(), addInput(), createExecutionDialog(), exportAsScriptAlgorithm(), repaintModel(), saveModel()

Class Hierarchy

Inheritance diagram of qgis.gui.QgsModelDesignerDialog

Base classes

QMainWindow

QWidget

QObject

QPaintDevice

class qgis.gui.QgsModelDesignerDialog[source]

Bases: QMainWindow

class SaveAction(*values)

Bases: IntEnum

Save action.

Added in version 3.24.

  • SaveAsFile: Save model as a file

  • SaveInProject: Save model into project

SaveAsFile = 0
SaveInProject = 1
abortUndoCommand(self)[source]

Aborts pending undo command, turning last call to beginUndoCommand obsolete

Added in version 4.0.

actionOpen(self) QAction | None[source]
Return type:

Optional[QAction]

actionRun(self) QAction | None[source]
Return type:

Optional[QAction]

actionSaveInProject(self) QAction | None[source]
Return type:

Optional[QAction]

activate(self)[source]

Raise, unminimize and activate this window.

Added in version 3.24.

abstract addAlgorithm(self, algorithmId: str | None, pos: QPointF | QPoint)[source]
Parameters:
  • algorithmId (Optional[str])

  • pos (Union[QPointF, QPoint])

abstract addInput(self, inputId: str | None, pos: QPointF | QPoint)[source]
Parameters:
  • inputId (Optional[str])

  • pos (Union[QPointF, QPoint])

beginUndoCommand(self, text: str | None, id: int = 0)[source]

Starts an undo command. This should be called before any changes are made to the model.

Parameters:
  • text (Optional[str])

  • id (int = 0)

checkForUnsavedChanges(self) bool[source]

Checks if there are unsaved changes in the model, and if so, prompts the user to save them.

Returns False if the cancel option was selected

Return type:

bool

abstract createExecutionDialog(self) QgsProcessingAlgorithmDialogBase | None[source]
Return type:

Optional[QgsProcessingAlgorithmDialogBase]

endUndoCommand(self)[source]

Ends the current undo command. This should be called after changes are made to the model.

abstract exportAsScriptAlgorithm(self)[source]
loadModel(self, path: str | None)[source]

Loads a model into the designer from the specified file path.

Parameters:

path (Optional[str])

messageBar(self) QgsMessageBar | None[source]
Return type:

Optional[QgsMessageBar]

model(self) QgsProcessingModelAlgorithm | None[source]

Returns the model shown in the dialog.

Return type:

Optional[QgsProcessingModelAlgorithm]

abstract repaintModel(self, showControls: bool = True)[source]
Parameters:

showControls (bool = True)

abstract saveModel(self, saveAs: bool = False) bool[source]
Parameters:

saveAs (bool = False)

Return type:

bool

setDirty(self, dirty: bool)[source]
Parameters:

dirty (bool)

setLastRunResult(self, result: QgsProcessingModelResult)[source]

Sets the result of the last run of the model through the designer window.

Parameters:

result (QgsProcessingModelResult)

setModel(self, model: QgsProcessingModelAlgorithm | None)[source]

Sets the model shown in the dialog.

Ownership of model is transferred to the dialog.

Parameters:

model (Optional[QgsProcessingModelAlgorithm])

setModelName(self, name: str | None)[source]

Sets the model name.

Updates both the name text edit and the model name itself.

Added in version 3.24.

Parameters:

name (Optional[str])

setModelScene(self, scene: QgsModelGraphicsScene | None)[source]

Sets the related scene.

Parameters:

scene (Optional[QgsModelGraphicsScene])

toolbar(self) QToolBar | None[source]
Return type:

Optional[QToolBar]

validateSave(self, action: QgsModelDesignerDialog.SaveAction) bool[source]

Checks if the model can current be saved, and returns True if it can.

Parameters:

action (QgsModelDesignerDialog.SaveAction)

Return type:

bool

view(self) QGraphicsView | None[source]
Return type:

Optional[QGraphicsView]