Class: QgsAnnotationLineTextItem¶
An annotation item which renders text along a line geometry.
Added in version 3.32.
Class Hierarchy¶
Base classes¶
Abstract base class for annotation items which are drawn with   | 
Methods
Returns the text format used to render the text.  | 
|
Returns the geometry of the item.  | 
|
Returns the offset distance from the line   | 
|
Returns the map unit scale for the offset from line   | 
|
Returns the units for the offset from line   | 
|
Sets the text format used to render the text.  | 
|
Sets the geometry of the item.  | 
|
Sets the offset distance from the line   | 
|
Sets the map unit scale for the offset from line   | 
|
Sets the unit for the offset from line   | 
|
Sets the text rendered by the item.  | 
|
Returns the text rendered by the item.  | 
Static Methods
Creates a new linestring annotation item.  | 
- class qgis.core.QgsAnnotationLineTextItem[source]¶
 Bases:
QgsAnnotationItem- __init__(text: str | None, curve: QgsCurve | None)
 Constructor for QgsAnnotationLineTextItem, with the specified
curveandtext.- Parameters:
 text (Optional[str])
curve (Optional[QgsCurve])
- static create() QgsAnnotationLineTextItem | None[source]¶
 Creates a new linestring annotation item.
- Return type:
 Optional[QgsAnnotationLineTextItem]
- format(self) QgsTextFormat[source]¶
 Returns the text format used to render the text.
See also
- Return type:
 
- geometry(self) QgsCurve | None[source]¶
 Returns the geometry of the item.
The coordinate reference system for the line will be the parent layer’s
QgsAnnotationLayer.crs().See also
- Return type:
 Optional[QgsCurve]
- offsetFromLine(self) float[source]¶
 Returns the offset distance from the line
geometry()to the text’s baseline. Units are specified throughoffsetFromLineUnit().See also
See also
- Return type:
 float
- offsetFromLineMapUnitScale(self) QgsMapUnitScale¶
 Returns the map unit scale for the offset from line
geometry()distance.See also
See also
See also
- Return type:
 
- offsetFromLineUnit(self) Qgis.RenderUnit[source]¶
 Returns the units for the offset from line
geometry()distance.See also
See also
- Return type:
 
- setFormat(self, format: QgsTextFormat)[source]¶
 Sets the text
formatused to render the text.See also
- Parameters:
 format (QgsTextFormat)
- setGeometry(self, geometry: QgsCurve | None)[source]¶
 Sets the
geometryof the item. Ownership ofgeometryis transferred.The coordinate reference system for the line will be the parent layer’s
QgsAnnotationLayer.crs().See also
- Parameters:
 geometry (Optional[QgsCurve])
- setOffsetFromLine(self, distance: float)[source]¶
 Sets the offset
distancefrom the linegeometry()to the text’s baseline. Units are specified throughsetOffsetFromLineUnit().See also
See also
- Parameters:
 distance (float)
- setOffsetFromLineMapUnitScale(self, scale: QgsMapUnitScale)[source]¶
 Sets the map unit
scalefor the offset from linegeometry()distance.See also
See also
See also
- Parameters:
 scale (QgsMapUnitScale)
- setOffsetFromLineUnit(self, unit: Qgis.RenderUnit)[source]¶
 Sets the
unitfor the offset from linegeometry()distance.See also
See also
- Parameters:
 unit (Qgis.RenderUnit)