QgsSvgAnnotation class

An annotation which renders the contents of an SVG file.

Base classes

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

Public static functions

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

Constructors, destructors, conversion operators

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

Public functions

auto clone() const -> QgsSvgAnnotation* override
Clones the annotation, returning a new copy of the annotation reflecting the annotation's current state.
auto filePath() const -> QString
Returns the file path for the source SVG file.
void readXml(const QDomElement& itemElem, const QgsReadWriteContext& context) override
Restores the annotation's state from a DOM element.
void setFilePath(const QString& file)
Sets the file path for the source SVG 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

QString QgsSvgAnnotation::filePath() const

Returns the file path for the source SVG file.

void QgsSvgAnnotation::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 QgsSvgAnnotation::setFilePath(const QString& file)

Sets the file path for the source SVG file.

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