Class: QgsAnnotationItemRegistry

Registry of available annotation item types.

QgsAnnotationItemRegistry is not usually directly created, but rather accessed through QgsApplication.annotationItemRegistry().

A companion class, QgsAnnotationItemGuiRegistry, handles the GUI behavior of annotation items.

Added in version 3.16.

Class Hierarchy

Inheritance diagram of qgis.core.QgsAnnotationItemRegistry

Base classes

QObject

Methods

addItemType

Registers a new annotation item type.

createItem

Creates a new instance of a annotation item given the item type.

itemMetadata

Returns the metadata for the specified item type.

itemTypes

Returns a map of available item types to translated name.

populate

Populates the registry with standard item types.

Signals

typeAdded

Emitted whenever a new item type is added to the registry, with the specified type and visible name.

class qgis.core.QgsAnnotationItemRegistry[source]

Bases: QObject

__init__(parent: QObject | None = None)

Creates a new empty item registry.

QgsAnnotationItemRegistry is not usually directly created, but rather accessed through QgsApplication.annotationItemRegistry().

See also

populate()

Parameters:

parent (Optional[QObject] = None)

addItemType(self, metadata: QgsAnnotationItemAbstractMetadata | None) bool[source]

Registers a new annotation item type. Takes ownership of the metadata instance.

Parameters:

metadata (Optional[QgsAnnotationItemAbstractMetadata])

Return type:

bool

createItem(self, type: str | None) QgsAnnotationItem | None[source]

Creates a new instance of a annotation item given the item type.

Parameters:

type (Optional[str])

Return type:

Optional[QgsAnnotationItem]

itemMetadata(self, type: str | None) QgsAnnotationItemAbstractMetadata | None[source]

Returns the metadata for the specified item type. Returns None if a corresponding type was not found in the registry.

Parameters:

type (Optional[str])

Return type:

Optional[QgsAnnotationItemAbstractMetadata]

itemTypes(self) Dict[str, str]

Returns a map of available item types to translated name.

Return type:

Dict[str, str]

populate(self) bool[source]

Populates the registry with standard item types. If called on a non-empty registry then this will have no effect and will return False.

Return type:

bool

signal typeAdded(type: str, name: str)[source]

Emitted whenever a new item type is added to the registry, with the specified type and visible name.

Parameters:
  • type (str)

  • name (str)