Class: QgsAnnotationRectItem¶
Abstract base class for annotation items which render annotations in a rectangular shape.
Subclasses should implement the pure virtual render()
method
which takes a painter bounds argument.
Added in version 3.40.
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: QgsAnnotationItem.clone()
, QgsAnnotationItem.readXml()
, renderInBounds()
, QgsAnnotationItem.type()
, QgsAnnotationItem.writeXml()
Class Hierarchy¶
Base classes¶
Abstract base class for annotation items which are drawn with |
Subclasses¶
An annotation item which renders a picture. |
|
An annotation item which renders paragraphs of text within a rectangle. |
Abstract Methods
Renders the item to the specified render context. |
Methods
Returns |
|
Returns the symbol used to render the item's background. |
|
Returns the bounds of the item. |
|
Returns the fixed size to use for the item, when the |
|
Returns the units to use for fixed item sizes, when the |
|
Returns |
|
Returns the symbol used to render the item's frame. |
|
Returns the placement mode for the item. |
|
Sets whether the item's background should be rendered. |
|
Sets the symbol used to render the item's background. |
|
Sets the bounds of the item. |
|
Sets the fixed size to use for the item, when the |
|
Sets the unit to use for fixed item sizes, when the |
|
Sets whether the item's frame should be rendered. |
|
Sets the symbol used to render the item's frame. |
|
Sets the placement mode for the item. |
- class qgis.core.QgsAnnotationRectItem[source]¶
Bases:
QgsAnnotationItem
- __init__(bounds: QgsRectangle)
Constructor for QgsAnnotationRectItem, rendering the annotation within the specified
bounds
geometry.- Parameters:
bounds (QgsRectangle)
- backgroundEnabled(self) bool [source]¶
Returns
True
if the item’s background should be rendered.See also
See also
- Return type:
bool
- backgroundSymbol(self) QgsFillSymbol | None [source]¶
Returns the symbol used to render the item’s background.
See also
See also
- Return type:
Optional[QgsFillSymbol]
- bounds(self) QgsRectangle [source]¶
Returns the bounds of the item.
The coordinate reference system for the item will be the parent layer’s
QgsAnnotationLayer.crs()
.When the
placementMode()
isQgis
.AnnotationPlacementMode.FixedSize then the item will be placed at the center of the bounds.See also
- Return type:
- fixedSize(self) QSizeF [source]¶
Returns the fixed size to use for the item, when the
placementMode()
isQgis
.AnnotationPlacementMode.FixedSize.Units are retrieved via
fixedSizeUnit()
See also
See also
- Return type:
QSizeF
- fixedSizeUnit(self) Qgis.RenderUnit [source]¶
Returns the units to use for fixed item sizes, when the
placementMode()
isQgis
.AnnotationPlacementMode.FixedSize.See also
See also
- Return type:
- frameEnabled(self) bool [source]¶
Returns
True
if the item’s frame should be rendered.See also
See also
- Return type:
bool
- frameSymbol(self) QgsFillSymbol | None [source]¶
Returns the symbol used to render the item’s frame.
See also
See also
- Return type:
Optional[QgsFillSymbol]
- placementMode(self) Qgis.AnnotationPlacementMode [source]¶
Returns the placement mode for the item.
See also
- Return type:
- abstract renderInBounds(self, context: QgsRenderContext, painterRect: QRectF, feedback: QgsFeedback | None)[source]¶
Renders the item to the specified render
context
.The
painterRect
argument specifies the bounds in painter units where the rectangular item should be rendered within.The
feedback
argument can be used to detect render cancellations during expensive render operations.- Parameters:
context (QgsRenderContext)
painterRect (QRectF)
feedback (Optional[QgsFeedback])
- setBackgroundEnabled(self, enabled: bool)[source]¶
Sets whether the item’s background should be rendered.
See also
See also
- Parameters:
enabled (bool)
- setBackgroundSymbol(self, symbol: QgsFillSymbol | None)[source]¶
Sets the
symbol
used to render the item’s background.The item takes ownership of the symbol.
See also
See also
- Parameters:
symbol (Optional[QgsFillSymbol])
- setBounds(self, bounds: QgsRectangle)[source]¶
Sets the
bounds
of the item.The coordinate reference system for the bounds will be the parent layer’s
QgsAnnotationLayer.crs()
.When the
placementMode()
isQgis
.AnnotationPlacementMode.FixedSize then the item will be placed at the center of the bounds.See also
- Parameters:
bounds (QgsRectangle)
- setFixedSize(self, size: QSizeF)[source]¶
Sets the fixed
size
to use for the item, when theplacementMode()
isQgis
.AnnotationPlacementMode.FixedSize.Units are set via
setFixedSizeUnit()
See also
See also
- Parameters:
size (QSizeF)
- setFixedSizeUnit(self, unit: Qgis.RenderUnit)[source]¶
Sets the
unit
to use for fixed item sizes, when theplacementMode()
isQgis
.AnnotationPlacementMode.FixedSize.See also
See also
- Parameters:
unit (Qgis.RenderUnit)
- setFrameEnabled(self, enabled: bool)[source]¶
Sets whether the item’s frame should be rendered.
See also
See also
- Parameters:
enabled (bool)
- setFrameSymbol(self, symbol: QgsFillSymbol | None)[source]¶
Sets the
symbol
used to render the item’s frame.The item takes ownership of the symbol.
See also
See also
- Parameters:
symbol (Optional[QgsFillSymbol])
- setPlacementMode(self, mode: Qgis.AnnotationPlacementMode)[source]¶
Sets the placement
mode
for the item.See also
- Parameters:
mode (Qgis.AnnotationPlacementMode)