QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
qgsformannotation.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsformannotation.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 QGSFORMANNOTATION_H
19#define QGSFORMANNOTATION_H
20
21#include "qgsannotation.h"
22#include "qgis_sip.h"
23#include "qgsfeature.h"
24#include <QWidget>
25#include "qgis_gui.h"
26
32class GUI_EXPORT QgsFormAnnotation: public QgsAnnotation
33{
34 Q_OBJECT
35 public:
36
40 QgsFormAnnotation( QObject *parent SIP_TRANSFERTHIS = nullptr );
41
42 QgsFormAnnotation *clone() const override SIP_FACTORY;
43
44 QSizeF minimumFrameSize() const override;
46 QSizeF preferredFrameSize() const;
47
52 void setDesignerForm( const QString &uiFile );
53
58 QString designerForm() const { return mDesignerForm; }
59
60 void writeXml( QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
61 void readXml( const QDomElement &itemElem, const QgsReadWriteContext &context ) override;
62
63 void setAssociatedFeature( const QgsFeature &feature ) override;
64
69
70 protected:
71
72 void renderAnnotation( QgsRenderContext &context, QSizeF size ) const override;
73
74 private:
75
76 std::unique_ptr<QWidget> mDesignerWidget;
77 QSize mMinimumSize;
79 QString mDesignerForm;
80
81 QWidget *createDesignerWidget( const QString &filePath );
82};
83
84#endif // QGSFORMANNOTATION_H
Abstract base class for annotation items which are drawn over a map.
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.
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
An annotation item that embeds a designer form showing the feature attribute.
static QgsFormAnnotation * create()
Returns a new QgsFormAnnotation object.
QString designerForm() const
Returns the path to the Qt Designer UI file to show in the annotation.
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.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_FACTORY
Definition qgis_sip.h:76