Class: QgsModelComponentGraphicItem¶
Base class for graphic items representing model components in the model designer.
Warning
Not stable API
Added in version 3.14.
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: fillColor(), strokeColor(), textColor(), updateStoredComponentPosition()
Class Hierarchy¶
Base classes¶
Subclasses¶
A graphic item representing a child algorithm in the model designer. |
|
A graphic item representing a model comment in the model designer. |
|
A graphic item representing a group box in the model designer. |
|
A graphic item representing a model output in the model designer. |
|
A graphic item representing a model parameter (input) in the model designer. |
- class qgis.gui.QgsModelComponentGraphicItem[source]¶
Bases:
QGraphicsObject- __init__(component: QgsProcessingModelComponent | None, model: QgsProcessingModelAlgorithm | None, parent: QGraphicsItem | None)
Constructor for QgsModelComponentGraphicItem for the specified
component, with the specifiedparentitem.The
modelargument specifies the associated processing model. Ownership ofmodelis not transferred, and it must exist for the lifetime of this object.Ownership of
componentis transferred to the item.- Parameters:
component (Optional[QgsProcessingModelComponent])
model (Optional[QgsProcessingModelAlgorithm])
parent (Optional[QGraphicsItem])
- class Flag¶
Bases:
int
- class Flags¶
- class Flags(f: QgsModelComponentGraphicItem.Flags | QgsModelComponentGraphicItem.Flag)
- class Flags(a0: QgsModelComponentGraphicItem.Flags)
Bases:
object
- Hover = 2¶
- Normal = 0¶
- Selected = 1¶
- class State¶
Bases:
int
- Unused = 1¶
- signal aboutToChange[source]¶
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.
- calculateAutomaticLinkPoint(self, other: QgsModelComponentGraphicItem | None)[source]¶
Returns the best link point to use for a link originating at a specified
otheritem.- Parameters:
other (Optional[QgsModelComponentGraphicItem]) -> (QPointF) – 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]) -> (QPointF, Qt.Edge) Returns the best link point to use for a link originating at a specified
otherpoint.- Parameters:
other – point for other end of link (in scene coordinates)
- Returns:
calculated link point in item coordinates.
edge: item edge for calculated best link point
- virtual canDeleteComponent(self) bool[source]¶
Returns
Trueif the component can be deleted.- Return type:
bool
- signal changed[source]¶
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.
- component(self) QgsProcessingModelComponent | None[source]¶
Returns the model component associated with this item.
- Return type:
Optional[QgsProcessingModelComponent]
- virtual deleteComponent(self)[source]¶
Called when the component should be deleted.
The default implementation does nothing.
- virtual editComment(self)[source]¶
Called when the comment attached to the item should be edited.
The default implementation does nothing.
- virtual editComponent(self)[source]¶
Called when the component should be edited.
The default implementation does nothing.
- abstract fillColor(self, state: QgsModelComponentGraphicItem.State) QColor[source]¶
Returns the fill color for the item for the specified
state.- Parameters:
- Return type:
QColor
- virtual flags(self) QgsModelComponentGraphicItem.Flags[source]¶
Returns item flags.
- Return type:
- font(self) QFont[source]¶
Returns the font used to render text in the item.
See also
- Return type:
QFont
- virtual iconPicture(self) QPicture[source]¶
Returns a QPicture version of the item’s icon, if available.
- Return type:
QPicture
- virtual iconPixmap(self) QPixmap[source]¶
Returns a QPixmap version of the item’s icon, if available.
- Return type:
QPixmap
- itemRect(self, storedRect: bool = False) QRectF[source]¶
Returns the rectangle representing the body of the item.
- Parameters:
storedRect (bool = False)
- Return type:
QRectF
- linkPoint(self, edge: Qt.Edge, index: int, incoming: bool) QPointF[source]¶
Returns the location of the link point with the specified
indexon the specifiededge.- Parameters:
edge (Qt.Edge)
index (int)
incoming (bool)
- Return type:
QPointF
- virtual linkPointCount(self, edge: Qt.Edge) int[source]¶
Returns the number of link points associated with the component on the specified
edge.- Parameters:
edge (Qt.Edge)
- Return type:
int
- virtual linkPointText(self, edge: Qt.Edge, index: int) str[source]¶
Returns the text to use for the link point with the specified
indexon the specifiededge.- Parameters:
edge (Qt.Edge)
index (int)
- Return type:
str
- model(self) QgsProcessingModelAlgorithm | None[source]¶
Returns the model associated with this item.
- Return type:
Optional[QgsProcessingModelAlgorithm]
- moveComponentBy(self, dx: float, dy: float)[source]¶
Moves the component by the specified
dxanddy.Warning
Call this method, not QGraphicsItem.moveBy!
- Parameters:
dx (float)
dy (float)
- outSocketAt(self, index: int) QgsModelDesignerSocketGraphicItem | None[source]¶
Returns the output socket graphics items at the specified
index.May return
Noneif no corresponding output socket exists.Added in version 3.44.
- Parameters:
index (int)
- Return type:
Optional[QgsModelDesignerSocketGraphicItem]
- previewItemMove(self, dx: float, dy: float)[source]¶
Shows a preview of moving the item from its stored position by
dx,dy.- Parameters:
dx (float)
dy (float)
- signal repaintArrows[source]¶
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.
- signal requestModelRepaint[source]¶
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.
- setFont(self, font: QFont)[source]¶
Sets the
fontused to render text in the item.See also
- Parameters:
font (QFont)
- setItemRect(self, rect: QRectF)[source]¶
Sets a new scene
rectfor the item.- Parameters:
rect (QRectF)
- setLabel(self, label: str | None)[source]¶
Returns the item’s
labeltext.See also
- Parameters:
label (Optional[str])
- signal sizePositionChanged[source]¶
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.
- state(self) QgsModelComponentGraphicItem.State[source]¶
Returns the item’s current state.
- Return type:
- abstract strokeColor(self, state: QgsModelComponentGraphicItem.State) QColor[source]¶
Returns the stroke color for the item for the specified
state.- Parameters:
- Return type:
QColor
- virtual strokeStyle(self, state: QgsModelComponentGraphicItem.State) Qt.PenStyle[source]¶
Returns the stroke style to use while rendering the outline of the item.
- Parameters:
- Return type:
Qt.PenStyle
- abstract textColor(self, state: QgsModelComponentGraphicItem.State) QColor[source]¶
Returns the label text color for the item for the specified
state.- Parameters:
- Return type:
QColor
- virtual titleAlignment(self) Qt.Alignment[source]¶
Returns the title alignment
- Return type:
Qt.Alignment
- truncatedTextForItem(self, text: str | None) str[source]¶
Truncates a
textstring so that it fits nicely within the item’s width, accounting for margins and interactive buttons.- Parameters:
text (Optional[str])
- Return type:
str
- signal updateArrowPaths[source]¶
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.
- updateButtonPositions(self)[source]¶
Updates the item’s button positions, based on the current item rect.
- abstract updateStoredComponentPosition(self, pos: QPointF | QPoint, size: QSizeF)[source]¶
Updates the position and size stored in the model for the associated comment
- Parameters:
pos (Union[QPointF, QPoint])
size (QSizeF)
- view(self) QgsModelGraphicsView | None[source]¶
Returns the associated view.
- Return type:
Optional[QgsModelGraphicsView]