QGIS API Documentation 3.39.0-Master (7b5d8bea57d)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
QgsAnnotationRectangleTextItem Class Reference

An annotation item which renders paragraphs of text within a rectangle. More...

#include <qgsannotationrectangletextitem.h>

Inheritance diagram for QgsAnnotationRectangleTextItem:
Inheritance graph
[legend]

Public Member Functions

 QgsAnnotationRectangleTextItem (const QString &text, const QgsRectangle &bounds)
 Constructor for QgsAnnotationRectangleTextItem, containing the specified text within the specified bounds rectangle.
 
 ~QgsAnnotationRectangleTextItem () override
 
Qt::Alignment alignment () const
 Returns the text's alignment relative to the bounds() rectangle.
 
QgsAnnotationRectangleTextItemclone () const override
 Returns a clone of the item.
 
Qgis::AnnotationItemFlags flags () const override
 Returns item flags.
 
QgsTextFormat format () const
 Returns the text format used to render the text.
 
const QgsMarginsmargins () const
 Returns the margins between the outside of the item's frame and the interior text.
 
Qgis::RenderUnit marginsUnit () const
 Returns the units for the margins between the item's frame and the interior text.
 
bool readXml (const QDomElement &element, const QgsReadWriteContext &context) override
 Reads the item's state from the given DOM element.
 
void setAlignment (Qt::Alignment alignment)
 Sets the text's alignment relative to the bounds() rectangle.
 
void setFormat (const QgsTextFormat &format)
 Sets the text format used to render the text.
 
void setMargins (const QgsMargins &margins)
 Sets the margins between the outside of the item's frame and the interior text.
 
void setMarginsUnit (Qgis::RenderUnit unit)
 Sets the unit for the margins between the item's frame and the interior text.
 
void setText (const QString &text)
 Sets the text rendered by the item.
 
QString text () const
 Returns the text rendered by the item.
 
QString type () const override
 Returns a unique (untranslated) string identifying the type of item.
 
bool writeXml (QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const override
 Writes the item's state into an XML element.
 
- Public Member Functions inherited from QgsAnnotationRectItem
 QgsAnnotationRectItem (const QgsRectangle &bounds)
 Constructor for QgsAnnotationRectItem, rendering the annotation within the specified bounds geometry.
 
 ~QgsAnnotationRectItem () override
 
Qgis::AnnotationItemEditOperationResult applyEditV2 (QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context) override
 Applies an edit operation to the item.
 
bool backgroundEnabled () const
 Returns true if the item's background should be rendered.
 
const QgsFillSymbolbackgroundSymbol () const
 Returns the symbol used to render the item's background.
 
QgsRectangle boundingBox () const override
 Returns the bounding box of the item's geographic location, in the parent layer's coordinate reference system.
 
QgsRectangle boundingBox (QgsRenderContext &context) const override
 Returns the bounding box of the item's geographic location, in the parent layer's coordinate reference system.
 
QgsRectangle bounds () const
 Returns the bounds of the item.
 
QSizeF fixedSize () const
 Returns the fixed size to use for the item, when the placementMode() is Qgis::AnnotationPlacementMode::FixedSize.
 
Qgis::RenderUnit fixedSizeUnit () const
 Returns the units to use for fixed item sizes, when the placementMode() is Qgis::AnnotationPlacementMode::FixedSize.
 
Qgis::AnnotationItemFlags flags () const override
 Returns item flags.
 
bool frameEnabled () const
 Returns true if the item's frame should be rendered.
 
const QgsFillSymbolframeSymbol () const
 Returns the symbol used to render the item's frame.
 
QList< QgsAnnotationItemNodenodesV2 (const QgsAnnotationItemEditContext &context) const override
 Returns the nodes for the item, used for editing the item.
 
Qgis::AnnotationPlacementMode placementMode () const
 Returns the placement mode for the item.
 
void render (QgsRenderContext &context, QgsFeedback *feedback) override
 Renders the item to the specified render context.
 
void setBackgroundEnabled (bool enabled)
 Sets whether the item's background should be rendered.
 
void setBackgroundSymbol (QgsFillSymbol *symbol)
 Sets the symbol used to render the item's background.
 
void setBounds (const QgsRectangle &bounds)
 Sets the bounds of the item.
 
void setFixedSize (const QSizeF &size)
 Sets the fixed size to use for the item, when the placementMode() is Qgis::AnnotationPlacementMode::FixedSize.
 
void setFixedSizeUnit (Qgis::RenderUnit unit)
 Sets the unit to use for fixed item sizes, when the placementMode() is Qgis::AnnotationPlacementMode::FixedSize.
 
void setFrameEnabled (bool enabled)
 Sets whether the item's frame should be rendered.
 
void setFrameSymbol (QgsFillSymbol *symbol)
 Sets the symbol used to render the item's frame.
 
void setPlacementMode (Qgis::AnnotationPlacementMode mode)
 Sets the placement mode for the item.
 
QgsAnnotationItemEditOperationTransientResultstransientEditResultsV2 (QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context) override
 Retrieves the results of a transient (in progress) edit operation on the item.
 
- Public Member Functions inherited from QgsAnnotationItem
 QgsAnnotationItem ()
 
 QgsAnnotationItem (const QgsAnnotationItem &other)=delete
 
virtual ~QgsAnnotationItem ()
 
virtual Q_DECL_DEPRECATED Qgis::AnnotationItemEditOperationResult applyEdit (QgsAbstractAnnotationItemEditOperation *operation)
 Applies an edit operation to the item.
 
QgsCalloutcallout () const
 Returns the item's callout renderer, responsible for drawing item callouts.
 
QgsGeometry calloutAnchor () const
 Returns the callout's anchor geometry.
 
bool enabled () const
 Returns true if the item is enabled and will be rendered in the layer.
 
virtual Q_DECL_DEPRECATED QList< QgsAnnotationItemNodenodes () const
 Returns the nodes for the item, used for editing the item.
 
QSizeF offsetFromCallout () const
 Returns the (optional) offset of the annotation item from the calloutAnchor().
 
Qgis::RenderUnit offsetFromCalloutUnit () const
 Returns the units for the offsetFromCallout().
 
QgsAnnotationItemoperator= (const QgsAnnotationItem &other)=delete
 
void setCallout (QgsCallout *callout)
 Sets the item's callout renderer, responsible for drawing item callouts.
 
void setCalloutAnchor (const QgsGeometry &anchor)
 Sets the callout's anchor geometry.
 
void setEnabled (bool enabled)
 Sets if the item will be rendered or not in the layer.
 
void setOffsetFromCallout (const QSizeF &offset)
 Sets the offset of the annotation item from the calloutAnchor().
 
void setOffsetFromCalloutUnit (Qgis::RenderUnit unit)
 Sets the unit for the offsetFromCallout().
 
void setSymbologyReferenceScale (double scale)
 Sets the annotation's symbology reference scale.
 
void setUseSymbologyReferenceScale (bool enabled)
 Sets whether the annotation item uses a symbology reference scale.
 
void setZIndex (int index)
 Sets the item's z index, which controls the order in which annotation items are rendered in the layer.
 
double symbologyReferenceScale () const
 Returns the annotation's symbology reference scale.
 
virtual Q_DECL_DEPRECATED QgsAnnotationItemEditOperationTransientResultstransientEditResults (QgsAbstractAnnotationItemEditOperation *operation)
 Retrieves the results of a transient (in progress) edit operation on the item.
 
bool useSymbologyReferenceScale () const
 Returns true if the annotation item uses a symbology reference scale.
 
int zIndex () const
 Returns the item's z index, which controls the order in which annotation items are rendered in the layer.
 

Static Public Member Functions

static QgsAnnotationRectangleTextItemcreate ()
 Creates a new rectangle text annotation item.
 

Protected Member Functions

void renderInBounds (QgsRenderContext &context, const QRectF &painterBounds, QgsFeedback *feedback) override
 Renders the item to the specified render context.
 
- Protected Member Functions inherited from QgsAnnotationRectItem
void copyCommonProperties (const QgsAnnotationItem *other) override
 Copies common properties from the base class from an other item.
 
bool readCommonProperties (const QDomElement &element, const QgsReadWriteContext &context) override
 Reads common properties from the base class from the given DOM element.
 
bool writeCommonProperties (QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const override
 Writes common properties from the base class into an XML element.
 
- Protected Member Functions inherited from QgsAnnotationItem
void renderCallout (QgsRenderContext &context, const QRectF &rect, double angle, QgsCallout::QgsCalloutContext &calloutContext, QgsFeedback *feedback)
 Renders the item's callout.
 

Detailed Description

An annotation item which renders paragraphs of text within a rectangle.

Since
QGIS 3.40

Definition at line 33 of file qgsannotationrectangletextitem.h.

Constructor & Destructor Documentation

◆ QgsAnnotationRectangleTextItem()

QgsAnnotationRectangleTextItem::QgsAnnotationRectangleTextItem ( const QString &  text,
const QgsRectangle bounds 
)

Constructor for QgsAnnotationRectangleTextItem, containing the specified text within the specified bounds rectangle.

Definition at line 27 of file qgsannotationrectangletextitem.cpp.

◆ ~QgsAnnotationRectangleTextItem()

QgsAnnotationRectangleTextItem::~QgsAnnotationRectangleTextItem ( )
overridedefault

Member Function Documentation

◆ alignment()

Qt::Alignment QgsAnnotationRectangleTextItem::alignment ( ) const

Returns the text's alignment relative to the bounds() rectangle.

See also
setAlignment().

Definition at line 149 of file qgsannotationrectangletextitem.cpp.

◆ clone()

QgsAnnotationRectangleTextItem * QgsAnnotationRectangleTextItem::clone ( ) const
overridevirtual

Returns a clone of the item.

Ownership is transferred to the caller.

Implementations should include a call to copyCommonProperties() to copy the base class properties.

See also
copyCommonProperties()

Implements QgsAnnotationItem.

Definition at line 109 of file qgsannotationrectangletextitem.cpp.

◆ create()

QgsAnnotationRectangleTextItem * QgsAnnotationRectangleTextItem::create ( )
static

Creates a new rectangle text annotation item.

Definition at line 83 of file qgsannotationrectangletextitem.cpp.

◆ flags()

Qgis::AnnotationItemFlags QgsAnnotationRectangleTextItem::flags ( ) const
overridevirtual

Returns item flags.

Since
QGIS 3.22

Reimplemented from QgsAnnotationItem.

Definition at line 123 of file qgsannotationrectangletextitem.cpp.

◆ format()

QgsTextFormat QgsAnnotationRectangleTextItem::format ( ) const

Returns the text format used to render the text.

See also
setFormat()

Definition at line 139 of file qgsannotationrectangletextitem.cpp.

◆ margins()

const QgsMargins & QgsAnnotationRectangleTextItem::margins ( ) const
inline

Returns the margins between the outside of the item's frame and the interior text.

Units are retrieved via marginsUnit()

See also
setMargins()
marginsUnit()

Definition at line 106 of file qgsannotationrectangletextitem.h.

◆ marginsUnit()

Qgis::RenderUnit QgsAnnotationRectangleTextItem::marginsUnit ( ) const
inline

Returns the units for the margins between the item's frame and the interior text.

See also
setMarginsUnit()
margins()

Definition at line 132 of file qgsannotationrectangletextitem.h.

◆ readXml()

bool QgsAnnotationRectangleTextItem::readXml ( const QDomElement &  element,
const QgsReadWriteContext context 
)
overridevirtual

Reads the item's state from the given DOM element.

Implementations should include a call to readCommonProperties() to read the base class properties.

See also
writeXml()
readCommonProperties()

Implements QgsAnnotationItem.

Definition at line 88 of file qgsannotationrectangletextitem.cpp.

◆ renderInBounds()

void QgsAnnotationRectangleTextItem::renderInBounds ( QgsRenderContext context,
const QRectF &  painterRect,
QgsFeedback feedback 
)
overrideprotectedvirtual

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.

Implements QgsAnnotationRectItem.

Definition at line 42 of file qgsannotationrectangletextitem.cpp.

◆ setAlignment()

void QgsAnnotationRectangleTextItem::setAlignment ( Qt::Alignment  alignment)

Sets the text's alignment relative to the bounds() rectangle.

See also
alignment().

Definition at line 154 of file qgsannotationrectangletextitem.cpp.

◆ setFormat()

void QgsAnnotationRectangleTextItem::setFormat ( const QgsTextFormat format)

Sets the text format used to render the text.

See also
format()

Definition at line 144 of file qgsannotationrectangletextitem.cpp.

◆ setMargins()

void QgsAnnotationRectangleTextItem::setMargins ( const QgsMargins margins)
inline

Sets the margins between the outside of the item's frame and the interior text.

Units are set via setMarginsUnit()

See also
margins()
setMarginsUnit()

Definition at line 116 of file qgsannotationrectangletextitem.h.

◆ setMarginsUnit()

void QgsAnnotationRectangleTextItem::setMarginsUnit ( Qgis::RenderUnit  unit)
inline

Sets the unit for the margins between the item's frame and the interior text.

See also
margins()
marginsUnit()

Definition at line 124 of file qgsannotationrectangletextitem.h.

◆ setText()

void QgsAnnotationRectangleTextItem::setText ( const QString &  text)
inline

Sets the text rendered by the item.

See also
text()

Definition at line 68 of file qgsannotationrectangletextitem.h.

◆ text()

QString QgsAnnotationRectangleTextItem::text ( ) const
inline

Returns the text rendered by the item.

See also
setText()

Definition at line 61 of file qgsannotationrectangletextitem.h.

◆ type()

QString QgsAnnotationRectangleTextItem::type ( ) const
overridevirtual

Returns a unique (untranslated) string identifying the type of item.

Implements QgsAnnotationItem.

Definition at line 37 of file qgsannotationrectangletextitem.cpp.

◆ writeXml()

bool QgsAnnotationRectangleTextItem::writeXml ( QDomElement &  element,
QDomDocument &  document,
const QgsReadWriteContext context 
) const
overridevirtual

Writes the item's state into an XML element.

Implementations should include a call to writeCommonProperties() to store the base class properties.

See also
readXml()
writeCommonProperties()

Implements QgsAnnotationItem.

Definition at line 67 of file qgsannotationrectangletextitem.cpp.


The documentation for this class was generated from the following files: