Class: QgsLayoutItemAbstractGuiMetadata¶
Stores GUI metadata about one layout item class.
This is a companion to QgsLayoutItemAbstractMetadata
,
storing only the components related to the GUI behavior of a layout
item.
Note
In C++ you can use QgsLayoutItemGuiMetadata
convenience class.
Methods
Returns item flags. |
|
Returns the item group ID, if set. |
|
Returns |
|
Returns the unique item type code for the layout item class. |
|
Returns a translated, user visible name identifying the corresponding layout item. |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of QgsLayoutItemAbstractGuiMetadata. See the FAQ for more details.
Creates an instance of the corresponding item type. |
|
Creates a configuration widget for an item of this type. |
|
Creates a rubber band for use when creating layout node based items of this type. |
|
Creates a rubber band for use when creating layout items of this type. |
|
Returns an icon representing creation of the layout item type. |
|
Called when a layout item is double-clicked. |
|
Called when a newly created item of the associated type has been added to a layout. |
Attributes
- class qgis.gui.QgsLayoutItemAbstractGuiMetadata[source]¶
Bases:
object
- __init__(type: int, visibleName: str | None, groupId: str | None = '', isNodeBased: bool = False, flags: QgsLayoutItemAbstractGuiMetadata.Flags | QgsLayoutItemAbstractGuiMetadata.Flag = QgsLayoutItemAbstractGuiMetadata.Flags())
Constructor for QgsLayoutItemAbstractGuiMetadata with the specified class
type
.visibleName
should be set to a translated, user visible name identifying the corresponding layout item.An optional
groupId
can be set, which allows grouping of related layout item classes. SeeQgsLayoutItemGuiMetadata
for details.If
isNodeBased
isTrue
, then the corresponding item is a node based item.- Parameters:
type (int)
visibleName (Optional[str])
groupId (Optional[str] = '')
isNodeBased (bool = False)
flags (Union[QgsLayoutItemAbstractGuiMetadata.Flags, QgsLayoutItemAbstractGuiMetadata.Flag] = QgsLayoutItemAbstractGuiMetadata.Flags())
- __init__(a0: QgsLayoutItemAbstractGuiMetadata)
- Parameters:
- class Flag¶
Bases:
int
- FlagNoCreationTools = 2¶
- class Flags¶
- class Flags(f: QgsLayoutItemAbstractGuiMetadata.Flags | QgsLayoutItemAbstractGuiMetadata.Flag)
- class Flags(a0: QgsLayoutItemAbstractGuiMetadata.Flags)
Bases:
object
- virtual createItem(self, layout: QgsLayout | None) QgsLayoutItem | None [source]¶
Creates an instance of the corresponding item type.
- Parameters:
layout (Optional[QgsLayout])
- Return type:
Optional[QgsLayoutItem]
- virtual createItemWidget(self, item: QgsLayoutItem | None) QgsLayoutItemBaseWidget | None [source]¶
Creates a configuration widget for an
item
of this type. Can returnNone
if no configuration GUI is required.- Parameters:
item (Optional[QgsLayoutItem])
- Return type:
Optional[QgsLayoutItemBaseWidget]
- virtual createNodeRubberBand(self, view: QgsLayoutView | None) QGraphicsItem | None [source]¶
Creates a rubber band for use when creating layout node based items of this type. Can return
None
if no rubber band should be created. The default behavior is to returnNone
.See also
- Parameters:
view (Optional[QgsLayoutView])
- Return type:
Optional[QGraphicsItem]
- virtual createRubberBand(self, view: QgsLayoutView | None) QgsLayoutViewRubberBand | None [source]¶
Creates a rubber band for use when creating layout items of this type. Can return
None
if no rubber band should be created. The default behavior is to create a rectangular rubber band.See also
- Parameters:
view (Optional[QgsLayoutView])
- Return type:
Optional[QgsLayoutViewRubberBand]
- virtual creationIcon(self) QIcon [source]¶
Returns an icon representing creation of the layout item type.
- Return type:
QIcon
- flags(self) QgsLayoutItemAbstractGuiMetadata.Flags [source]¶
Returns item flags.
- Return type:
- virtual handleDoubleClick(self, item: QgsLayoutItem | None, action: Qgis.MouseHandlesAction)[source]¶
Called when a layout item is double-clicked. The action parameter is used to specify which mouse handle, if any, was clicked If no mouse handle is selected,
Qgis
.MouseHandlesAction.NoAction is usedAdded in version 3.42.
- Parameters:
item (Optional[QgsLayoutItem])
action (Qgis.MouseHandlesAction)
- isNodeBased(self) bool [source]¶
Returns
True
if the associated item is a node based item.- Return type:
bool
- virtual newItemAddedToLayout(self, item: QgsLayoutItem | None)[source]¶
Called when a newly created item of the associated type has been added to a layout.
This is only called for additions which result from GUI operations - i.e. it is not called for items added from templates.
- Parameters:
item (Optional[QgsLayoutItem])