Class: QgsTextAnnotation

An annotation item that displays formatted text from a QTextDocument document.

Class Hierarchy

Inheritance diagram of qgis.core.QgsTextAnnotation

Base classes

QgsAnnotation

Abstract base class for annotation items which are drawn over a map.

QObject

Methods

document

Returns the text document which will be rendered within the annotation.

setDocument

Sets the text document which will be rendered within the annotation.

Static Methods

create

Returns a new QgsTextAnnotation object.

class qgis.core.QgsTextAnnotation[source]

Bases: QgsAnnotation

__init__(parent: QObject | None = None)

Constructor for QgsTextAnnotation.

Parameters:

parent (Optional[QObject] = None)

static create() QgsTextAnnotation | None[source]

Returns a new QgsTextAnnotation object.

Return type:

Optional[QgsTextAnnotation]

document(self) QTextDocument | None[source]

Returns the text document which will be rendered within the annotation.

See also

setDocument()

Return type:

Optional[QTextDocument]

setDocument(self, doc: QTextDocument | None)[source]

Sets the text document which will be rendered within the annotation. Ownership is not transferred.

See also

document()

Parameters:

doc (Optional[QTextDocument])