QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
Signals | Public Member Functions | List of all members
QgsAnnotationItemGuiRegistry Class Reference

Registry of available annotation item GUI behavior. More...

#include <qgsannotationitemguiregistry.h>

Inheritance diagram for QgsAnnotationItemGuiRegistry:
Inheritance graph
[legend]

Signals

void typeAdded (int metadataId)
 Emitted whenever a new item type is added to the registry, with the specified metadataId. More...
 

Public Member Functions

 QgsAnnotationItemGuiRegistry (const QgsAnnotationItemGuiRegistry &rh)=delete
 QgsAnnotationItemGuiRegistry cannot be copied. More...
 
 QgsAnnotationItemGuiRegistry (QObject *parent=nullptr)
 Creates a new empty item GUI registry. More...
 
 ~QgsAnnotationItemGuiRegistry () override
 
bool addAnnotationItemGuiMetadata (QgsAnnotationItemAbstractGuiMetadata *metadata)
 Registers the gui metadata for a new annotation item type. More...
 
void addDefaultItems ()
 Populates the registry with default items. More...
 
bool addItemGroup (const QgsAnnotationItemGuiGroup &group)
 Registers a new item group with the registry. More...
 
QgsAnnotationItemcreateItem (int metadataId) const
 Creates a new instance of an annotation item given the item metadata metadataId. More...
 
QgsAnnotationItemBaseWidgetcreateItemWidget (QgsAnnotationItem *item) const
 Creates a new instance of an annotation item configuration widget for the specified item. More...
 
const QgsAnnotationItemGuiGroupitemGroup (const QString &id)
 Returns a reference to the item group with matching id. More...
 
QgsAnnotationItemAbstractGuiMetadataitemMetadata (int metadataId) const
 Returns the metadata for the specified item metadataId. More...
 
QList< int > itemMetadataIds () const
 Returns a list of available item metadata ids handled by the registry. More...
 
int metadataIdForItemType (const QString &type) const
 Returns the GUI item metadata ID which corresponds to the specified annotation item type. More...
 
void newItemAddedToLayer (int metadataId, QgsAnnotationItem *item, QgsAnnotationLayer *layer)
 Called when a newly created item of the associated metadata metadataId has been added to a layer. More...
 
QgsAnnotationItemGuiRegistryoperator= (const QgsAnnotationItemGuiRegistry &rh)=delete
 QgsAnnotationItemGuiRegistry cannot be copied. More...
 

Detailed Description

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.

Since
QGIS 3.22

Definition at line 304 of file qgsannotationitemguiregistry.h.

Constructor & Destructor Documentation

◆ QgsAnnotationItemGuiRegistry() [1/2]

QgsAnnotationItemGuiRegistry::QgsAnnotationItemGuiRegistry ( QObject *  parent = nullptr)

Creates a new empty item GUI registry.

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

Definition at line 87 of file qgsannotationitemguiregistry.cpp.

◆ ~QgsAnnotationItemGuiRegistry()

QgsAnnotationItemGuiRegistry::~QgsAnnotationItemGuiRegistry ( )
override

Definition at line 93 of file qgsannotationitemguiregistry.cpp.

◆ QgsAnnotationItemGuiRegistry() [2/2]

QgsAnnotationItemGuiRegistry::QgsAnnotationItemGuiRegistry ( const QgsAnnotationItemGuiRegistry rh)
delete

QgsAnnotationItemGuiRegistry cannot be copied.

Member Function Documentation

◆ addAnnotationItemGuiMetadata()

bool QgsAnnotationItemGuiRegistry::addAnnotationItemGuiMetadata ( QgsAnnotationItemAbstractGuiMetadata metadata)

Registers the gui metadata for a new annotation item type.

Takes ownership of the metadata instance.

Definition at line 113 of file qgsannotationitemguiregistry.cpp.

◆ addDefaultItems()

void QgsAnnotationItemGuiRegistry::addDefaultItems ( )

Populates the registry with default items.

Definition at line 179 of file qgsannotationitemguiregistry.cpp.

◆ addItemGroup()

bool QgsAnnotationItemGuiRegistry::addItemGroup ( const QgsAnnotationItemGuiGroup group)

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()

Definition at line 124 of file qgsannotationitemguiregistry.cpp.

◆ createItem()

QgsAnnotationItem * QgsAnnotationItemGuiRegistry::createItem ( int  metadataId) const

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

Definition at line 138 of file qgsannotationitemguiregistry.cpp.

◆ createItemWidget()

QgsAnnotationItemBaseWidget * QgsAnnotationItemGuiRegistry::createItemWidget ( QgsAnnotationItem item) const

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

Definition at line 159 of file qgsannotationitemguiregistry.cpp.

◆ itemGroup()

const QgsAnnotationItemGuiGroup & QgsAnnotationItemGuiRegistry::itemGroup ( const QString &  id)

Returns a reference to the item group with matching id.

See also
addItemGroup()

Definition at line 133 of file qgsannotationitemguiregistry.cpp.

◆ itemMetadata()

QgsAnnotationItemAbstractGuiMetadata * QgsAnnotationItemGuiRegistry::itemMetadata ( int  metadataId) const

Returns the metadata for the specified item metadataId.

Returns nullptr if a corresponding metadataId was not found in the registry.

Definition at line 98 of file qgsannotationitemguiregistry.cpp.

◆ itemMetadataIds()

QList< int > QgsAnnotationItemGuiRegistry::itemMetadataIds ( ) const

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

Definition at line 174 of file qgsannotationitemguiregistry.cpp.

◆ metadataIdForItemType()

int QgsAnnotationItemGuiRegistry::metadataIdForItemType ( const QString &  type) const

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.

Definition at line 103 of file qgsannotationitemguiregistry.cpp.

◆ newItemAddedToLayer()

void QgsAnnotationItemGuiRegistry::newItemAddedToLayer ( int  metadataId,
QgsAnnotationItem item,
QgsAnnotationLayer layer 
)

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.

Definition at line 151 of file qgsannotationitemguiregistry.cpp.

◆ operator=()

QgsAnnotationItemGuiRegistry & QgsAnnotationItemGuiRegistry::operator= ( const QgsAnnotationItemGuiRegistry rh)
delete

QgsAnnotationItemGuiRegistry cannot be copied.

◆ typeAdded

void QgsAnnotationItemGuiRegistry::typeAdded ( int  metadataId)
signal

Emitted whenever a new item type is added to the registry, with the specified metadataId.


The documentation for this class was generated from the following files: