Class: QgsModelComponentGraphicItem¶
- class qgis.gui.QgsModelComponentGraphicItem¶
Bases:
PyQt5.QtWidgets.QGraphicsObject
Base class for graphic items representing model components in the model designer.
Warning
Not stable API
New in version 3.14.
QgsModelComponentGraphicItem(component:
QgsProcessingModelComponent
, model:QgsProcessingModelAlgorithm
, parent: QGraphicsItem) Constructor forQgsModelComponentGraphicItem
for the specifiedcomponent
, with the specifiedparent
item.The
model
argument specifies the associated processing model. Ownership ofmodel
is not transferred, and it must exist for the lifetime of this object.Ownership of
component
is transferred to the item.Methods
- rtype:
QRectF
Returns the best link point to use for a link originating at a specified
other
item.Returns
True
if the component can be deleted.Returns the model component associated with this item.
- param point:
Called when the component should be deleted.
Called when the comment attached to the item should be edited.
Called when the component should be edited.
Returns the fill color for the item for the specified
state
.Returns item flags.
Returns the font used to render text in the item.
- param event:
- param event:
- param event:
Returns a QPicture version of the item's icon, if available.
Returns a QPixmap version of the item's icon, if available.
- param change:
Returns the rectangle representing the body of the item.
Returns the item's label text.
Returns the location of the link point with the specified
index
on the specifiededge
.Returns the number of link points associated with the component on the specified
edge
.Returns the text to use for the link point with the specified
index
on the specifiededge
.Returns the model associated with this item.
- param event:
Moves the component by the specified
dx
anddy
.- param painter:
Shows a preview of moving the item from its stored position by
dx
,dy
.Sets the
font
used to render text in the item.Sets a new scene
rect
for the item.Returns the item's
label
text.Returns the item's current state.
Returns the stroke color for the item for the specified
state
.Returns the stroke style to use while rendering the outline of the item.
Returns the label text color for the item for the specified
state
.Returns the title alignment
Truncates a
text
string so that it fits nicely within the item's width, accounting for margins and interactive buttons.Updates the item's button positions, based on the current item rect.
Updates the position and size stored in the model for the associated comment
Returns the associated view.
Signals
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
Attributes
- class Flag¶
Bases:
int
- class Flags¶
- class Flags(Union[QgsModelComponentGraphicItem.Flags, QgsModelComponentGraphicItem.Flag])
- class Flags(QgsModelComponentGraphicItem.Flags)
Bases:
sip.wrapper
- Hover = 2¶
- Normal = 0¶
- Selected = 1¶
- class State¶
Bases:
int
- Unused = 1¶
- aboutToChange¶
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
- boundingRect(self) QRectF ¶
- Return type:
QRectF
- calculateAutomaticLinkPoint(self, other: QgsModelComponentGraphicItem) Tuple[QPointF, Qt.Edge] ¶
Returns the best link point to use for a link originating at a specified
other
item.- Parameters:
other (QgsModelComponentGraphicItem) – item at other end of link
- Returns:
calculated link point in item coordinates.
edge: item edge for calculated best link point
calculateAutomaticLinkPoint(self, point: Union[QPointF, QPoint]) -> Tuple[QPointF, Qt.Edge] Returns the best link point to use for a link originating at a specified
other
point.- Parameters:
other – point for other end of link (in scene coordinates)
- Return type:
Tuple[QPointF, Qt.Edge]
- Returns:
calculated link point in item coordinates.
edge: item edge for calculated best link point
- canDeleteComponent(self) bool ¶
Returns
True
if the component can be deleted.- Return type:
bool
- changed¶
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
- childEvent(self, QChildEvent)¶
- component(self) QgsProcessingModelComponent ¶
Returns the model component associated with this item.
- Return type:
- connectNotify(self, QMetaMethod)¶
- contains(self, point: QPointF | QPoint) bool ¶
- Parameters:
point (Union[QPointF) –
- Return type:
bool
- contextMenuEvent(self, QGraphicsSceneContextMenuEvent)¶
- customEvent(self, QEvent)¶
- deleteComponent(self)¶
Called when the component should be deleted.
The default implementation does nothing.
- disconnectNotify(self, QMetaMethod)¶
- dragEnterEvent(self, QGraphicsSceneDragDropEvent)¶
- dragLeaveEvent(self, QGraphicsSceneDragDropEvent)¶
- dragMoveEvent(self, QGraphicsSceneDragDropEvent)¶
- dropEvent(self, QGraphicsSceneDragDropEvent)¶
- editComment(self)¶
Called when the comment attached to the item should be edited.
The default implementation does nothing.
- editComponent(self)¶
Called when the component should be edited.
The default implementation does nothing.
- event(self, QEvent) bool ¶
- fillColor(self, state: QgsModelComponentGraphicItem.State) QColor ¶
Returns the fill color for the item for the specified
state
.- Parameters:
state (QgsModelComponentGraphicItem.State) –
- Return type:
QColor
- flags(self) QgsModelComponentGraphicItem.Flags ¶
Returns item flags.
- Return type:
- focusInEvent(self, QFocusEvent)¶
- focusOutEvent(self, QFocusEvent)¶
- font(self) QFont ¶
Returns the font used to render text in the item.
See also
- Return type:
QFont
- hoverEnterEvent(self, event: QGraphicsSceneHoverEvent)¶
- Parameters:
event (QGraphicsSceneHoverEvent) –
- hoverLeaveEvent(self, event: QGraphicsSceneHoverEvent)¶
- Parameters:
event (QGraphicsSceneHoverEvent) –
- hoverMoveEvent(self, event: QGraphicsSceneHoverEvent)¶
- Parameters:
event (QGraphicsSceneHoverEvent) –
- iconPicture(self) QPicture ¶
Returns a QPicture version of the item’s icon, if available.
- Return type:
QPicture
- iconPixmap(self) QPixmap ¶
Returns a QPixmap version of the item’s icon, if available.
- Return type:
QPixmap
- inputMethodEvent(self, QInputMethodEvent)¶
- inputMethodQuery(self, Qt.InputMethodQuery) Any ¶
- isSignalConnected(self, QMetaMethod) bool ¶
- itemChange(self, change: QGraphicsItem.GraphicsItemChange, value: Any) Any ¶
- Parameters:
change (QGraphicsItem.GraphicsItemChange) –
value (Any) –
- Return type:
Any
- itemRect(self, storedRect: bool = False) QRectF ¶
Returns the rectangle representing the body of the item.
- Parameters:
storedRect (bool = False) –
- Return type:
QRectF
- keyPressEvent(self, QKeyEvent)¶
- keyReleaseEvent(self, QKeyEvent)¶
- label(self) str ¶
Returns the item’s label text.
See also
- Return type:
str
- linkPoint(self, edge: Qt.Edge, index: int, incoming: bool) QPointF ¶
Returns the location of the link point with the specified
index
on the specifiededge
.- Parameters:
edge (Qt.Edge) –
index (int) –
incoming (bool) –
- Return type:
QPointF
- linkPointCount(self, edge: Qt.Edge) int ¶
Returns the number of link points associated with the component on the specified
edge
.- Parameters:
edge (Qt.Edge) –
- Return type:
int
- linkPointText(self, edge: Qt.Edge, index: int) str ¶
Returns the text to use for the link point with the specified
index
on the specifiededge
.- Parameters:
edge (Qt.Edge) –
index (int) –
- Return type:
str
- model(self) QgsProcessingModelAlgorithm ¶
Returns the model associated with this item.
- Return type:
- mouseDoubleClickEvent(self, event: QGraphicsSceneMouseEvent)¶
- Parameters:
event (QGraphicsSceneMouseEvent) –
- mouseMoveEvent(self, QGraphicsSceneMouseEvent)¶
- mousePressEvent(self, QGraphicsSceneMouseEvent)¶
- mouseReleaseEvent(self, QGraphicsSceneMouseEvent)¶
- moveComponentBy(self, dx: float, dy: float)¶
Moves the component by the specified
dx
anddy
.Warning
Call this method, not QGraphicsItem.moveBy!
- Parameters:
dx (float) –
dy (float) –
- paint(self, painter: QPainter, option: QStyleOptionGraphicsItem, widget: QWidget = None)¶
- Parameters:
painter (QPainter) –
option (QStyleOptionGraphicsItem) –
widget (QWidget = None) –
- prepareGeometryChange(self)¶
- previewItemMove(self, dx: float, dy: float)¶
Shows a preview of moving the item from its stored position by
dx
,dy
.- Parameters:
dx (float) –
dy (float) –
- receivers(self, PYQT_SIGNAL) int ¶
- repaintArrows¶
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
- requestModelRepaint¶
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
- sceneEvent(self, QEvent) bool ¶
- sceneEventFilter(self, QGraphicsItem, QEvent) bool ¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setFont(self, font: QFont)¶
Sets the
font
used to render text in the item.See also
- Parameters:
font (QFont) –
- setItemRect(self, rect: QRectF)¶
Sets a new scene
rect
for the item.- Parameters:
rect (QRectF) –
- setLabel(self, label: str)¶
Returns the item’s
label
text.See also
- Parameters:
label (str) –
- sizePositionChanged¶
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
- state(self) QgsModelComponentGraphicItem.State ¶
Returns the item’s current state.
- Return type:
- strokeColor(self, state: QgsModelComponentGraphicItem.State) QColor ¶
Returns the stroke color for the item for the specified
state
.- Parameters:
state (QgsModelComponentGraphicItem.State) –
- Return type:
QColor
- strokeStyle(self, state: QgsModelComponentGraphicItem.State) Qt.PenStyle ¶
Returns the stroke style to use while rendering the outline of the item.
- Parameters:
state (QgsModelComponentGraphicItem.State) –
- Return type:
Qt.PenStyle
- textColor(self, state: QgsModelComponentGraphicItem.State) QColor ¶
Returns the label text color for the item for the specified
state
.- Parameters:
state (QgsModelComponentGraphicItem.State) –
- Return type:
QColor
- timerEvent(self, QTimerEvent)¶
- titleAlignment(self) Qt.Alignment ¶
Returns the title alignment
- Return type:
Qt.Alignment
- truncatedTextForItem(self, text: str) str ¶
Truncates a
text
string so that it fits nicely within the item’s width, accounting for margins and interactive buttons.- Parameters:
text (str) –
- Return type:
str
- updateArrowPaths¶
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
- updateButtonPositions(self)¶
Updates the item’s button positions, based on the current item rect.
- updateMicroFocus(self)¶
- updateStoredComponentPosition(self, pos: QPointF | QPoint, size: QSizeF)¶
Updates the position and size stored in the model for the associated comment
- Parameters:
pos (Union[QPointF) –
size (QSizeF) –
- view(self) QgsModelGraphicsView ¶
Returns the associated view.
- Return type:
- wheelEvent(self, QGraphicsSceneWheelEvent)¶