QGIS API Documentation  3.20.0-Odense (decaadbb31)
Public Member Functions | Static Public Member Functions | List of all members
QgsAnnotationPointTextItem Class Reference

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

#include <qgsannotationpointtextitem.h>

Inheritance diagram for QgsAnnotationPointTextItem:
Inheritance graph
[legend]

Public Member Functions

 QgsAnnotationPointTextItem (const QString &text, QgsPointXY point)
 Constructor for QgsAnnotationPointTextItem, containing the specified text at the specified point. More...
 
 ~QgsAnnotationPointTextItem () override
 
Qt::Alignment alignment () const
 Returns the text's alignment relative to the reference point(). More...
 
double angle () const
 Returns the text's rotation angle, in degrees clockwise. More...
 
QgsRectangle boundingBox () const override
 Returns the bounding box of the item's geographic location, in the parent layer's coordinate reference system. More...
 
QgsAnnotationPointTextItemclone () override
 Returns a clone of the item. More...
 
QgsTextFormat format () const
 Returns the text format used to render the text. More...
 
QgsPointXY point () const
 Returns the point location of the text. More...
 
bool readXml (const QDomElement &element, const QgsReadWriteContext &context) override
 Reads the item's state from the given DOM element. More...
 
void render (QgsRenderContext &context, QgsFeedback *feedback) override
 Renders the item to the specified render context. More...
 
void setAlignment (Qt::Alignment alignment)
 Sets the text's alignment relative to the reference point(). More...
 
void setAngle (double angle)
 Sets the text's rotation angle, in degrees clockwise. More...
 
void setFormat (const QgsTextFormat &format)
 Sets the text format used to render the text. More...
 
void setPoint (QgsPointXY point)
 Sets the point location of the text. More...
 
void setText (const QString &text)
 Sets the text rendered by the item. More...
 
QString text () const
 Returns the text rendered by the item. More...
 
QString type () const override
 Returns a unique (untranslated) string identifying the type of item. More...
 
bool writeXml (QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const override
 Writes the item's state into an XML element. More...
 
- Public Member Functions inherited from QgsAnnotationItem
 QgsAnnotationItem ()=default
 Constructor for an annotation item. More...
 
 QgsAnnotationItem (const QgsAnnotationItem &other)=delete
 QgsAnnotationItem cannot be copied. More...
 
virtual ~QgsAnnotationItem ()=default
 
QgsAnnotationItemoperator= (const QgsAnnotationItem &other)=delete
 QgsAnnotationItem cannot be copied. More...
 
void setZIndex (int index)
 Sets the item's z index, which controls the order in which annotation items are rendered in the layer. More...
 
int zIndex () const
 Returns the item's z index, which controls the order in which annotation items are rendered in the layer. More...
 

Static Public Member Functions

static QgsAnnotationPointTextItemcreate ()
 Creates a new text at point annotation item. More...
 

Detailed Description

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

Since
QGIS 3.16

Definition at line 33 of file qgsannotationpointtextitem.h.

Constructor & Destructor Documentation

◆ QgsAnnotationPointTextItem()

QgsAnnotationPointTextItem::QgsAnnotationPointTextItem ( const QString &  text,
QgsPointXY  point 
)

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

Definition at line 21 of file qgsannotationpointtextitem.cpp.

◆ ~QgsAnnotationPointTextItem()

QgsAnnotationPointTextItem::~QgsAnnotationPointTextItem ( )
overridedefault

Member Function Documentation

◆ alignment()

Qt::Alignment QgsAnnotationPointTextItem::alignment ( ) const

Returns the text's alignment relative to the reference point().

See also
setAlignment().

Definition at line 124 of file qgsannotationpointtextitem.cpp.

◆ angle()

double QgsAnnotationPointTextItem::angle ( ) const
inline

Returns the text's rotation angle, in degrees clockwise.

See also
setAngle()

Definition at line 107 of file qgsannotationpointtextitem.h.

◆ boundingBox()

QgsRectangle QgsAnnotationPointTextItem::boundingBox ( ) const
overridevirtual

Returns the bounding box of the item's geographic location, in the parent layer's coordinate reference system.

Implements QgsAnnotationItem.

Definition at line 109 of file qgsannotationpointtextitem.cpp.

◆ clone()

QgsAnnotationPointTextItem * QgsAnnotationPointTextItem::clone ( )
overridevirtual

Returns a clone of the item.

Ownership is transferred to the caller.

Implements QgsAnnotationItem.

Definition at line 99 of file qgsannotationpointtextitem.cpp.

◆ create()

QgsAnnotationPointTextItem * QgsAnnotationPointTextItem::create ( )
static

Creates a new text at point annotation item.

Definition at line 73 of file qgsannotationpointtextitem.cpp.

◆ format()

QgsTextFormat QgsAnnotationPointTextItem::format ( ) const

Returns the text format used to render the text.

See also
setFormat()

Definition at line 114 of file qgsannotationpointtextitem.cpp.

◆ point()

QgsPointXY QgsAnnotationPointTextItem::point ( ) const
inline

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()

Definition at line 63 of file qgsannotationpointtextitem.h.

◆ readXml()

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

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

Implements QgsAnnotationItem.

Definition at line 78 of file qgsannotationpointtextitem.cpp.

◆ render()

void QgsAnnotationPointTextItem::render ( QgsRenderContext context,
QgsFeedback feedback 
)
overridevirtual

Renders the item to the specified render context.

The feedback argument can be used to detect render cancellations during expensive render operations.

Implements QgsAnnotationItem.

Definition at line 36 of file qgsannotationpointtextitem.cpp.

◆ setAlignment()

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

Sets the text's alignment relative to the reference point().

See also
alignment().

Definition at line 129 of file qgsannotationpointtextitem.cpp.

◆ setAngle()

void QgsAnnotationPointTextItem::setAngle ( double  angle)
inline

Sets the text's rotation angle, in degrees clockwise.

See also
angle()

Definition at line 114 of file qgsannotationpointtextitem.h.

◆ setFormat()

void QgsAnnotationPointTextItem::setFormat ( const QgsTextFormat format)

Sets the text format used to render the text.

See also
format()

Definition at line 119 of file qgsannotationpointtextitem.cpp.

◆ setPoint()

void QgsAnnotationPointTextItem::setPoint ( QgsPointXY  point)
inline

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()

Definition at line 72 of file qgsannotationpointtextitem.h.

◆ setText()

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

Sets the text rendered by the item.

See also
text()

Definition at line 86 of file qgsannotationpointtextitem.h.

◆ text()

QString QgsAnnotationPointTextItem::text ( ) const
inline

Returns the text rendered by the item.

See also
setText()

Definition at line 79 of file qgsannotationpointtextitem.h.

◆ type()

QString QgsAnnotationPointTextItem::type ( ) const
overridevirtual

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

Implements QgsAnnotationItem.

Definition at line 31 of file qgsannotationpointtextitem.cpp.

◆ writeXml()

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

Writes the item's state into an XML element.

Implements QgsAnnotationItem.

Definition at line 57 of file qgsannotationpointtextitem.cpp.


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