Class: QgsAnnotationItemGuiRegistry

class qgis.gui.QgsAnnotationItemGuiRegistry

Bases: PyQt5.QtCore.QObject

Registry of available annotation item GUI behavior.

QgsAnnotationItemGuiRegistry is not usually directly created, but rather accessed through QgsGui.annotationItemGuiRegistry().

This acts as a companion to QgsAnnotationItemRegistry, handling only the components related to the GUI behavior of annotation items.

New in version 3.22.

QgsAnnotationItemGuiRegistry(parent: QObject = None) Creates a new empty item GUI registry.

QgsAnnotationItemGuiRegistry is not usually directly created, but rather accessed through QgsGui.annotationItemGuiRegistry().

Methods

addAnnotationItemGuiMetadata

Registers the gui metadata for a new annotation item type.

addDefaultItems

Populates the registry with default items.

addItemGroup

Registers a new item group with the registry.

childEvent

connectNotify

createItem

Creates a new instance of an annotation item given the item metadata metadataId.

createItemWidget

Creates a new instance of an annotation item configuration widget for the specified item.

customEvent

disconnectNotify

isSignalConnected

itemGroup

Returns a reference to the item group with matching id.

itemMetadata

Returns the metadata for the specified item metadataId.

itemMetadataIds

Returns a list of available item metadata ids handled by the registry.

metadataIdForItemType

Returns the GUI item metadata ID which corresponds to the specified annotation item type.

newItemAddedToLayer

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

receivers

sender

senderSignalIndex

timerEvent

Signals

typeAdded

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

addAnnotationItemGuiMetadata(self, metadata: QgsAnnotationItemAbstractGuiMetadata) bool

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

Parameters

metadata (QgsAnnotationItemAbstractGuiMetadata) –

Return type

bool

addDefaultItems(self)

Populates the registry with default items.

addItemGroup(self, group: QgsAnnotationItemGuiGroup) bool

Registers a new item group with the registry. This must be done before calling addAnnotationItemGuiMetadata() for any item types associated with the group.

Returns True if group was added, or False if group could not be added (e.g. due to duplicate id value).

See also

itemGroup()

Parameters

group (QgsAnnotationItemGuiGroup) –

Return type

bool

childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
createItem(self, metadataId: int) QgsAnnotationItem

Creates a new instance of an annotation item given the item metadata metadataId.

Parameters

metadataId (int) –

Return type

QgsAnnotationItem

createItemWidget(self, item: QgsAnnotationItem) QgsAnnotationItemBaseWidget

Creates a new instance of an annotation item configuration widget for the specified item.

Parameters

item (QgsAnnotationItem) –

Return type

QgsAnnotationItemBaseWidget

customEvent(self, QEvent)
disconnectNotify(self, QMetaMethod)
isSignalConnected(self, QMetaMethod) bool
itemGroup(self, id: str) QgsAnnotationItemGuiGroup

Returns a reference to the item group with matching id.

See also

addItemGroup()

Parameters

id (str) –

Return type

QgsAnnotationItemGuiGroup

itemMetadata(self, metadataId: int) QgsAnnotationItemAbstractGuiMetadata

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

Parameters

metadataId (int) –

Return type

QgsAnnotationItemAbstractGuiMetadata

itemMetadataIds(self) List[int]

Returns a list of available item metadata ids handled by the registry.

Return type

List[int]

metadataIdForItemType(self, type: str) int

Returns the GUI item metadata ID which corresponds to the specified annotation item type.

In the case that multiple GUI metadata classes exist for a single annotation item type then only the first encountered GUI metadata ID will be returned.

Returns -1 if no matching metadata is found in the GUI registry.

Parameters

type (str) –

Return type

int

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

Called when a newly created item of the associated metadata metadataId 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
receivers(self, PYQT_SIGNAL) int
sender(self) QObject
senderSignalIndex(self) int
timerEvent(self, QTimerEvent)
typeAdded

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type

PYQT_SIGNAL