Quantum GIS API Documentation
1.8
|
00001 /*************************************************************************** 00002 qgsformannotationitem.h 00003 ------------------------ 00004 begin : February 9, 2010 00005 copyright : (C) 2010 by Marco Hugentobler 00006 email : marco dot hugentobler at hugis dot net 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef QGSFORMANNOTATIONITEM_H 00019 #define QGSFORMANNOTATIONITEM_H 00020 00021 #include "qgsannotationitem.h" 00022 #include "qgsfeature.h" 00023 #include <QObject> 00024 00025 class QGraphicsProxyWidget; 00026 00028 class GUI_EXPORT QgsFormAnnotationItem: public QObject, public QgsAnnotationItem 00029 { 00030 Q_OBJECT 00031 public: 00032 QgsFormAnnotationItem( QgsMapCanvas* canvas, QgsVectorLayer* vlayer = 0, bool hasFeature = false, int feature = 0 ); 00033 ~QgsFormAnnotationItem(); 00034 00035 void paint( QPainter * painter ); 00036 00038 void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 ); 00039 00040 QSizeF minimumFrameSize() const; 00042 QSizeF preferredFrameSize() const; 00043 00045 void setMapPosition( const QgsPoint& pos ); 00046 00047 void setDesignerForm( const QString& uiFile ); 00048 QString designerForm() const { return mDesignerForm; } 00049 00050 void writeXML( QDomDocument& doc ) const; 00051 void readXML( const QDomDocument& doc, const QDomElement& itemElem ); 00052 00053 QgsVectorLayer* vectorLayer() const { return mVectorLayer; } 00054 00055 private slots: 00057 void setFeatureForMapPosition(); 00059 void updateVisibility(); 00060 00061 private: 00062 QGraphicsProxyWidget* mWidgetContainer; 00063 QWidget* mDesignerWidget; 00065 QgsVectorLayer* mVectorLayer; 00067 bool mHasAssociatedFeature; 00069 QgsFeatureId mFeature; 00071 QString mDesignerForm; 00072 00073 QWidget* createDesignerWidget( const QString& filePath ); 00074 }; 00075 00076 #endif // QGSFORMANNOTATIONITEM_H