diff --git a/python/gui/qgisinterface.sip b/python/gui/qgisinterface.sip index a3f4155c0c1..f2e624ef144 100644 --- a/python/gui/qgisinterface.sip +++ b/python/gui/qgisinterface.sip @@ -517,7 +517,7 @@ class QgisInterface : QObject */ virtual bool openFeatureForm( QgsVectorLayer *l, QgsFeature &f, bool updateFeatureOnly = false ) = 0; - virtual QDialog* getFeatureForm( QgsVectorLayer *l, QgsFeature &f ) = 0; + virtual QgsAttributeDialog* getFeatureForm( QgsVectorLayer *l, QgsFeature &f ) = 0; virtual QgsVectorLayerTools* vectorLayerTools() = 0; diff --git a/src/app/qgisappinterface.cpp b/src/app/qgisappinterface.cpp index c4e1d091c6e..b363b83d34c 100644 --- a/src/app/qgisappinterface.cpp +++ b/src/app/qgisappinterface.cpp @@ -619,7 +619,7 @@ void QgisAppInterface::cacheloadForm( QString uifile ) } } -QDialog* QgisAppInterface::getFeatureForm( QgsVectorLayer *l, QgsFeature &feature ) +QgsAttributeDialog* QgisAppInterface::getFeatureForm( QgsVectorLayer *l, QgsFeature &feature ) { QgsDistanceArea myDa; diff --git a/src/app/qgisappinterface.h b/src/app/qgisappinterface.h index 57d3afca503..69dd776ef52 100644 --- a/src/app/qgisappinterface.h +++ b/src/app/qgisappinterface.h @@ -450,7 +450,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface * * @return A feature form */ - virtual QDialog* getFeatureForm( QgsVectorLayer *layer, QgsFeature &feature ); + virtual QgsAttributeDialog* getFeatureForm( QgsVectorLayer *layer, QgsFeature &feature ); /** * Access the vector layer tools instance. diff --git a/src/gui/qgisinterface.h b/src/gui/qgisinterface.h index ffa0a36b557..40a6bd26e74 100644 --- a/src/gui/qgisinterface.h +++ b/src/gui/qgisinterface.h @@ -25,6 +25,7 @@ class QDockWidget; class QMainWindow; class QWidget; +class QgsAttributeDialog; class QgsComposerView; class QgsFeature; class QgsLayerTreeView; @@ -571,10 +572,36 @@ class GUI_EXPORT QgisInterface : public QObject */ virtual bool openFeatureForm( QgsVectorLayer *l, QgsFeature &f, bool updateFeatureOnly = false ) = 0; - virtual QDialog* getFeatureForm( QgsVectorLayer *l, QgsFeature &f ) = 0; + /** + * Returns a feature form for a given feature + * + * @param layer The layer for which the dialog will be created + * @param feature The feature for which the dialog will be created + * + * @return A feature form + */ + virtual QgsAttributeDialog* getFeatureForm( QgsVectorLayer *l, QgsFeature &f ) = 0; + /** + * Access the vector layer tools instance. + * With the help of this you can access methods like addFeature, startEditing + * or stopEditing while giving the user the appropriate dialogs. + * + * @return An instance of the vector layer tools + */ virtual QgsVectorLayerTools* vectorLayerTools() = 0; + /** This method is only needed when using a UI form with a custom widget plugin and calling + * openFeatureForm or getFeatureForm from Python (PyQt4) and you havn't used the info tool first. + * Python will crash bringing QGIS wtih it + * if the custom form is not loaded from a C++ method call. + * + * This method uses a QTimer to call QUiLoader in order to load the form via C++ + * you only need to call this once after that you can call openFeatureForm/getFeatureForm + * like normal + * + * More information here: http://qt-project.org/forums/viewthread/27098/ + */ virtual void preloadForm( QString uifile ) = 0; /** Return vector layers in edit mode