Class: QgsAnnotationRectangleTextItem¶
An annotation item which renders paragraphs of text within a rectangle.
Added in version 3.40.
Class Hierarchy¶
Base classes¶
Abstract base class for annotation items which render annotations in a rectangular shape.  | 
|
Abstract base class for annotation items which are drawn with   | 
Methods
Returns the text's alignment relative to the   | 
|
Returns the text format used to render the text.  | 
|
Returns the margins between the outside of the item's frame and the interior text.  | 
|
Returns the units for the margins between the item's frame and the interior text.  | 
|
Sets the text's alignment relative to the   | 
|
Sets the text format used to render the text.  | 
|
Sets the margins between the outside of the item's frame and the interior text.  | 
|
Sets the unit for the margins between the item's frame and the interior text.  | 
|
Sets the text rendered by the item.  | 
|
Returns the text rendered by the item.  | 
Static Methods
Creates a new rectangle text annotation item.  | 
- class qgis.core.QgsAnnotationRectangleTextItem[source]¶
 Bases:
QgsAnnotationRectItem- __init__(text: str | None, bounds: QgsRectangle)
 Constructor for QgsAnnotationRectangleTextItem, containing the specified
textwithin the specifiedboundsrectangle.- Parameters:
 text (Optional[str])
bounds (QgsRectangle)
- alignment(self) Qt.Alignment[source]¶
 Returns the text’s alignment relative to the
bounds()rectangle.See also
- Return type:
 Qt.Alignment
- static create() QgsAnnotationRectangleTextItem | None[source]¶
 Creates a new rectangle text annotation item.
- Return type:
 Optional[QgsAnnotationRectangleTextItem]
- format(self) QgsTextFormat[source]¶
 Returns the text format used to render the text.
See also
- Return type:
 
- margins(self) QgsMargins¶
 Returns the margins between the outside of the item’s frame and the interior text.
Units are retrieved via
marginsUnit()See also
See also
- Return type:
 
- marginsUnit(self) Qgis.RenderUnit[source]¶
 Returns the units for the margins between the item’s frame and the interior text.
See also
See also
- Return type:
 
- setAlignment(self, alignment: Qt.Alignment | Qt.AlignmentFlag)[source]¶
 Sets the text’s
alignmentrelative to thebounds()rectangle.See also
- Parameters:
 alignment (Union[Qt.Alignment, Qt.AlignmentFlag])
- setFormat(self, format: QgsTextFormat)[source]¶
 Sets the text
formatused to render the text.See also
- Parameters:
 format (QgsTextFormat)
- setMargins(self, margins: QgsMargins)[source]¶
 Sets the
marginsbetween the outside of the item’s frame and the interior text.Units are set via
setMarginsUnit()See also
See also
- Parameters:
 margins (QgsMargins)
- setMarginsUnit(self, unit: Qgis.RenderUnit)[source]¶
 Sets the
unitfor the margins between the item’s frame and the interior text.See also
See also
- Parameters:
 unit (Qgis.RenderUnit)