QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
qgshtmlannotationitem.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgshtmlannotationitem.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 QGSHTMLANNOTATIONITEM_H
19 #define QGSHTMLANNOTATIONITEM_H
20 
21 #include "qgsannotationitem.h"
22 #include "qgsfeature.h"
23 #include <QObject>
24 #include <QWebView>
25 #include <QWebFrame>
26 
27 class QGraphicsProxyWidget;
28 
30 class GUI_EXPORT QgsHtmlAnnotationItem: public QObject, public QgsAnnotationItem
31 {
32  Q_OBJECT
33  public:
34  QgsHtmlAnnotationItem( QgsMapCanvas* canvas, QgsVectorLayer* vlayer = 0, bool hasFeature = false, int feature = 0 );
36 
37  void paint( QPainter * painter );
38 
40  void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );
41 
42  QSizeF minimumFrameSize() const;
43 
45  void setMapPosition( const QgsPoint& pos );
46 
47  void setHTMLPage( const QString& htmlFile );
48  QString htmlPage() const { return mHtmlFile; }
49 
50  void writeXML( QDomDocument& doc ) const;
51  void readXML( const QDomDocument& doc, const QDomElement& itemElem );
52 
53  QgsVectorLayer* vectorLayer() const { return mVectorLayer; }
54 
55  private slots:
57  void setFeatureForMapPosition();
59  void updateVisibility();
60 
61  void javascript();
62 
63  private:
64  QGraphicsProxyWidget* mWidgetContainer;
65  QWebView* mWebView;
67  QgsVectorLayer* mVectorLayer;
69  bool mHasAssociatedFeature;
71  QgsFeatureId mFeatureId;
72  QgsFeature mFeature;
73  QString mHtmlFile;
74  QString mHtmlSource;
75 
76  QString replaceText( QString displayText, QgsVectorLayer *layer, QgsFeature &feat );
77 };
78 
79 #endif // QGSHTMLANNOTATIONITEM_H
virtual QSizeF minimumFrameSize() const
Definition: qgsannotationitem.cpp:97
QgsVectorLayer * vectorLayer() const
Definition: qgshtmlannotationitem.h:53
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:113
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:104
An annotation item that embedds a designer form showing the feature attribute.
Definition: qgshtmlannotationitem.h:30
virtual void setMapPosition(const QgsPoint &pos)
Definition: qgsannotationitem.cpp:48
A class to represent a point geometry.
Definition: qgspoint.h:63
An annotation item can be either placed either on screen corrdinates or on map coordinates.
Definition: qgsannotationitem.h:31
virtual void paint(QPainter *painter)=0
function to be implemented by derived classes
virtual void readXML(const QDomDocument &doc, const QDomElement &itemElem)=0
QString htmlPage() const
Definition: qgshtmlannotationitem.h:48
qint64 QgsFeatureId
Definition: qgsfeature.h:30
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:470
virtual void writeXML(QDomDocument &doc) const =0