Skip to content

Commit

Permalink
QgisInterface::getFeatureForm() returns a QgsAttributeDialog
Browse files Browse the repository at this point in the history
And some API comments
  • Loading branch information
m-kuhn committed Aug 18, 2014
1 parent 8105545 commit 4ade943
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion python/gui/qgisinterface.sip
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisappinterface.cpp
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisappinterface.h
Expand Up @@ -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.
Expand Down
29 changes: 28 additions & 1 deletion src/gui/qgisinterface.h
Expand Up @@ -25,6 +25,7 @@ class QDockWidget;
class QMainWindow;
class QWidget;

class QgsAttributeDialog;
class QgsComposerView;
class QgsFeature;
class QgsLayerTreeView;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4ade943

Please sign in to comment.