Quantum GIS API Documentation  1.7.4
src/gui/qgsformannotationitem.h
Go to the documentation of this file.
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 <QObject>
00023 
00024 class QGraphicsProxyWidget;
00025 
00027 class GUI_EXPORT QgsFormAnnotationItem: public QObject, public QgsAnnotationItem
00028 {
00029     Q_OBJECT
00030   public:
00031     QgsFormAnnotationItem( QgsMapCanvas* canvas, QgsVectorLayer* vlayer = 0, bool hasFeature = false, int feature = 0 );
00032     ~QgsFormAnnotationItem();
00033 
00034     void paint( QPainter * painter );
00035 
00037     void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );
00038 
00039     QSizeF minimumFrameSize() const;
00041     QSizeF preferredFrameSize() const;
00042 
00044     void setMapPosition( const QgsPoint& pos );
00045 
00046     void setDesignerForm( const QString& uiFile );
00047     QString designerForm() const { return mDesignerForm; }
00048 
00049     void writeXML( QDomDocument& doc ) const;
00050     void readXML( const QDomDocument& doc, const QDomElement& itemElem );
00051 
00052     QgsVectorLayer* vectorLayer() const { return mVectorLayer; }
00053 
00054   private slots:
00056     void setFeatureForMapPosition();
00058     void updateVisibility();
00059 
00060   private:
00061     QGraphicsProxyWidget* mWidgetContainer;
00062     QWidget* mDesignerWidget;
00064     QgsVectorLayer* mVectorLayer;
00066     bool mHasAssociatedFeature;
00068     int mFeature;
00070     QString mDesignerForm;
00071 
00072     QWidget* createDesignerWidget( const QString& filePath );
00073 };
00074 
00075 #endif // QGSFORMANNOTATIONITEM_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines