Skip to content
Permalink
Browse files
implement #3015
git-svn-id: http://svn.osgeo.org/qgis/trunk@14243 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Sep 17, 2010
1 parent 6d350ff commit cb1e739909ba0041e01955bbef0c3528a898bb51
Showing with 37 additions and 0 deletions.
  1. +26 −0 src/app/qgisappinterface.cpp
  2. +5 −0 src/app/qgisappinterface.h
  3. +6 −0 src/gui/qgisinterface.h
@@ -29,6 +29,9 @@
#include "qgsmapcanvas.h"
#include "qgslegend.h"
#include "qgsshortcutsmanager.h"
#include "qgsattributedialog.h"
#include "qgsfield.h"
#include "qgsvectordataprovider.h"

QgisAppInterface::QgisAppInterface( QgisApp * _qgis )
: qgis( _qgis ),
@@ -352,3 +355,26 @@ QAction *QgisAppInterface::actionQgisHomePage() { return qgis->actionQgisHomePag
QAction *QgisAppInterface::actionCheckQgisVersion() { return qgis->actionCheckQgisVersion(); }
QAction *QgisAppInterface::actionHelpSeparator2() { return qgis->actionHelpSeparator2(); }
QAction *QgisAppInterface::actionAbout() { return qgis->actionAbout(); }

bool QgisAppInterface::openFeatureForm( QgsVectorLayer *vlayer, QgsFeature &f )
{
if ( !vlayer )
return false;

QgsVectorDataProvider *dp = vlayer->dataProvider();
if ( dp )
{
// add the fields to the QgsFeature
const QgsFieldMap fields = vlayer->pendingFields();
for ( QgsFieldMap::const_iterator it = fields.constBegin(); it != fields.constEnd(); ++it )
{
if ( !f.attributeMap().contains( it.key() ) )
f.addAttribute( it.key(), dp->defaultValue( it.key() ) );
}
}

QgsAttributeDialog *mypDialog = new QgsAttributeDialog( vlayer, &f );
bool res = mypDialog->exec();
delete mypDialog;
return res;
}
@@ -262,6 +262,11 @@ class QgisAppInterface : public QgisInterface
virtual QAction *actionHelpSeparator2();
virtual QAction *actionAbout();

//! open feature form
// returns true when dialog was accepted
// @added in 1.6
virtual bool openFeatureForm( QgsVectorLayer *l, QgsFeature &f );

signals:
void currentThemeChanged( QString );

@@ -37,6 +37,7 @@ class QgsMapCanvas;
class QgsRasterLayer;
class QgsVectorLayer;
class QgsLegendInterface;
class QgsFeature;

/** \ingroup gui
* QgisInterface
@@ -302,6 +303,11 @@ class GUI_EXPORT QgisInterface : public QObject
virtual QAction *actionHelpSeparator2() = 0;
virtual QAction *actionAbout() = 0;

//! Open feature form
// returns true when dialog was accepted
// @added in 1.6
virtual bool openFeatureForm( QgsVectorLayer *vlayer, QgsFeature &f ) = 0;

signals:
/** Emited whenever current (selected) layer changes.
* The pointer to layer can be null if no layer is selected

0 comments on commit cb1e739

Please sign in to comment.