QGIS API Documentation
3.0.2-Girona (307d082)
|
Manages storage of a set of QgsAnnotation annotation objects. More...
#include <qgsannotationmanager.h>
Signals | |
void | annotationAboutToBeRemoved (QgsAnnotation *annotation) |
Emitted when an annotation is about to be removed from the manager. More... | |
void | annotationAdded (QgsAnnotation *annotation) |
Emitted when a annotation has been added to the manager. More... | |
void | annotationRemoved () |
Emitted when an annotation was removed from the manager. More... | |
Public Member Functions | |
QgsAnnotationManager (QgsProject *project=nullptr) | |
Constructor for QgsAnnotationManager. More... | |
~QgsAnnotationManager () override | |
bool | addAnnotation (QgsAnnotation *annotation) |
Adds an annotation to the manager. More... | |
QList< QgsAnnotation *> | annotations () const |
Returns a list of all annotations contained in the manager. More... | |
void | clear () |
Removes and deletes all annotations from the manager. More... | |
QList< QgsAnnotation *> | cloneAnnotations () const |
Returns a list containing clones of all annotations contained in the manager. More... | |
bool | readXml (const QDomElement &element, const QgsReadWriteContext &context) |
Reads the manager's state from a DOM element, restoring all annotations present in the XML document. More... | |
bool | removeAnnotation (QgsAnnotation *annotation) |
Removes an annotation from the manager. More... | |
QDomElement | writeXml (QDomDocument &doc, const QgsReadWriteContext &context) const |
Returns a DOM element representing the state of the manager. More... | |
Manages storage of a set of QgsAnnotation annotation objects.
QgsAnnotationManager handles the storage, serializing and deserializing of QgsAnnotations. Usually this class is not constructed directly, but rather accessed through a QgsProject via QgsProject::annotationManager().
QgsAnnotationManager retains ownership of all the annotations contained in the manager.
Definition at line 43 of file qgsannotationmanager.h.
|
explicit |
Constructor for QgsAnnotationManager.
The project will become the parent object for this manager.
Definition at line 21 of file qgsannotationmanager.cpp.
|
override |
Definition at line 28 of file qgsannotationmanager.cpp.
bool QgsAnnotationManager::addAnnotation | ( | QgsAnnotation * | annotation | ) |
Adds an annotation to the manager.
Ownership of the annotation is transferred to the manager. Returns true if the addition was successful, or false if the annotation could not be added.
Definition at line 33 of file qgsannotationmanager.cpp.
|
signal |
Emitted when an annotation is about to be removed from the manager.
|
signal |
Emitted when a annotation has been added to the manager.
|
signal |
Emitted when an annotation was removed from the manager.
QList< QgsAnnotation * > QgsAnnotationManager::annotations | ( | ) | const |
Returns a list of all annotations contained in the manager.
Definition at line 71 of file qgsannotationmanager.cpp.
void QgsAnnotationManager::clear | ( | ) |
Removes and deletes all annotations from the manager.
Definition at line 63 of file qgsannotationmanager.cpp.
QList< QgsAnnotation * > QgsAnnotationManager::cloneAnnotations | ( | ) | const |
Returns a list containing clones of all annotations contained in the manager.
The caller takes responsibility for deleting all returned annotations.
Definition at line 76 of file qgsannotationmanager.cpp.
bool QgsAnnotationManager::readXml | ( | const QDomElement & | element, |
const QgsReadWriteContext & | context | ||
) |
Reads the manager's state from a DOM element, restoring all annotations present in the XML document.
Definition at line 86 of file qgsannotationmanager.cpp.
bool QgsAnnotationManager::removeAnnotation | ( | QgsAnnotation * | annotation | ) |
Removes an annotation from the manager.
The annotation is deleted. Returns true if the removal was successful, or false if the removal failed (eg as a result of removing an annotation which is not contained in the manager).
Definition at line 47 of file qgsannotationmanager.cpp.
QDomElement QgsAnnotationManager::writeXml | ( | QDomDocument & | doc, |
const QgsReadWriteContext & | context | ||
) | const |
Returns a DOM element representing the state of the manager.
Definition at line 125 of file qgsannotationmanager.cpp.