Class: QgsAnnotationPointTextItem

class qgis.core.QgsAnnotationPointTextItem(text: str, point: QgsPointXY)

Bases: QgsAnnotationItem

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

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

New in version 3.16.

Parameters
  • text (str) –

  • point

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

boundingBox(self)QgsRectangle
Return type

QgsRectangle

clone(self)QgsAnnotationPointTextItem
Return type

QgsAnnotationPointTextItem

create()QgsAnnotationPointTextItem

Creates a new text at point annotation item.

Return type

QgsAnnotationPointTextItem

format(self)QgsTextFormat

Returns the text format used to render the text.

See also

setFormat()

Return type

QgsTextFormat

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

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

bool

render(self, context: QgsRenderContext, feedback: QgsFeedback)
Parameters
setAlignment(self, alignment: Union[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) –

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

type(self) → str
Return type

str

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

bool