QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgshtmlannotation.h
Go to the documentation of this file.
1/***************************************************************************
2 qgshtmlannotation.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 QGSHTMLANNOTATION_H
19#define QGSHTMLANNOTATION_H
20
21#include "qgis_core.h"
22#include "qgsannotation.h"
23#include "qgsfeature.h"
24
25class QgsWebPage;
26
32
33class CORE_EXPORT QgsHtmlAnnotation: public QgsAnnotation
34{
35 Q_OBJECT
36 public:
37
41 QgsHtmlAnnotation( QObject *parent SIP_TRANSFERTHIS = nullptr );
42
43 QgsHtmlAnnotation *clone() const override SIP_FACTORY;
44
45 QSizeF minimumFrameSize() const override;
46
51 void setSourceFile( const QString &htmlFile );
52
57 QString sourceFile() const { return mHtmlFile; }
58
63 void setHtmlSource( const QString &htmlSource );
64
68 QString htmlSource() const { return mHtmlSource; }
69
70 void writeXml( QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
71 void readXml( const QDomElement &itemElem, const QgsReadWriteContext &context ) override;
72
73 void setAssociatedFeature( const QgsFeature &feature ) override;
74
79
80 protected:
81
82 void renderAnnotation( QgsRenderContext &context, QSizeF size ) const override;
83
84 private slots:
85
86 void javascript();
87
88 private:
89 QgsWebPage *mWebPage = nullptr;
90 QString mHtmlFile;
91 QString mHtmlSource;
92
93};
94
95#endif // QGSHTMLANNOTATION_H
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 setAssociatedFeature(const QgsFeature &feature)
Sets the feature associated with the annotation.
virtual QSizeF minimumFrameSize() const
Returns the minimum frame size for the annotation.
virtual void readXml(const QDomElement &itemElem, const QgsReadWriteContext &context)=0
Restores the annotation's state from a DOM element.
QgsAnnotation(QObject *parent=nullptr)
Constructor for QgsAnnotation.
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 feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:58
static QgsHtmlAnnotation * create()
Returns a new QgsHtmlAnnotation object.
QString htmlSource() const
Returns html source text.
QgsHtmlAnnotation(QObject *parent=nullptr)
Constructor for QgsHtmlAnnotation.
void setSourceFile(const QString &htmlFile)
Sets the file path for the source HTML file.
QString sourceFile() const
Returns the file path for the source HTML file.
A container for the context for various read/write operations on objects.
Contains information about the context of a rendering operation.
QWebPage subclass which redirects JavaScript errors and console output to the QGIS message log.
Definition qgswebpage.h:218
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_FACTORY
Definition qgis_sip.h:84