Class: QgsLayoutItemAbstractGuiMetadata

class qgis.gui.QgsLayoutItemAbstractGuiMetadata(type: int, visibleName: str, groupId: str = '', isNodeBased: bool = False, flags: Union[QgsLayoutItemAbstractGuiMetadata.Flags, QgsLayoutItemAbstractGuiMetadata.Flag] = 0)

Bases: sip.wrapper

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. See QgsLayoutItemGuiMetadata for details.

If isNodeBased is True, then the corresponding item is a node based item.

QgsLayoutItemAbstractGuiMetadata(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.

New in version 3.0: Enums

Methods

createItem Creates an instance of the corresponding item type.
createItemWidget Creates a configuration widget for an item of this type.
createNodeRubberBand Creates a rubber band for use when creating layout node based items of this type.
createRubberBand Creates a rubber band for use when creating layout items of this type.
creationIcon Returns an icon representing creation of the layout item type.
flags Returns item flags.
groupId Returns the item group ID, if set.
isNodeBased Returns True if the associated item is a node based item.
newItemAddedToLayout Called when a newly created item of the associated type has been added to a layout.
type Returns the unique item type code for the layout item class.
visibleName Returns a translated, user visible name identifying the corresponding layout item.

Signals

Attributes

FlagNoCreationTools
class Flag

Bases: int

FlagNoCreationTools = 2
class Flags

Bases: sip.wrapper

QgsLayoutItemAbstractGuiMetadata.Flags(Union[QgsLayoutItemAbstractGuiMetadata.Flags, QgsLayoutItemAbstractGuiMetadata.Flag]) QgsLayoutItemAbstractGuiMetadata.Flags(QgsLayoutItemAbstractGuiMetadata.Flags)

createItem(self, layout: QgsLayout) → QgsLayoutItem

Creates an instance of the corresponding item type.

createItemWidget(self, item: QgsLayoutItem) → QgsLayoutItemBaseWidget

Creates a configuration widget for an item of this type. Can return None if no configuration GUI is required.

createNodeRubberBand(self, view: QgsLayoutView) → QAbstractGraphicsShapeItem

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 return None.

createRubberBand(self, view: QgsLayoutView) → QgsLayoutViewRubberBand

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.

creationIcon(self) → QIcon

Returns an icon representing creation of the layout item type.

flags(self) → QgsLayoutItemAbstractGuiMetadata.Flags

Returns item flags.

groupId(self) → str

Returns the item group ID, if set.

isNodeBased(self) → bool

Returns True if the associated item is a node based item.

newItemAddedToLayout(self, item: QgsLayoutItem)

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.

type(self) → int

Returns the unique item type code for the layout item class.

visibleName(self) → str

Returns a translated, user visible name identifying the corresponding layout item.