Class: QgsModelGraphicsScene¶
QGraphicsScene subclass representing the model designer.
Warning
Not stable API
Added in version 3.14.
Class Hierarchy¶
Base classes¶
Methods
Returns the graphic item corresponding to the specified child algorithm |
|
Returns the topmost component item at a specified position. |
|
Creates a new graphic item for a model group box. |
|
Populates the scene by creating items representing the specified model. |
|
Clears any selected items in the scene. |
|
Returns the current combination of flags set for the scene. |
|
Returns the graphic item corresponding to the specified group box uuid. |
|
Returns the message bar associated with the scene. |
|
Returns the |
|
Requests a complete rebuild of a model by emitting the according signal |
|
Selects all the components in the scene. |
|
Returns list of selected component items. |
|
Enables or disables a particular flag for the scene. |
|
Sets the combination of flags controlling how the scene is rendered and behaves. |
|
Sets the result of the last run of the model through the designer window. |
|
Sets the message bar associated with the scene. |
|
Clears any selected items and sets item as the current selection. |
|
Shows a warning message, allowing users to click a button to see the full details (longMessage). |
|
Updates the scene rect based on the bounds of the model. |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of QgsModelGraphicsScene. See the FAQ for more details.
Creates a new graphic item for a model child algorithm. |
|
Creates a new graphic item for a model comment. |
|
Creates a new graphic item for a model output. |
|
Creates a new graphic item for a model parameter. |
Signals
Emitted whenever a component of the model is about to be changed. |
|
Emitted whenever a component of the model is changed. |
|
Emitted when a change in the model requires a full rebuild of the scene. |
|
Emitted when the user opts to run the part of the model starting from the specified child algorithm. |
|
Emitted when the user opts to run selected steps from the model. |
|
Emitted whenever the selected item changes. |
|
Emitted when the user opts to view the previous log from the child algorithm with matching ID. |
|
Emitted when the user opts to view previous results from the child algorithm with matching ID. |
Attributes
- class qgis.gui.QgsModelGraphicsScene[source]¶
Bases:
QGraphicsScene
- __init__(parent: QObject | None = None)
Constructor for QgsModelGraphicsScene with the specified
parent
object.- Parameters:
parent (Optional[QObject] = None)
- ArrowLink = 1¶
- class Flag¶
Bases:
int
- FlagHideComments = 4¶
- FlagHideControls = 2¶
- class Flags¶
- class Flags(f: QgsModelGraphicsScene.Flags | QgsModelGraphicsScene.Flag)
- class Flags(a0: QgsModelGraphicsScene.Flags)
Bases:
object
- GroupBox = 0¶
- ModelComponent = 2¶
- MouseHandles = 99¶
- RubberBand = 100¶
- ZSnapIndicator = 101¶
- class ZValues¶
Bases:
int
- childAlgorithmItem(self, childId: str | None) QgsModelChildAlgorithmGraphicItem | None [source]¶
Returns the graphic item corresponding to the specified child algorithm
Added in version 3.44.
- Parameters:
childId (Optional[str])
- Return type:
Optional[QgsModelChildAlgorithmGraphicItem]
- signal componentAboutToChange(text: str, id: int = 0)[source]¶
Emitted whenever a component of the model is about to be changed.
The
text
argument gives the translated text describing the change about to occur, and the optionalid
can be used to group the associated undo commands.- Parameters:
text (str)
id (int = 0)
- componentItemAt(self, position: QPointF | QPoint) QgsModelComponentGraphicItem | None [source]¶
Returns the topmost component item at a specified
position
.- Parameters:
position (Union[QPointF, QPoint])
- Return type:
Optional[QgsModelComponentGraphicItem]
- virtual createChildAlgGraphicItem(self, model: QgsProcessingModelAlgorithm | None, child: QgsProcessingModelChildAlgorithm | None) QgsModelChildAlgorithmGraphicItem | None [source]¶
Creates a new graphic item for a model child algorithm.
- Parameters:
model (Optional[QgsProcessingModelAlgorithm])
child (Optional[QgsProcessingModelChildAlgorithm])
- Return type:
Optional[QgsModelChildAlgorithmGraphicItem]
- virtual createCommentGraphicItem(self, model: QgsProcessingModelAlgorithm | None, comment: QgsProcessingModelComment | None, parentItem: QgsModelComponentGraphicItem | None) QgsModelComponentGraphicItem | None [source]¶
Creates a new graphic item for a model comment.
- Parameters:
model (Optional[QgsProcessingModelAlgorithm])
comment (Optional[QgsProcessingModelComment])
parentItem (Optional[QgsModelComponentGraphicItem])
- Return type:
Optional[QgsModelComponentGraphicItem]
- createGroupBoxGraphicItem(self, model: QgsProcessingModelAlgorithm | None, box: QgsProcessingModelGroupBox | None) QgsModelComponentGraphicItem | None [source]¶
Creates a new graphic item for a model group box.
- Parameters:
model (Optional[QgsProcessingModelAlgorithm])
box (Optional[QgsProcessingModelGroupBox])
- Return type:
Optional[QgsModelComponentGraphicItem]
- createItems(self, model: QgsProcessingModelAlgorithm | None, context: QgsProcessingContext)[source]¶
Populates the scene by creating items representing the specified
model
.- Parameters:
model (Optional[QgsProcessingModelAlgorithm])
context (QgsProcessingContext)
- virtual createOutputGraphicItem(self, model: QgsProcessingModelAlgorithm | None, output: QgsProcessingModelOutput | None) QgsModelComponentGraphicItem | None [source]¶
Creates a new graphic item for a model output.
- Parameters:
model (Optional[QgsProcessingModelAlgorithm])
output (Optional[QgsProcessingModelOutput])
- Return type:
Optional[QgsModelComponentGraphicItem]
- virtual createParameterGraphicItem(self, model: QgsProcessingModelAlgorithm | None, param: QgsProcessingModelParameter | None) QgsModelComponentGraphicItem | None [source]¶
Creates a new graphic item for a model parameter.
- Parameters:
model (Optional[QgsProcessingModelAlgorithm])
param (Optional[QgsProcessingModelParameter])
- Return type:
Optional[QgsModelComponentGraphicItem]
- deselectAll(self)[source]¶
Clears any selected items in the scene.
Call this method rather than QGraphicsScene.clearSelection, as the latter does not correctly emit signals to allow the scene’s model to update.
- flags(self) QgsModelGraphicsScene.Flags [source]¶
Returns the current combination of flags set for the scene.
See also
See also
- Return type:
- groupBoxItem(self, uuid: str | None) QgsModelComponentGraphicItem | None [source]¶
Returns the graphic item corresponding to the specified group box
uuid
.- Parameters:
uuid (Optional[str])
- Return type:
Optional[QgsModelComponentGraphicItem]
- messageBar(self) QgsMessageBar | None [source]¶
Returns the message bar associated with the scene.
See also
- Return type:
Optional[QgsMessageBar]
- model(self) QgsProcessingModelAlgorithm | None [source]¶
- Return type:
Optional[QgsProcessingModelAlgorithm]
- parameterItem(self, name: str | None) QgsModelComponentGraphicItem | None [source]¶
Returns the
QgsModelComponentGraphicItem
corresponding to the specified child algorithmAdded in version 3.44.
- Parameters:
name (Optional[str])
- Return type:
Optional[QgsModelComponentGraphicItem]
- signal rebuildRequired[source]¶
Emitted when a change in the model requires a full rebuild of the scene.
- requestRebuildRequired(self)[source]¶
Requests a complete rebuild of a model by emitting the according signal
Added in version 3.44.
- signal runFromChild(childId: str)[source]¶
Emitted when the user opts to run the part of the model starting from the specified child algorithm.
Added in version 3.38.
- Parameters:
childId (str)
- signal runSelected[source]¶
Emitted when the user opts to run selected steps from the model.
Added in version 3.38.
- selectedComponentItems(self) List[QgsModelComponentGraphicItem] ¶
Returns list of selected component items.
- Return type:
- signal selectedItemChanged(selected: QgsModelComponentGraphicItem)[source]¶
Emitted whenever the selected item changes. If
None
, no item is selected.- Parameters:
selected (QgsModelComponentGraphicItem)
- setFlag(self, flag: QgsModelGraphicsScene.Flag, on: bool = True)[source]¶
Enables or disables a particular
flag
for the scene. Other existing flags are not affected.See also
See also
- Parameters:
flag (QgsModelGraphicsScene.Flag)
on (bool = True)
- setFlags(self, flags: QgsModelGraphicsScene.Flags | QgsModelGraphicsScene.Flag)[source]¶
Sets the combination of
flags
controlling how the scene is rendered and behaves.See also
See also
- Parameters:
flags (Union[QgsModelGraphicsScene.Flags, QgsModelGraphicsScene.Flag])
- setLastRunResult(self, result: QgsProcessingModelResult)[source]¶
Sets the
result
of the last run of the model through the designer window.- Parameters:
result (QgsProcessingModelResult)
- setMessageBar(self, bar: QgsMessageBar | None)[source]¶
Sets the message
bar
associated with the scene.See also
- Parameters:
bar (Optional[QgsMessageBar])
- setModel(self, model: QgsProcessingModelAlgorithm | None)[source]¶
- Parameters:
model (Optional[QgsProcessingModelAlgorithm])
- setSelectedItem(self, item: QgsModelComponentGraphicItem | None)[source]¶
Clears any selected items and sets
item
as the current selection.- Parameters:
item (Optional[QgsModelComponentGraphicItem])
- signal showChildAlgorithmLog(childId: str)[source]¶
Emitted when the user opts to view the previous log from the child algorithm with matching ID.
Added in version 3.38.
- Parameters:
childId (str)
- signal showChildAlgorithmOutputs(childId: str)[source]¶
Emitted when the user opts to view previous results from the child algorithm with matching ID.
Added in version 3.38.
- Parameters:
childId (str)
- showWarning(self, shortMessage: str | None, title: str | None, longMessage: str | None, level: Qgis.MessageLevel = Qgis.MessageLevel.Warning)[source]¶
Shows a warning message, allowing users to click a button to see the full details (
longMessage
).- Parameters:
shortMessage (Optional[str])
title (Optional[str])
longMessage (Optional[str])
level (Qgis.MessageLevel = Qgis.MessageLevel.Warning)