QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
|
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. 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... | |
QgsAnnotationItem * | createItem (int metadataId) const |
Creates a new instance of an annotation item given the item metadata metadataId. More... | |
QgsAnnotationItemBaseWidget * | createItemWidget (QgsAnnotationItem *item) const |
Creates a new instance of an annotation item configuration widget for the specified item. More... | |
const QgsAnnotationItemGuiGroup & | itemGroup (const QString &id) |
Returns a reference to the item group with matching id. More... | |
QgsAnnotationItemAbstractGuiMetadata * | itemMetadata (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... | |
QgsAnnotationItemGuiRegistry & | operator= (const QgsAnnotationItemGuiRegistry &rh)=delete |
QgsAnnotationItemGuiRegistry cannot be copied. More... | |
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 87 of file qgsannotationitemguiregistry.cpp.
|
override |
Definition at line 93 of file qgsannotationitemguiregistry.cpp.
|
delete |
QgsAnnotationItemGuiRegistry cannot be copied.
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.
void QgsAnnotationItemGuiRegistry::addDefaultItems | ( | ) |
Populates the registry with default items.
Definition at line 179 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 124 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 138 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 159 of file qgsannotationitemguiregistry.cpp.
const QgsAnnotationItemGuiGroup & QgsAnnotationItemGuiRegistry::itemGroup | ( | const QString & | id | ) |
Returns a reference to the item group with matching id.
Definition at line 133 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 98 of file qgsannotationitemguiregistry.cpp.
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.
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.
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.
|
delete |
QgsAnnotationItemGuiRegistry cannot be copied.
|
signal |
Emitted whenever a new item type is added to the registry, with the specified metadataId.