QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
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.
 

Public Member Functions

 QgsAnnotationItemGuiRegistry (const QgsAnnotationItemGuiRegistry &rh)=delete
 
 QgsAnnotationItemGuiRegistry (QObject *parent=nullptr)
 Creates a new empty item GUI registry.
 
 ~QgsAnnotationItemGuiRegistry () override
 
bool addAnnotationItemGuiMetadata (QgsAnnotationItemAbstractGuiMetadata *metadata)
 Registers the gui metadata for a new annotation item type.
 
void addDefaultItems ()
 Populates the registry with default items.
 
bool addItemGroup (const QgsAnnotationItemGuiGroup &group)
 Registers a new item group with the registry.
 
QgsAnnotationItemcreateItem (int metadataId) const
 Creates a new instance of an annotation item given the item metadata metadataId.
 
QgsAnnotationItemBaseWidgetcreateItemWidget (QgsAnnotationItem *item) const
 Creates a new instance of an annotation item configuration widget for the specified item.
 
const QgsAnnotationItemGuiGroupitemGroup (const QString &id)
 Returns a reference to the item group with matching id.
 
QgsAnnotationItemAbstractGuiMetadataitemMetadata (int metadataId) const
 Returns the metadata for the specified item metadataId.
 
QList< int > itemMetadataIds () const
 Returns a list of available item metadata ids handled by the registry.
 
int metadataIdForItemType (const QString &type) const
 Returns the GUI item metadata ID which corresponds to the specified annotation item type.
 
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.
 
QgsAnnotationItemGuiRegistryoperator= (const QgsAnnotationItemGuiRegistry &rh)=delete
 

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 91 of file qgsannotationitemguiregistry.cpp.

◆ ~QgsAnnotationItemGuiRegistry()

QgsAnnotationItemGuiRegistry::~QgsAnnotationItemGuiRegistry ( )
override

Definition at line 97 of file qgsannotationitemguiregistry.cpp.

◆ QgsAnnotationItemGuiRegistry() [2/2]

QgsAnnotationItemGuiRegistry::QgsAnnotationItemGuiRegistry ( const QgsAnnotationItemGuiRegistry rh)
delete

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 117 of file qgsannotationitemguiregistry.cpp.

◆ addDefaultItems()

void QgsAnnotationItemGuiRegistry::addDefaultItems ( )

Populates the registry with default items.

Definition at line 183 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 128 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 142 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 163 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 137 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 102 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 178 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 107 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 155 of file qgsannotationitemguiregistry.cpp.

◆ operator=()

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

◆ 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: