Class: QgsAnnotationPointTextItem

class qgis.core.QgsAnnotationPointTextItem

Bases: QgsAnnotationItem

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

New in version 3.16.

QgsAnnotationPointTextItem(text: str, point: QgsPointXY) Constructor for QgsAnnotationPointTextItem, containing the specified text at the specified point.

Methods

alignment

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

angle

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

applyEdit

param operation:

boundingBox

rtype:

QgsRectangle

clone

rtype:

QgsAnnotationPointTextItem

copyCommonProperties

Copies common properties from the base class from an other item.

create

Creates a new text at point annotation item.

flags

rtype:

Qgis.AnnotationItemFlags

format

Returns the text format used to render the text.

nodes

rtype:

List[QgsAnnotationItemNode]

point

Returns the point location of the text.

readCommonProperties

Reads common properties from the base class from the given DOM element.

readXml

param element:

render

param context:

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.

transientEditResults

param operation:

type

rtype:

str

writeCommonProperties

Writes common properties from the base class into an XML element.

writeXml

param element:

alignment(self) Qt.Alignment

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

See also

setAlignment()

Return type:

Qt.Alignment

angle(self) float

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

See also

setAngle()

Return type:

float

applyEdit(self, operation: QgsAbstractAnnotationItemEditOperation) Qgis.AnnotationItemEditOperationResult
Parameters:

operation (QgsAbstractAnnotationItemEditOperation) –

Return type:

Qgis.AnnotationItemEditOperationResult

boundingBox(self) QgsRectangle
boundingBox(self, context: QgsRenderContext) QgsRectangle
Return type:

QgsRectangle

clone(self) QgsAnnotationPointTextItem
Return type:

QgsAnnotationPointTextItem

copyCommonProperties(self, other: QgsAnnotationItem)

Copies common properties from the base class from an other item.

New in version 3.22.

create() QgsAnnotationPointTextItem

Creates a new text at point annotation item.

Return type:

QgsAnnotationPointTextItem

flags(self) Qgis.AnnotationItemFlags
Return type:

Qgis.AnnotationItemFlags

format(self) QgsTextFormat

Returns the text format used to render the text.

See also

setFormat()

Return type:

QgsTextFormat

nodes(self) List[QgsAnnotationItemNode]
Return type:

List[QgsAnnotationItemNode]

point(self) QgsPointXY

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

readCommonProperties(self, element: QDomElement, context: QgsReadWriteContext) bool

Reads common properties from the base class from the given DOM element.

See also

readXml()

New in version 3.22.

readXml(self, element: QDomElement, context: QgsReadWriteContext) bool
Parameters:
Return type:

bool

render(self, context: QgsRenderContext, feedback: QgsFeedback)
Parameters:
rotationMode(self) Qgis.SymbolRotationMode

Returns the rotation mode for the text item.

New in version 3.32.

Return type:

Qgis.SymbolRotationMode

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

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

See also

alignment()

Parameters:

alignment (Union[Qt.Alignment) –

setAngle(self, angle: float)

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

See also

angle()

Parameters:

angle (float) –

setFormat(self, format: QgsTextFormat)

Sets the text format used to render the text.

See also

format()

Parameters:

format (QgsTextFormat) –

setPoint(self, point: QgsPointXY)

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)

Sets the rotation mode for the text item.

See also

rotationMode()

New in version 3.32.

Parameters:

mode (Qgis.SymbolRotationMode) –

setText(self, text: str)

Sets the text rendered by the item.

See also

text()

Parameters:

text (str) –

text(self) str

Returns the text rendered by the item.

See also

setText()

Return type:

str

transientEditResults(self, operation: QgsAbstractAnnotationItemEditOperation) QgsAnnotationItemEditOperationTransientResults
Parameters:

operation (QgsAbstractAnnotationItemEditOperation) –

Return type:

QgsAnnotationItemEditOperationTransientResults

type(self) str
Return type:

str

writeCommonProperties(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool

Writes common properties from the base class into an XML element.

See also

writeXml()

New in version 3.22.

writeXml(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool
Parameters:
Return type:

bool