Class: QgsAnnotationManager¶
- class qgis.core.QgsAnnotationManager¶
Bases:
PyQt5.QtCore.QObject
Manages storage of a set of
QgsAnnotation
annotation objects.QgsAnnotationManager
handles the storage, serializing and deserializing ofQgsAnnotations
. Usually this class is not constructed directly, but rather accessed through aQgsProject
viaQgsProject.annotationManager()
.QgsAnnotationManager
retains ownership of all the annotations contained in the manager.QgsAnnotationManager(project:
QgsProject
= None) Constructor forQgsAnnotationManager
. The project will become the parent object for this manager.Methods
Accepts the specified style entity
visitor
, causing it to visit all style entities associated within the contained annotations.Adds an annotation to the manager.
Returns a list of all annotations contained in the manager.
Removes and deletes all annotations from the manager.
Returns a list containing clones of all annotations contained in the manager.
Reads the manager's state from a DOM element, restoring all annotations present in the XML document.
Removes an annotation from the manager.
Returns a DOM element representing the state of the manager.
Signals
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
- accept(self, visitor: QgsStyleEntityVisitorInterface) bool ¶
Accepts the specified style entity
visitor
, causing it to visit all style entities associated within the contained annotations.Returns
True
if the visitor should continue visiting other objects, orFalse
if visiting should be canceled.New in version 3.10.
- Parameters:
visitor (QgsStyleEntityVisitorInterface) –
- Return type:
bool
- addAnnotation(self, annotation: QgsAnnotation) bool ¶
Adds an annotation to the manager. Ownership of the annotation is transferred to the manager. Returns
True
if the addition was successful, orFalse
if the annotation could not be added.See also
See also
- Parameters:
annotation (QgsAnnotation) –
- Return type:
bool
- annotationAboutToBeRemoved¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- annotationAdded¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- annotationRemoved¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- annotations(self) List[QgsAnnotation] ¶
Returns a list of all annotations contained in the manager.
See also
- Return type:
List[QgsAnnotation]
- childEvent(self, QChildEvent)¶
- clear(self)¶
Removes and deletes all annotations from the manager.
See also
- cloneAnnotations(self) List[QgsAnnotation] ¶
Returns a list containing clones of all annotations contained in the manager. The caller takes responsibility for deleting all returned annotations.
See also
- Return type:
List[QgsAnnotation]
- connectNotify(self, QMetaMethod)¶
- customEvent(self, QEvent)¶
- disconnectNotify(self, QMetaMethod)¶
- isSignalConnected(self, QMetaMethod) bool ¶
- readXml(self, element: QDomElement, context: QgsReadWriteContext) bool ¶
Reads the manager’s state from a DOM element, restoring all annotations present in the XML document.
See also
- Parameters:
element (QDomElement) –
context (QgsReadWriteContext) –
- Return type:
bool
- receivers(self, PYQT_SIGNAL) int ¶
- removeAnnotation(self, annotation: QgsAnnotation) bool ¶
Removes an annotation from the manager. The annotation is deleted. Returns
True
if the removal was successful, orFalse
if the removal failed (eg as a result of removing an annotation which is not contained in the manager).See also
See also
See also
See also
- Parameters:
annotation (QgsAnnotation) –
- Return type:
bool
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- timerEvent(self, QTimerEvent)¶
- writeXml(self, doc: QDomDocument, context: QgsReadWriteContext) QDomElement ¶
Returns a DOM element representing the state of the manager.
See also
- Parameters:
doc (QDomDocument) –
context (QgsReadWriteContext) –
- Return type:
QDomElement