Class: QgsModelGraphicsView

class qgis.gui.QgsModelGraphicsView

Bases: PyQt5.QtWidgets.QGraphicsView

QGraphicsView subclass representing the model designer.

Warning

Not stable API

New in version 3.14.

QgsModelGraphicsView(parent: QWidget = None) Constructor for QgsModelGraphicsView, with the specified parent widget.

Methods

actionEvent

changeEvent

childEvent

closeEvent

connectNotify

contextMenuEvent

copyItems

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

copySelectedItems

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

create

customEvent

destroy

disconnectNotify

dragEnterEvent

param event

dragLeaveEvent

dragMoveEvent

param event

drawBackground

drawForeground

drawFrame

dropEvent

param event

endMacroCommand

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

enterEvent

event

eventFilter

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

initPainter

initStyleOption

inputMethodEvent

isSignalConnected

keyPressEvent

param event

keyReleaseEvent

param event

leaveEvent

metric

modelScene

Returns the scene associated with the tool.

mouseDoubleClickEvent

param event

mouseMoveEvent

param event

mousePressEvent

param event

mouseReleaseEvent

param event

moveEvent

nativeEvent

paintEvent

pasteItems

Pastes items from clipboard, using the specified mode.

receivers

resizeEvent

scrollContentsBy

sender

senderSignalIndex

setModelScene

Sets the related scene.

setViewportMargins

setViewportMargins(self, QMargins)

setupViewport

sharedPainter

showEvent

snapSelected

Snaps the selected items to the grid.

startMacroCommand

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

tabletEvent

timerEvent

updateMicroFocus

viewportEvent

viewportMargins

viewportSizeHint

wheelEvent

param event

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; [signal]

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

ClipboardCopy = 1
ClipboardCut = 0
class ClipboardOperation

Bases: int

class PasteMode

Bases: int

PasteModeCenter = 1
PasteModeCursor = 0
PasteModeInPlace = 2
actionEvent(self, QActionEvent)
algorithmDropped

Emitted when an algorithm is dropped onto the view. [signal]

Parameters
  • algorithmId (str) –

  • pos (Union[QPointF) –

beginCommand

Emitted when an undo command is started in the view. [signal]

Parameters

text (str) –

changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
copyItems(self, items: Iterable[QgsModelComponentGraphicItem], operation: QgsModelGraphicsView.ClipboardOperation)

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

See also

pasteItems()

Parameters
copySelectedItems(self, operation: QgsModelGraphicsView.ClipboardOperation)

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

See also

copyItems()

See also

pasteItems()

Parameters

operation (QgsModelGraphicsView.ClipboardOperation) –

create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
customEvent(self, QEvent)
deleteSelectedItems

Emitted when the selected items should be deleted; [signal]

destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, event: QDragEnterEvent)
Parameters

event (QDragEnterEvent) –

dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, event: QDragMoveEvent)
Parameters

event (QDragMoveEvent) –

drawBackground(self, QPainter, QRectF)
drawForeground(self, QPainter, QRectF)
drawFrame(self, QPainter)
dropEvent(self, event: QDropEvent)
Parameters

event (QDropEvent) –

endCommand

Emitted when an undo command in the view has ended. [signal]

endMacroCommand(self)

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

enterEvent(self, QEvent)
event(self, QEvent)bool
eventFilter(self, QObject, QEvent)bool
focusInEvent(self, QFocusEvent)
focusNextChild(self)bool
focusNextPrevChild(self, bool)bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self)bool
hideEvent(self, QHideEvent)
initPainter(self, QPainter)
initStyleOption(self, QStyleOptionFrame)
inputDropped

Emitted when an input parameter is dropped onto the view. [signal]

Parameters
  • inputId (str) –

  • pos (Union[QPointF) –

inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod)bool
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. [signal]

Parameters

item (QgsModelComponentGraphicItem) –

keyPressEvent(self, event: QKeyEvent)
Parameters

event (QKeyEvent) –

keyReleaseEvent(self, event: QKeyEvent)
Parameters

event (QKeyEvent) –

leaveEvent(self, QEvent)
macroCommandEnded

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

macroCommandStarted

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

Parameters

text (str) –

metric(self, QPaintDevice.PaintDeviceMetric)int
modelScene(self)QgsModelGraphicsScene

Returns the scene associated with the tool.

See also

view()

Return type

QgsModelGraphicsScene

mouseDoubleClickEvent(self, event: QMouseEvent)
Parameters

event (QMouseEvent) –

mouseMoveEvent(self, event: QMouseEvent)
Parameters

event (QMouseEvent) –

mousePressEvent(self, event: QMouseEvent)
Parameters

event (QMouseEvent) –

mouseReleaseEvent(self, event: QMouseEvent)
Parameters

event (QMouseEvent) –

moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr)Tuple[bool, int]
paintEvent(self, QPaintEvent)
pasteItems(self, mode: QgsModelGraphicsView.PasteMode)

Pastes items from clipboard, using the specified mode.

See also

hasItemsInClipboard()

Parameters

mode (QgsModelGraphicsView.PasteMode) –

receivers(self, PYQT_SIGNAL)int
resizeEvent(self, QResizeEvent)
QgsModelGraphicsView.scrollContentsBy(self, int, int)
sender(self)QObject
senderSignalIndex(self)int
setModelScene(self, scene: QgsModelGraphicsScene)

Sets the related scene.

Parameters

scene (QgsModelGraphicsScene) –

QgsModelGraphicsView.setViewportMargins(self, int, int, int, int)

setViewportMargins(self, QMargins)

setupViewport(self, QWidget)
sharedPainter(self)QPainter
showEvent(self, QShowEvent)
snapSelected(self)

Snaps the selected items to the grid.

startMacroCommand(self, text: str)

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

Parameters

text (str) –

tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
updateMicroFocus(self)
viewportEvent(self, QEvent)bool
viewportMargins(self)QMargins
viewportSizeHint(self)QSize
wheelEvent(self, event: QWheelEvent)
Parameters

event (QWheelEvent) –

willBeDeleted

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