QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
Registry of available annotation item GUI behavior. More...
#include <qgsannotationitemguiregistry.h>
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. | |
QgsAnnotationItem * | createItem (int metadataId) const |
Creates a new instance of an annotation item given the item metadata metadataId. | |
QgsAnnotationItemBaseWidget * | createItemWidget (QgsAnnotationItem *item) const |
Creates a new instance of an annotation item configuration widget for the specified item. | |
const QgsAnnotationItemGuiGroup & | itemGroup (const QString &id) |
Returns a reference to the item group with matching id. | |
QgsAnnotationItemAbstractGuiMetadata * | itemMetadata (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. | |
QgsAnnotationItemGuiRegistry & | operator= (const QgsAnnotationItemGuiRegistry &rh)=delete |
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.
Definition at line 304 of file qgsannotationitemguiregistry.h.
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.
|
override |
Definition at line 97 of file qgsannotationitemguiregistry.cpp.
|
delete |
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.
void QgsAnnotationItemGuiRegistry::addDefaultItems | ( | ) |
Populates the registry with default items.
Definition at line 183 of file qgsannotationitemguiregistry.cpp.
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).
Definition at line 128 of file qgsannotationitemguiregistry.cpp.
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.
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.
const QgsAnnotationItemGuiGroup & QgsAnnotationItemGuiRegistry::itemGroup | ( | const QString & | id | ) |
Returns a reference to the item group with matching id.
Definition at line 137 of file qgsannotationitemguiregistry.cpp.
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.
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.
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.
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.
|
delete |
|
signal |
Emitted whenever a new item type is added to the registry, with the specified metadataId.