QGIS API Documentation 3.38.0-Grenoble (exported)
|
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 cannot be copied. | |
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 |
QgsAnnotationItemGuiRegistry cannot be copied. | |
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.