QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsformannotationitem.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsformannotationitem.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 QGSFORMANNOTATIONITEM_H
19 #define QGSFORMANNOTATIONITEM_H
20 
21 #include "qgsannotationitem.h"
22 #include "qgsfeature.h"
23 #include <QObject>
24 
25 class QGraphicsProxyWidget;
26 
28 class GUI_EXPORT QgsFormAnnotationItem: public QObject, public QgsAnnotationItem
29 {
30  Q_OBJECT
31  public:
32  QgsFormAnnotationItem( QgsMapCanvas* canvas, QgsVectorLayer* vlayer = 0, bool hasFeature = false, int feature = 0 );
34 
35  void paint( QPainter * painter );
36 
38  void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );
39 
40  QSizeF minimumFrameSize() const;
42  QSizeF preferredFrameSize() const;
43 
45  void setMapPosition( const QgsPoint& pos );
46 
47  void setDesignerForm( const QString& uiFile );
48  QString designerForm() const { return mDesignerForm; }
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  private:
62  QGraphicsProxyWidget* mWidgetContainer;
63  QWidget* mDesignerWidget;
71  QString mDesignerForm;
72 
73  QWidget* createDesignerWidget( const QString& filePath );
74 };
75 
76 #endif // QGSFORMANNOTATIONITEM_H
virtual QSizeF minimumFrameSize() const
QgsVectorLayer * vectorLayer() const
An annotation item that embedds a designer form showing the feature attribute.
QGraphicsProxyWidget * mWidgetContainer
QgsFeatureId mFeature
Associated feature.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:104
QgsVectorLayer * mVectorLayer
Associated vectorlayer (or 0 if attributes are not supposed to be replaced)
virtual void setMapPosition(const QgsPoint &pos)
bool mHasAssociatedFeature
True if the item is related to a vector feature.
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.
virtual void paint(QPainter *painter)=0
function to be implemented by derived classes
virtual void readXML(const QDomDocument &doc, const QDomElement &itemElem)=0
QString mDesignerForm
Path to (and including) the .ui file.
qint64 QgsFeatureId
Definition: qgsfeature.h:30
Represents a vector layer which manages a vector based data sets.
QString designerForm() const
virtual void writeXML(QDomDocument &doc) const =0