Class: QgsModelGraphicsScene¶
- class qgis.gui.QgsModelGraphicsScene¶
Bases:
PyQt5.QtWidgets.QGraphicsScene
QGraphicsScene subclass representing the model designer.
Warning
Not stable API
New in version 3.14.
QgsModelGraphicsScene(parent: QObject = None) Constructor for
QgsModelGraphicsScene
with the specifiedparent
object.Methods
Returns the topmost component item at a specified
position
.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 group box.
Populates the scene by creating items representing the specified
model
.Creates a new graphic item for a model output.
Creates a new graphic item for a model parameter.
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.
- rtype
QgsProcessingModelAlgorithm
- param event
Selects all the components in the scene.
Returns list of selected component items.
Sets the inputs for child algorithms for the last model execution.
Sets the results for child algorithms for the last model execution.
Enables or disables a particular
flag
for the scene.Sets the combination of
flags
controlling how the scene is rendered and behaves.Sets the message
bar
associated with the scene.- param model
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
).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 whenever the selected item changes.
Attributes
- ArrowLink = 1¶
- class Flag¶
Bases:
int
- FlagHideComments = 4¶
- FlagHideControls = 2¶
- class Flags¶
- class Flags(Union[QgsModelGraphicsScene.Flags, QgsModelGraphicsScene.Flag])
- class Flags(QgsModelGraphicsScene.Flags)
Bases:
sip.wrapper
- GroupBox = 0¶
- ModelComponent = 2¶
- MouseHandles = 99¶
- RubberBand = 100¶
- ZSnapIndicator = 101¶
- class ZValues¶
Bases:
int
- childEvent(self, QChildEvent)¶
- componentAboutToChange¶
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. [signal]- Parameters
text (str) –
id (int = 0) –
- componentChanged¶
Emitted whenever a component of the model is changed. [signal]
- componentItemAt(self, position: Union[QPointF, QPoint]) QgsModelComponentGraphicItem ¶
Returns the topmost component item at a specified
position
.- Parameters
position (Union[QPointF) –
- Return type
- connectNotify(self, QMetaMethod)¶
- contextMenuEvent(self, QGraphicsSceneContextMenuEvent)¶
- createChildAlgGraphicItem(self, model: QgsProcessingModelAlgorithm, child: QgsProcessingModelChildAlgorithm) QgsModelChildAlgorithmGraphicItem ¶
Creates a new graphic item for a model child algorithm.
- Parameters
model (QgsProcessingModelAlgorithm) –
child (QgsProcessingModelChildAlgorithm) –
- Return type
- createCommentGraphicItem(self, model: QgsProcessingModelAlgorithm, comment: QgsProcessingModelComment, parentItem: QgsModelComponentGraphicItem) QgsModelComponentGraphicItem ¶
Creates a new graphic item for a model comment.
- Parameters
model (QgsProcessingModelAlgorithm) –
comment (QgsProcessingModelComment) –
parentItem (QgsModelComponentGraphicItem) –
- Return type
- createGroupBoxGraphicItem(self, model: QgsProcessingModelAlgorithm, box: QgsProcessingModelGroupBox) QgsModelComponentGraphicItem ¶
Creates a new graphic item for a model group box.
- Parameters
model (QgsProcessingModelAlgorithm) –
box (QgsProcessingModelGroupBox) –
- Return type
- createItems(self, model: QgsProcessingModelAlgorithm, context: QgsProcessingContext)¶
Populates the scene by creating items representing the specified
model
.- Parameters
model (QgsProcessingModelAlgorithm) –
context (QgsProcessingContext) –
- createOutputGraphicItem(self, model: QgsProcessingModelAlgorithm, output: QgsProcessingModelOutput) QgsModelComponentGraphicItem ¶
Creates a new graphic item for a model output.
- Parameters
model (QgsProcessingModelAlgorithm) –
output (QgsProcessingModelOutput) –
- Return type
- createParameterGraphicItem(self, model: QgsProcessingModelAlgorithm, param: QgsProcessingModelParameter) QgsModelComponentGraphicItem ¶
Creates a new graphic item for a model parameter.
- Parameters
model (QgsProcessingModelAlgorithm) –
param (QgsProcessingModelParameter) –
- Return type
- customEvent(self, QEvent)¶
- deselectAll(self)¶
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.
- disconnectNotify(self, QMetaMethod)¶
- dragEnterEvent(self, QGraphicsSceneDragDropEvent)¶
- dragLeaveEvent(self, QGraphicsSceneDragDropEvent)¶
- dragMoveEvent(self, QGraphicsSceneDragDropEvent)¶
- drawBackground(self, QPainter, QRectF)¶
- drawForeground(self, QPainter, QRectF)¶
- dropEvent(self, QGraphicsSceneDragDropEvent)¶
- event(self, QEvent) bool ¶
- eventFilter(self, QObject, QEvent) bool ¶
- flags(self) QgsModelGraphicsScene.Flags ¶
Returns the current combination of flags set for the scene.
See also
See also
- Return type
- focusInEvent(self, QFocusEvent)¶
- focusNextPrevChild(self, bool) bool ¶
- focusOutEvent(self, QFocusEvent)¶
- groupBoxItem(self, uuid: str) QgsModelComponentGraphicItem ¶
Returns the graphic item corresponding to the specified group box
uuid
.- Parameters
uuid (str) –
- Return type
- helpEvent(self, QGraphicsSceneHelpEvent)¶
- inputMethodEvent(self, QInputMethodEvent)¶
- isSignalConnected(self, QMetaMethod) bool ¶
- keyPressEvent(self, QKeyEvent)¶
- keyReleaseEvent(self, QKeyEvent)¶
- messageBar(self) QgsMessageBar ¶
Returns the message bar associated with the scene.
See also
- Return type
- model(self) QgsProcessingModelAlgorithm ¶
- Return type
- mouseDoubleClickEvent(self, QGraphicsSceneMouseEvent)¶
- mouseMoveEvent(self, QGraphicsSceneMouseEvent)¶
- mousePressEvent(self, event: QGraphicsSceneMouseEvent)¶
- Parameters
event (QGraphicsSceneMouseEvent) –
- mouseReleaseEvent(self, QGraphicsSceneMouseEvent)¶
- rebuildRequired¶
Emitted when a change in the model requires a full rebuild of the scene. [signal]
- receivers(self, PYQT_SIGNAL) int ¶
- selectAll(self)¶
Selects all the components in the scene.
- selectedComponentItems(self) List[QgsModelComponentGraphicItem] ¶
Returns list of selected component items.
- Return type
- selectedItemChanged¶
Emitted whenever the selected item changes. If
None
, no item is selected. [signal]- Parameters
selected (QgsModelComponentGraphicItem) –
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setChildAlgorithmInputs(self, inputs: Dict[str, Any])¶
Sets the inputs for child algorithms for the last model execution.
- Parameters
inputs (Dict[str) –
- setChildAlgorithmResults(self, results: Dict[str, Any])¶
Sets the results for child algorithms for the last model execution.
- Parameters
results (Dict[str) –
- setFlag(self, flag: QgsModelGraphicsScene.Flag, on: bool = True)¶
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: Union[QgsModelGraphicsScene.Flags, QgsModelGraphicsScene.Flag])¶
Sets the combination of
flags
controlling how the scene is rendered and behaves.See also
See also
- Parameters
flags (Union[QgsModelGraphicsScene.Flags) –
- setMessageBar(self, bar: QgsMessageBar)¶
Sets the message
bar
associated with the scene.See also
- Parameters
bar (QgsMessageBar) –
- setModel(self, model: QgsProcessingModelAlgorithm)¶
- Parameters
model (QgsProcessingModelAlgorithm) –
- setSelectedItem(self, item: QgsModelComponentGraphicItem)¶
Clears any selected items and sets
item
as the current selection.- Parameters
item (QgsModelComponentGraphicItem) –
- showWarning(self, shortMessage: str, title: str, longMessage: str, level: Qgis.MessageLevel = Qgis.MessageLevel.Warning)¶
Shows a warning message, allowing users to click a button to see the full details (
longMessage
).- Parameters
shortMessage (str) –
title (str) –
longMessage (str) –
level (Qgis.MessageLevel = Qgis.MessageLevel.Warning) –
- timerEvent(self, QTimerEvent)¶
- wheelEvent(self, QGraphicsSceneWheelEvent)¶