Class: QgsAnnotationItemAbstractGuiMetadata

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.

Added in version 3.22.

class qgis.gui.QgsAnnotationItemAbstractGuiMetadata[source]

Bases: object

__init__(type: str | None, visibleName: str | None, groupId: str | None = '', flags: 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.

Parameters:
__init__(a0: QgsAnnotationItemAbstractGuiMetadata)
Parameters:

a0 (QgsAnnotationItemAbstractGuiMetadata)

virtual createItem(self) QgsAnnotationItem | None[source]

Creates an instance of the corresponding item type.

Return type:

Optional[QgsAnnotationItem]

virtual createItemWidget(self, item: QgsAnnotationItem | None) QgsAnnotationItemBaseWidget | None[source]

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

Parameters:

item (Optional[QgsAnnotationItem])

Return type:

Optional[QgsAnnotationItemBaseWidget]

virtual createMapTool(self, canvas: QgsMapCanvas | None, cadDockWidget: QgsAdvancedDigitizingDockWidget | None) QgsCreateAnnotationItemMapToolInterface | None[source]

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:

Optional[QgsCreateAnnotationItemMapToolInterface]

virtual creationIcon(self) QIcon[source]

Returns an icon representing creation of the annotation item type.

Return type:

QIcon

flags(self) Qgis.AnnotationItemGuiFlags[source]

Returns item flags.

Return type:

Qgis.AnnotationItemGuiFlags

groupId(self) str[source]

Returns the item group ID, if set.

Return type:

str

virtual newItemAddedToLayer(self, item: QgsAnnotationItem | None, layer: QgsAnnotationLayer | None)[source]

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[source]

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

Return type:

str

visibleName(self) str[source]

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

Return type:

str