Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 <QObject>
23 
24 class QGraphicsProxyWidget;
25 
27 class GUI_EXPORT QgsFormAnnotationItem: public QObject, public QgsAnnotationItem
28 {
29  Q_OBJECT
30  public:
31  QgsFormAnnotationItem( QgsMapCanvas* canvas, QgsVectorLayer* vlayer = 0, bool hasFeature = false, int feature = 0 );
33 
34  void paint( QPainter * painter );
35 
37  void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );
38 
39  QSizeF minimumFrameSize() const;
41  QSizeF preferredFrameSize() const;
42 
44  void setMapPosition( const QgsPoint& pos );
45 
46  void setDesignerForm( const QString& uiFile );
47  QString designerForm() const { return mDesignerForm; }
48 
49  void writeXML( QDomDocument& doc ) const;
50  void readXML( const QDomDocument& doc, const QDomElement& itemElem );
51 
52  QgsVectorLayer* vectorLayer() const { return mVectorLayer; }
53 
54  private slots:
56  void setFeatureForMapPosition();
58  void updateVisibility();
59 
60  private:
61  QGraphicsProxyWidget* mWidgetContainer;
62  QWidget* mDesignerWidget;
68  int mFeature;
70  QString mDesignerForm;
71 
72  QWidget* createDesignerWidget( const QString& filePath );
73 };
74 
75 #endif // QGSFORMANNOTATIONITEM_H