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 specified parent object.

Methods

childEvent

componentItemAt

Returns the topmost component item at a specified position.

connectNotify

contextMenuEvent

createChildAlgGraphicItem

Creates a new graphic item for a model child algorithm.

createCommentGraphicItem

Creates a new graphic item for a model comment.

createGroupBoxGraphicItem

Creates a new graphic item for a model group box.

createItems

Populates the scene by creating items representing the specified model.

createOutputGraphicItem

Creates a new graphic item for a model output.

createParameterGraphicItem

Creates a new graphic item for a model parameter.

customEvent

deselectAll

Clears any selected items in the scene.

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

drawBackground

drawForeground

dropEvent

event

eventFilter

flags

Returns the current combination of flags set for the scene.

focusInEvent

focusNextPrevChild

focusOutEvent

groupBoxItem

Returns the graphic item corresponding to the specified group box uuid.

helpEvent

inputMethodEvent

isSignalConnected

keyPressEvent

keyReleaseEvent

messageBar

Returns the message bar associated with the scene.

model

rtype

QgsProcessingModelAlgorithm

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

param event

mouseReleaseEvent

receivers

selectAll

Selects all the components in the scene.

selectedComponentItems

Returns list of selected component items.

sender

senderSignalIndex

setChildAlgorithmInputs

Sets the inputs for child algorithms for the last model execution.

setChildAlgorithmResults

Sets the results for child algorithms for the last model execution.

setFlag

Enables or disables a particular flag for the scene.

setFlags

Sets the combination of flags controlling how the scene is rendered and behaves.

setMessageBar

Sets the message bar associated with the scene.

setModel

param model

setSelectedItem

Clears any selected items and sets item as the current selection.

showWarning

Shows a warning message, allowing users to click a button to see the full details (longMessage).

timerEvent

wheelEvent

Signals

componentAboutToChange

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

componentChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

rebuildRequired

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

selectedItemChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

Attributes

ArrowLink

FlagHideComments

FlagHideControls

GroupBox

ModelComponent

MouseHandles

RubberBand

ZSnapIndicator

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

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type

PYQT_SIGNAL

componentChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type

PYQT_SIGNAL

componentItemAt(self, position: Union[QPointF, QPoint]) QgsModelComponentGraphicItem

Returns the topmost component item at a specified position.

Parameters

position (Union[QPointF) –

Return type

QgsModelComponentGraphicItem

connectNotify(self, QMetaMethod)
contextMenuEvent(self, QGraphicsSceneContextMenuEvent)
createChildAlgGraphicItem(self, model: QgsProcessingModelAlgorithm, child: QgsProcessingModelChildAlgorithm) QgsModelChildAlgorithmGraphicItem

Creates a new graphic item for a model child algorithm.

Parameters
Return type

QgsModelChildAlgorithmGraphicItem

createCommentGraphicItem(self, model: QgsProcessingModelAlgorithm, comment: QgsProcessingModelComment, parentItem: QgsModelComponentGraphicItem) QgsModelComponentGraphicItem

Creates a new graphic item for a model comment.

Parameters
Return type

QgsModelComponentGraphicItem

createGroupBoxGraphicItem(self, model: QgsProcessingModelAlgorithm, box: QgsProcessingModelGroupBox) QgsModelComponentGraphicItem

Creates a new graphic item for a model group box.

Parameters
Return type

QgsModelComponentGraphicItem

createItems(self, model: QgsProcessingModelAlgorithm, context: QgsProcessingContext)

Populates the scene by creating items representing the specified model.

Parameters
createOutputGraphicItem(self, model: QgsProcessingModelAlgorithm, output: QgsProcessingModelOutput) QgsModelComponentGraphicItem

Creates a new graphic item for a model output.

Parameters
Return type

QgsModelComponentGraphicItem

createParameterGraphicItem(self, model: QgsProcessingModelAlgorithm, param: QgsProcessingModelParameter) QgsModelComponentGraphicItem

Creates a new graphic item for a model parameter.

Parameters
Return type

QgsModelComponentGraphicItem

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

setFlags()

See also

setFlag()

Return type

QgsModelGraphicsScene.Flags

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

QgsModelComponentGraphicItem

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

setMessageBar()

Return type

QgsMessageBar

model(self) QgsProcessingModelAlgorithm
Return type

QgsProcessingModelAlgorithm

mouseDoubleClickEvent(self, QGraphicsSceneMouseEvent)
mouseMoveEvent(self, QGraphicsSceneMouseEvent)
mousePressEvent(self, event: QGraphicsSceneMouseEvent)
Parameters

event (QGraphicsSceneMouseEvent) –

mouseReleaseEvent(self, QGraphicsSceneMouseEvent)
rebuildRequired

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type

PYQT_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

List[QgsModelComponentGraphicItem]

selectedItemChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type

PYQT_SIGNAL

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

setFlags()

See also

flags()

Parameters
setFlags(self, flags: Union[QgsModelGraphicsScene.Flags, QgsModelGraphicsScene.Flag])

Sets the combination of flags controlling how the scene is rendered and behaves.

See also

setFlag()

See also

flags()

Parameters

flags (Union[QgsModelGraphicsScene.Flags) –

setMessageBar(self, bar: QgsMessageBar)

Sets the message bar associated with the scene.

See also

messageBar()

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)