Class: QgsAnnotationItemAbstractGuiMetadata

class qgis.gui.QgsAnnotationItemAbstractGuiMetadata

Bases: sip.wrapper

Stores GUI metadata about one annotation item class.

This is a companion to QgsAnnotationItemAbstractMetadata, storing only the components related to the GUI behavior of an annotation item.

Note

In C++ you can use QgsAnnotationItemGuiMetadata convenience class.

New in version 3.22.

QgsAnnotationItemAbstractGuiMetadata(type: str, visibleName: str, groupId: str = ‘’, flags: Union[Qgis.AnnotationItemGuiFlags, Qgis.AnnotationItemGuiFlag] = Qgis.AnnotationItemGuiFlags()) Constructor for QgsAnnotationItemAbstractGuiMetadata with the specified class type.

visibleName should be set to a translated, user visible name identifying the corresponding annotation item.

An optional groupId can be set, which allows grouping of related annotation item classes. See QgsAnnotationItemGuiMetadata for details.

QgsAnnotationItemAbstractGuiMetadata(QgsAnnotationItemAbstractGuiMetadata)

Methods

createItem

Creates an instance of the corresponding item type.

createItemWidget

Creates a configuration widget for an item of this type.

createMapTool

Creates a map tool for a creating a new item of this type.

creationIcon

Returns an icon representing creation of the annotation item type.

flags

Returns item flags.

groupId

Returns the item group ID, if set.

newItemAddedToLayer

Called when a newly created item of the associated type has been added to a layer.

type

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

visibleName

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

createItem(self) QgsAnnotationItem

Creates an instance of the corresponding item type.

Return type

QgsAnnotationItem

createItemWidget(self, item: QgsAnnotationItem) QgsAnnotationItemBaseWidget

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

Parameters

item (QgsAnnotationItem) –

Return type

QgsAnnotationItemBaseWidget

createMapTool(self, canvas: QgsMapCanvas, cadDockWidget: QgsAdvancedDigitizingDockWidget) QgsCreateAnnotationItemMapToolInterface

Creates a map tool for a creating a new item of this type.

May return None if no map tool is available for creating the item.

Parameters
Return type

QgsCreateAnnotationItemMapToolInterface

creationIcon(self) QIcon

Returns an icon representing creation of the annotation item type.

Return type

QIcon

flags(self) Qgis.AnnotationItemGuiFlags

Returns item flags.

Return type

Qgis.AnnotationItemGuiFlags

groupId(self) str

Returns the item group ID, if set.

Return type

str

newItemAddedToLayer(self, item: QgsAnnotationItem, layer: QgsAnnotationLayer)

Called when a newly created item of the associated type has been added to a layer.

This is only called for additions which result from GUI operations - i.e. it is not called for items added programmatically.

Parameters
type(self) str

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

Return type

str

visibleName(self) str

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

Return type

str