QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 
33 class GUI_EXPORT QgsFormAnnotation: public QgsAnnotation
34 {
35  Q_OBJECT
36  public:
37 
41  QgsFormAnnotation( QObject *parent SIP_TRANSFERTHIS = nullptr );
42 
43  QgsFormAnnotation *clone() const override SIP_FACTORY;
44 
45  QSizeF minimumFrameSize() const override;
47  QSizeF preferredFrameSize() const;
48 
53  void setDesignerForm( const QString &uiFile );
54 
59  QString designerForm() const { return mDesignerForm; }
60 
61  void writeXml( QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
62  void readXml( const QDomElement &itemElem, const QgsReadWriteContext &context ) override;
63 
64  void setAssociatedFeature( const QgsFeature &feature ) override;
65 
70 
71  protected:
72 
73  void renderAnnotation( QgsRenderContext &context, QSizeF size ) const override;
74 
75  private:
76 
77  std::unique_ptr<QWidget> mDesignerWidget;
78  QSize mMinimumSize;
80  QString mDesignerForm;
81 
82  QWidget *createDesignerWidget( const QString &filePath );
83 };
84 
85 #endif // QGSFORMANNOTATION_H
QgsAnnotation::writeXml
virtual void writeXml(QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context) const =0
Writes the annotation state to a DOM element.
QgsReadWriteContext
Definition: qgsreadwritecontext.h:34
qgsannotation.h
QgsFormAnnotation::designerForm
QString designerForm() const
Returns the path to the Qt Designer UI file to show in the annotation.
Definition: qgsformannotation.h:59
QgsAnnotation::readXml
virtual void readXml(const QDomElement &itemElem, const QgsReadWriteContext &context)=0
Restores the annotation's state from a DOM element.
qgsfeature.h
QgsRenderContext
Definition: qgsrendercontext.h:57
QgsFormAnnotation
Definition: qgsformannotation.h:33
QgsAnnotation::renderAnnotation
virtual void renderAnnotation(QgsRenderContext &context, QSizeF size) const =0
Renders the annotation's contents to a target /a context at the specified /a size.
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsFormAnnotation::create
static QgsFormAnnotation * create()
Returns a new QgsFormAnnotation object.
Definition: qgsformannotation.h:69
QgsAnnotation
Abstract base class for annotation items which are drawn over a map.
Definition: qgsannotation.h:49
QgsAnnotation::clone
virtual QgsAnnotation * clone() const =0
Clones the annotation, returning a new copy of the annotation reflecting the annotation's current sta...
qgis_sip.h
QgsAnnotation::setAssociatedFeature
virtual void setAssociatedFeature(const QgsFeature &feature)
Sets the feature associated with the annotation.
Definition: qgsannotation.cpp:180
QgsAnnotation::minimumFrameSize
virtual QSizeF minimumFrameSize() const
Returns the minimum frame size for the annotation.
Definition: qgsannotation.cpp:211
QgsFeature
Definition: qgsfeature.h:55
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53