QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
23 #include <QDomElement>
32 qDeleteAll( mMetadata );
37 if ( !mMetadata.isEmpty() )
40 mMetadata.insert( QStringLiteral(
"marker" ),
new QgsAnnotationItemMetadata( QStringLiteral(
"marker" ), QObject::tr(
"Marker" ), QObject::tr(
"Markers" ),
42 mMetadata.insert( QStringLiteral(
"linestring" ),
new QgsAnnotationItemMetadata( QStringLiteral(
"linestring" ), QObject::tr(
"Polyline" ), QObject::tr(
"Polylines" ),
44 mMetadata.insert( QStringLiteral(
"polygon" ),
new QgsAnnotationItemMetadata( QStringLiteral(
"polygon" ), QObject::tr(
"Polygon" ), QObject::tr(
"Polygons" ),
46 mMetadata.insert( QStringLiteral(
"pointtext" ),
new QgsAnnotationItemMetadata( QStringLiteral(
"pointtext" ), QObject::tr(
"Text at point" ), QObject::tr(
"Text at points" ),
53 return mMetadata.value( type );
58 if ( !metadata || mMetadata.contains( metadata->
type() ) )
61 mMetadata[metadata->
type()] = metadata;
68 if ( !mMetadata.contains( type ) )
71 return mMetadata[type]->createItem();
76 QMap<QString, QString> types;
77 for (
auto it = mMetadata.constBegin(); it != mMetadata.constEnd(); ++it )
79 types.insert( it.key(), it.value()->visibleName() );
bool populate()
Populates the registry with standard item types.
QgsAnnotationItemRegistry(QObject *parent=nullptr)
Creates a new empty item registry.
void typeAdded(const QString &type, const QString &name)
Emitted whenever a new item type is added to the registry, with the specified type and visible name.
QMap< QString, QString > itemTypes() const
Returns a map of available item types to translated name.
~QgsAnnotationItemRegistry() override
QgsAnnotationItem * createItem(const QString &type) const
Creates a new instance of a annotation item given the item type.
QgsAnnotationItemAbstractMetadata * itemMetadata(const QString &type) const
Returns the metadata for the specified item type.
static QgsAnnotationPointTextItem * create()
Creates a new text at point annotation item.
static QgsAnnotationMarkerItem * create()
Creates a new marker annotation item.
bool addItemType(QgsAnnotationItemAbstractMetadata *metadata)
Registers a new annotation item type.
static QgsAnnotationLineItem * create()
Creates a new linestring annotation item.
Abstract base class for annotation items which are drawn with QgsAnnotationLayers.
static QgsAnnotationPolygonItem * create()
Creates a new polygon annotation item.