Skip to content

Commit c78e91e

Browse files
author
mhugent
committed
apply patch 1498
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9995 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent f87e45e commit c78e91e

File tree

3 files changed

+96
-115
lines changed

3 files changed

+96
-115
lines changed

src/app/qgsmaptooladdfeature.cpp

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "qgslogger.h"
2929
#include <QMessageBox>
3030
#include <QMouseEvent>
31+
#include <QSettings>
3132

3233
QgsMapToolAddFeature::QgsMapToolAddFeature( QgsMapCanvas* canvas, enum CaptureTool tool ): QgsMapToolCapture( canvas, tool )
3334
{
@@ -175,18 +176,28 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
175176
}
176177

177178
// show the dialog to enter attribute values
178-
QgsAttributeDialog * mypDialog = new QgsAttributeDialog( vlayer, f );
179-
if ( mypDialog->exec() )
179+
QSettings settings;
180+
bool isDisabledAttributeValuesDlg = settings.value( "/qgis/digitizing/disable_enter_attribute_values_dialog", false ).toBool();
181+
if ( isDisabledAttributeValuesDlg )
180182
{
181183
qDebug( "Adding feature to layer" );
182184
vlayer->addFeature( *f );
183185
}
184186
else
185187
{
186-
qDebug( "Adding feature to layer failed" );
187-
delete f;
188+
QgsAttributeDialog * mypDialog = new QgsAttributeDialog( vlayer, f );
189+
if ( mypDialog->exec() )
190+
{
191+
qDebug( "Adding feature to layer" );
192+
vlayer->addFeature( *f );
193+
}
194+
else
195+
{
196+
qDebug( "Adding feature to layer failed" );
197+
delete f;
198+
}
199+
delete mypDialog;
188200
}
189-
delete mypDialog;
190201
mCanvas->refresh();
191202
}
192203

@@ -444,21 +455,38 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
444455
f->addAttribute( it.key(), provider->defaultValue( it.key() ) );
445456
}
446457

447-
QgsAttributeDialog * mypDialog = new QgsAttributeDialog( vlayer, f );
448-
if ( mypDialog->exec() )
458+
QSettings settings;
459+
bool isDisabledAttributeValuesDlg = settings.value( "/qgis/digitizing/disable_enter_attribute_values_dialog", false ).toBool();
460+
if ( isDisabledAttributeValuesDlg )
449461
{
450462
if ( vlayer->addFeature( *f ) )
463+
{
464+
//add points to other features to keep topology up-to-date
465+
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
466+
if ( topologicalEditing )
467+
{
468+
vlayer->addTopologicalPoints( f->geometry() );
469+
}
470+
}
471+
}
472+
else
473+
{
474+
QgsAttributeDialog * mypDialog = new QgsAttributeDialog( vlayer, f );
475+
if ( mypDialog->exec() )
451476
{
452-
//add points to other features to keep topology up-to-date
453-
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
454-
if ( topologicalEditing )
477+
if ( vlayer->addFeature( *f ) )
455478
{
456-
vlayer->addTopologicalPoints( f->geometry() );
479+
//add points to other features to keep topology up-to-date
480+
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
481+
if ( topologicalEditing )
482+
{
483+
vlayer->addTopologicalPoints( f->geometry() );
484+
}
457485
}
458486
}
487+
delete mypDialog;
459488
}
460489
delete f;
461-
delete mypDialog;
462490

463491
delete mRubberBand;
464492
mRubberBand = NULL;

src/app/qgsoptions.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
205205
mMarkerStyleComboBox->setCurrentIndex( mMarkerStyleComboBox->findText( tr( "Cross" ) ) );
206206
}
207207

208+
chkDisableAttributeValuesDlg->setChecked( settings.value( "/qgis/digitizing/disable_enter_attribute_values_dialog", false ).toBool() );
209+
208210
#ifdef Q_WS_MAC //MH: disable incremental update on Mac for now to avoid problems with resizing
209211
groupBox_5->setEnabled( false );
210212
#endif //Q_WS_MAC
@@ -363,6 +365,8 @@ void QgsOptions::saveOptions()
363365
settings.setValue( "/qgis/digitizing/marker_style", "Cross" );
364366
}
365367

368+
settings.setValue( "/qgis/digitizing/disable_enter_attribute_values_dialog", chkDisableAttributeValuesDlg->isChecked() );
369+
366370
//
367371
// Locale settings
368372
//

0 commit comments

Comments
 (0)