QgsFormAnnotation class

An annotation item that embeds a designer form showing the feature attribute.

Base classes

class QgsAnnotation
Abstract base class for annotation items which are drawn over a map.

Public static functions

static auto create() -> QgsFormAnnotation*
Returns a new QgsFormAnnotation object.

Constructors, destructors, conversion operators

QgsFormAnnotation(QObject* parent = nullptr)
Constructor for QgsFormAnnotation.

Public functions

auto clone() const -> QgsFormAnnotation* override
Clones the annotation, returning a new copy of the annotation reflecting the annotation's current state.
auto designerForm() const -> QString
Returns the path to the Qt Designer UI file to show in the annotation.
auto minimumFrameSize() const -> QSizeF override
Returns the minimum frame size for the annotation.
auto preferredFrameSize() const -> QSizeF
Returns the optimal frame size.
void readXml(const QDomElement& itemElem, const QgsReadWriteContext& context) override
Restores the annotation's state from a DOM element.
void setAssociatedFeature(const QgsFeature& feature) override
Sets the feature associated with the annotation.
void setDesignerForm(const QString& uiFile)
Sets the path to the Qt Designer UI file to show in the annotation.
void writeXml(QDomElement& elem, QDomDocument& doc, const QgsReadWriteContext& context) const override
Writes the annotation state to a DOM element.

Protected functions

void renderAnnotation(QgsRenderContext& context, QSizeF size) const override
Renders the annotation's contents to a target /a context at the specified /a size.

Function documentation

QString QgsFormAnnotation::designerForm() const

Returns the path to the Qt Designer UI file to show in the annotation.

QSizeF QgsFormAnnotation::minimumFrameSize() const override

Returns the minimum frame size for the annotation.

Subclasses should implement this if they cannot be resized smaller than a certain minimum size.

void QgsFormAnnotation::readXml(const QDomElement& itemElem, const QgsReadWriteContext& context) override

Restores the annotation's state from a DOM element.

Derived classes should call _readXml() within their implementation of this method.

void QgsFormAnnotation::setAssociatedFeature(const QgsFeature& feature) override

Sets the feature associated with the annotation.

void QgsFormAnnotation::setDesignerForm(const QString& uiFile)

Sets the path to the Qt Designer UI file to show in the annotation.

void QgsFormAnnotation::writeXml(QDomElement& elem, QDomDocument& doc, const QgsReadWriteContext& context) const override

Writes the annotation state to a DOM element.

Derived classes should call _writeXml() within their implementation of this method.

void QgsFormAnnotation::renderAnnotation(QgsRenderContext& context, QSizeF size) const override protected

Renders the annotation's contents to a target /a context at the specified /a size.

Derived classes should implement their custom annotation drawing logic here.