[QGIS Commit] r13046 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Mar 11 05:58:52 EST 2010


Author: mhugent
Date: 2010-03-11 05:58:47 -0500 (Thu, 11 Mar 2010)
New Revision: 13046

Modified:
   trunk/qgis/src/app/qgsfieldcalculator.cpp
Log:
Change default behaviour of field calculator dialog (fixes ticket #2542)

Modified: trunk/qgis/src/app/qgsfieldcalculator.cpp
===================================================================
--- trunk/qgis/src/app/qgsfieldcalculator.cpp	2010-03-11 10:26:50 UTC (rev 13045)
+++ trunk/qgis/src/app/qgsfieldcalculator.cpp	2010-03-11 10:58:47 UTC (rev 13046)
@@ -24,6 +24,11 @@
 {
   setupUi( this );
 
+  if ( !vl )
+  {
+    return;
+  }
+
   populateFields();
   populateOutputFieldTypes();
 
@@ -31,19 +36,25 @@
   mOuputFieldWidthSpinBox->setValue( 10 );
   mOutputFieldPrecisionSpinBox->setValue( 3 );
 
-  mUpdateExistingFieldCheckBox->setCheckState( Qt::Checked );
 
+
   //disable ok button until there is text for output field and expression
   mButtonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
 
   // disable creation of new fields if not supported by data provider
   if ( !( vl->dataProvider()->capabilities() & QgsVectorDataProvider::AddAttributes ) )
   {
+    mUpdateExistingFieldCheckBox->setCheckState( Qt::Checked );
     mUpdateExistingFieldCheckBox->setEnabled( false ); // must stay checked
     mNewFieldGroupBox->setEnabled( false );
     mNewFieldGroupBox->setTitle( mNewFieldGroupBox->title() + tr( " (not supported by provider)" ) );
   }
 
+  if ( vl->selectedFeaturesIds().size() > 0 )
+  {
+    mOnlyUpdateSelectedCheckBox->setChecked( true );
+  }
+
   if ( vl->geometryType() != QGis::Polygon )
   {
     mAreaButton->setEnabled( false );



More information about the QGIS-commit mailing list