QgsHtmlAnnotation class

An annotation item that embeds HTML content.

Base classes

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

Public static functions

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

Constructors, destructors, conversion operators

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

Public functions

auto clone() const -> QgsHtmlAnnotation* override
Clones the annotation, returning a new copy of the annotation reflecting the annotation's current state.
auto minimumFrameSize() const -> QSizeF override
Returns the minimum frame size for the annotation.
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 setSourceFile(const QString& htmlFile)
Sets the file path for the source HTML file.
auto sourceFile() const -> QString
Returns the file path for the source HTML file.
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

QSizeF QgsHtmlAnnotation::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 QgsHtmlAnnotation::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 QgsHtmlAnnotation::setAssociatedFeature(const QgsFeature& feature) override

Sets the feature associated with the annotation.

void QgsHtmlAnnotation::setSourceFile(const QString& htmlFile)

Sets the file path for the source HTML file.

QString QgsHtmlAnnotation::sourceFile() const

Returns the file path for the source HTML file.

void QgsHtmlAnnotation::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 QgsHtmlAnnotation::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.