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.

Parameters
  • type (int) –

  • visibleName (str) –

  • groupId (str = '') –

  • isNodeBased (bool = False) –

  • flags

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.

Parameters

layout (QgsLayout) –

Return type

QgsLayoutItem

createItemWidget(self, item: QgsLayoutItem) → QgsLayoutItemBaseWidget

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

Parameters

item (QgsLayoutItem) –

Return type

QgsLayoutItemBaseWidget

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.

Parameters

view (QgsLayoutView) –

Return type

QAbstractGraphicsShapeItem

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.

Parameters

view (QgsLayoutView) –

Return type

QgsLayoutViewRubberBand

creationIcon(self) → QIcon

Returns an icon representing creation of the layout item type.

Return type

QIcon

flags(self) → QgsLayoutItemAbstractGuiMetadata.Flags

Returns item flags.

Return type

QgsLayoutItemAbstractGuiMetadata.Flags

groupId(self) → str

Returns the item group ID, if set.

Return type

str

isNodeBased(self) → bool

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

Return type

bool

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.

Parameters

item (QgsLayoutItem) –

type(self) → int

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

Return type

int

visibleName(self) → str

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

Return type

str