QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
qgstextannotation.h
Go to the documentation of this file.
1/***************************************************************************
2 qgstextannotation.h
3 -------------------
4 begin : February 9, 2010
5 copyright : (C) 2010 by Marco Hugentobler
6 email : marco dot hugentobler at hugis dot net
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSTEXTANNOTATION_H
19#define QGSTEXTANNOTATION_H
20
21#include "qgsannotation.h"
22#include <QTextDocument>
23#include "qgis_core.h"
24
31class CORE_EXPORT QgsTextAnnotation: public QgsAnnotation
32{
33 Q_OBJECT
34
35 public:
36
40 QgsTextAnnotation( QObject *parent SIP_TRANSFERTHIS = nullptr );
41
42 QgsTextAnnotation *clone() const override SIP_FACTORY;
43
49 const QTextDocument *document() const;
50
56 void setDocument( const QTextDocument *doc );
57
58 void writeXml( QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
59 void readXml( const QDomElement &itemElem, const QgsReadWriteContext &context ) override;
60
65
66 protected:
67
68 void renderAnnotation( QgsRenderContext &context, QSizeF size ) const override;
69
70 private:
71 std::unique_ptr< QTextDocument > mDocument;
72};
73
74#endif // QGSTEXTANNOTATION_H
Abstract base class for annotation items which are drawn over a map.
Definition: qgsannotation.h:54
virtual void renderAnnotation(QgsRenderContext &context, QSizeF size) const =0
Renders the annotation's contents to a target /a context at the specified /a size.
virtual void readXml(const QDomElement &itemElem, const QgsReadWriteContext &context)=0
Restores the annotation's state from a DOM element.
virtual QgsAnnotation * clone() const =0
Clones the annotation, returning a new copy of the annotation reflecting the annotation's current sta...
virtual void writeXml(QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context) const =0
Writes the annotation state to a DOM element.
The class is used as a container of context for various read/write operations on other objects.
Contains information about the context of a rendering operation.
An annotation item that displays formatted text from a QTextDocument document.
static QgsTextAnnotation * create()
Returns a new QgsTextAnnotation object.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
#define SIP_FACTORY
Definition: qgis_sip.h:76