Class: QgsModelGraphicsView

QGraphicsView subclass representing the model designer.

Warning

Not stable API

Added in version 3.14.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsModelGraphicsView

Base classes

QGraphicsView

QAbstractScrollArea

QFrame

QWidget

QObject

QPaintDevice

Methods

copyItems

Cuts or copies the a list of items, respecting the specified operation.

copySelectedItems

Cuts or copies the selected items, respecting the specified operation.

endMacroCommand

Ends a macro command, containing a group of interactions in the view.

modelScene

Returns the scene associated with the tool.

pasteItems

Pastes items from clipboard, using the specified mode.

setModelScene

Sets the related scene.

snapSelected

Snaps the selected items to the grid.

startMacroCommand

Starts a macro command, containing a group of interactions in the view.

Signals

algorithmDropped

Emitted when an algorithm is dropped onto the view.

beginCommand

Emitted when an undo command is started in the view.

deleteSelectedItems

Emitted when the selected items should be deleted;

endCommand

Emitted when an undo command in the view has ended.

inputDropped

Emitted when an input parameter is dropped onto the view.

itemFocused

Emitted when an item is "focused" in the view, i.e. it becomes the active item and should have its properties displayed in any designer windows.

macroCommandEnded

Emitted when a macro command containing a group of interactions in the view has ended.

macroCommandStarted

Emitted when a macro command containing a group of interactions is started in the view.

willBeDeleted

Emitted in the destructor when the view is about to be deleted, but is still in a perfectly valid state.

Attributes

ClipboardCopy

ClipboardCut

PasteModeCenter

PasteModeCursor

PasteModeInPlace

class qgis.gui.QgsModelGraphicsView[source]

Bases: QGraphicsView

__init__(parent: QWidget | None = None)

Constructor for QgsModelGraphicsView, with the specified parent widget.

Parameters:

parent (Optional[QWidget] = None)

ClipboardCopy = 1
ClipboardCut = 0
class ClipboardOperation

Bases: int

class PasteMode

Bases: int

PasteModeCenter = 1
PasteModeCursor = 0
PasteModeInPlace = 2
signal algorithmDropped(algorithmId: str, pos: QPointF)[source]

Emitted when an algorithm is dropped onto the view.

Parameters:
  • algorithmId (str)

  • pos (QPointF)

signal beginCommand(text: str)[source]

Emitted when an undo command is started in the view.

Parameters:

text (str)

copyItems(self, items: Iterable[QgsModelComponentGraphicItem], operation: QgsModelGraphicsView.ClipboardOperation)[source]

Cuts or copies the a list of items, respecting the specified operation.

See also

pasteItems()

Parameters:
copySelectedItems(self, operation: QgsModelGraphicsView.ClipboardOperation)[source]

Cuts or copies the selected items, respecting the specified operation.

See also

copyItems()

See also

pasteItems()

Parameters:

operation (QgsModelGraphicsView.ClipboardOperation)

signal deleteSelectedItems[source]

Emitted when the selected items should be deleted;

signal endCommand[source]

Emitted when an undo command in the view has ended.

endMacroCommand(self)[source]

Ends a macro command, containing a group of interactions in the view.

signal inputDropped(inputId: str, pos: QPointF)[source]

Emitted when an input parameter is dropped onto the view.

Parameters:
  • inputId (str)

  • pos (QPointF)

signal itemFocused(item: QgsModelComponentGraphicItem)[source]

Emitted when an item is “focused” in the view, i.e. it becomes the active item and should have its properties displayed in any designer windows.

Parameters:

item (QgsModelComponentGraphicItem)

signal macroCommandEnded[source]

Emitted when a macro command containing a group of interactions in the view has ended.

signal macroCommandStarted(text: str)[source]

Emitted when a macro command containing a group of interactions is started in the view.

Parameters:

text (str)

modelScene(self) QgsModelGraphicsScene | None[source]

Returns the scene associated with the tool.

See also

view()

Return type:

Optional[QgsModelGraphicsScene]

pasteItems(self, mode: QgsModelGraphicsView.PasteMode)[source]

Pastes items from clipboard, using the specified mode.

See also

hasItemsInClipboard()

Parameters:

mode (QgsModelGraphicsView.PasteMode)

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

Sets the related scene.

Parameters:

scene (Optional[QgsModelGraphicsScene])

snapSelected(self)[source]

Snaps the selected items to the grid.

startMacroCommand(self, text: str | None)[source]

Starts a macro command, containing a group of interactions in the view.

Parameters:

text (Optional[str])

signal willBeDeleted[source]

Emitted in the destructor when the view is about to be deleted, but is still in a perfectly valid state.