Class: QgsAnnotationPointTextItem

An annotation item which renders a text string at a point location.

Added in version 3.16.

Class Hierarchy

Inheritance diagram of qgis.core.QgsAnnotationPointTextItem

Base classes

QgsAnnotationItem

Abstract base class for annotation items which are drawn with QgsAnnotationLayers.

Methods

alignment

Returns the text's alignment relative to the reference point().

angle

Returns the text's rotation angle, in degrees clockwise.

format

Returns the text format used to render the text.

point

Returns the point location of the text.

rotationMode

Returns the rotation mode for the text item.

setAlignment

Sets the text's alignment relative to the reference point().

setAngle

Sets the text's rotation angle, in degrees clockwise.

setFormat

Sets the text format used to render the text.

setPoint

Sets the point location of the text.

setRotationMode

Sets the rotation mode for the text item.

setText

Sets the text rendered by the item.

text

Returns the text rendered by the item.

Static Methods

create

Creates a new text at point annotation item.

class qgis.core.QgsAnnotationPointTextItem[source]

Bases: QgsAnnotationItem

__init__(text: str | None, point: QgsPointXY)

Constructor for QgsAnnotationPointTextItem, containing the specified text at the specified point.

Parameters:
alignment(self) Qt.Alignment[source]

Returns the text’s alignment relative to the reference point().

See also

setAlignment()

Return type:

Qt.Alignment

angle(self) float[source]

Returns the text’s rotation angle, in degrees clockwise.

See also

setAngle()

Return type:

float

static create() QgsAnnotationPointTextItem | None[source]

Creates a new text at point annotation item.

Return type:

Optional[QgsAnnotationPointTextItem]

format(self) QgsTextFormat[source]

Returns the text format used to render the text.

See also

setFormat()

Return type:

QgsTextFormat

point(self) QgsPointXY[source]

Returns the point location of the text.

The coordinate reference system for the point will be the parent layer’s QgsAnnotationLayer.crs().

See also

setPoint()

Return type:

QgsPointXY

rotationMode(self) Qgis.SymbolRotationMode[source]

Returns the rotation mode for the text item.

Added in version 3.32.

Return type:

Qgis.SymbolRotationMode

setAlignment(self, alignment: Qt.Alignment | Qt.AlignmentFlag)[source]

Sets the text’s alignment relative to the reference point().

See also

alignment()

Parameters:

alignment (Union[Qt.Alignment, Qt.AlignmentFlag])

setAngle(self, angle: float)[source]

Sets the text’s rotation angle, in degrees clockwise.

See also

angle()

Parameters:

angle (float)

setFormat(self, format: QgsTextFormat)[source]

Sets the text format used to render the text.

See also

format()

Parameters:

format (QgsTextFormat)

setPoint(self, point: QgsPointXY)[source]

Sets the point location of the text.

The coordinate reference system for the point will be the parent layer’s QgsAnnotationLayer.crs().

See also

point()

Parameters:

point (QgsPointXY)

setRotationMode(self, mode: Qgis.SymbolRotationMode)[source]

Sets the rotation mode for the text item.

See also

rotationMode()

Added in version 3.32.

Parameters:

mode (Qgis.SymbolRotationMode)

setText(self, text: str | None)[source]

Sets the text rendered by the item.

See also

text()

Parameters:

text (Optional[str])

text(self) str[source]

Returns the text rendered by the item.

See also

setText()

Return type:

str