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
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. |
|
Returns item flags. |
|
Returns the item group ID, if set. |
|
Returns |
|
Called when a newly created item of the associated type has been added to a layout. |
|
Returns the unique item type code for the layout item class. |
|
Returns a translated, user visible name identifying the corresponding layout item. |
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.visibleNameshould be set to a translated, user visible name identifying the corresponding layout item.An optional
groupIdcan be set, which allows grouping of related layout item classes. SeeQgsLayoutItemGuiMetadatafor details.If
isNodeBasedisTrue, 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
- createItem(self, layout: QgsLayout | None) QgsLayoutItem | None[source]¶
Creates an instance of the corresponding item type.
- Parameters:
layout (Optional[QgsLayout])
- Return type:
Optional[QgsLayoutItem]
- createItemWidget(self, item: QgsLayoutItem | None) QgsLayoutItemBaseWidget | None[source]¶
Creates a configuration widget for an
itemof this type. Can returnNoneif no configuration GUI is required.- Parameters:
item (Optional[QgsLayoutItem])
- Return type:
Optional[QgsLayoutItemBaseWidget]
- createNodeRubberBand(self, view: QgsLayoutView | None) QAbstractGraphicsShapeItem | None[source]¶
Creates a rubber band for use when creating layout node based items of this type. Can return
Noneif no rubber band should be created. The default behavior is to returnNone.See also
- Parameters:
view (Optional[QgsLayoutView])
- Return type:
Optional[QAbstractGraphicsShapeItem]
- createRubberBand(self, view: QgsLayoutView | None) QgsLayoutViewRubberBand | None[source]¶
Creates a rubber band for use when creating layout items of this type. Can return
Noneif 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]
- 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:
- isNodeBased(self) bool[source]¶
Returns
Trueif the associated item is a node based item.- Return type:
bool
- 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])