[QGIS Commit] r14369 - trunk/qgis/src/app
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Mon Oct 11 11:55:58 EDT 2010
Author: mhugent
Date: 2010-10-11 08:55:57 -0700 (Mon, 11 Oct 2010)
New Revision: 14369
Modified:
trunk/qgis/src/app/qgsfieldcalculator.cpp
Log:
Field calculator: insert NULL feature value in case of calculation error (instead of stopping and reverting calculation for all features)
Modified: trunk/qgis/src/app/qgsfieldcalculator.cpp
===================================================================
--- trunk/qgis/src/app/qgsfieldcalculator.cpp 2010-10-11 13:34:51 UTC (rev 14368)
+++ trunk/qgis/src/app/qgsfieldcalculator.cpp 2010-10-11 15:55:57 UTC (rev 14369)
@@ -145,7 +145,6 @@
//go through all the features and change the new attribute
QgsFeature feature;
- bool calculationSuccess = true;
bool onlySelected = ( mOnlyUpdateSelectedCheckBox->checkState() == Qt::Checked );
QgsFeatureIds selectedIds = mVectorLayer->selectedFeaturesIds();
@@ -173,10 +172,10 @@
searchTree->getValue( value, searchTree, mVectorLayer->pendingFields(), feature );
if ( value.isError() )
{
- calculationSuccess = false;
- break;
+ //insert NULL value for this feature and continue the calculation
+ mVectorLayer->changeAttributeValue( feature.id(), attributeId, QVariant(), false );
}
- if ( value.isNumeric() )
+ else if ( value.isNumeric() )
{
mVectorLayer->changeAttributeValue( feature.id(), attributeId, value.number(), false );
}
@@ -191,18 +190,6 @@
// stop blocking layerModified signals and make sure that one layerModified signal is emitted
mVectorLayer->blockSignals( false );
mVectorLayer->setModified( true, false );
-
-
- if ( !calculationSuccess )
- {
- QMessageBox::critical( 0, tr( "Error" ), tr( "An error occured while evaluating the calculation string." ) );
-
- //remove new attribute
- mVectorLayer->deleteAttribute( attributeId );
- mVectorLayer->destroyEditCommand();
- return;
- }
-
mVectorLayer->endEditCommand();
}
QDialog::accept();
More information about the QGIS-commit
mailing list