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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Oct 7 08:27:38 EDT 2008


Author: jef
Date: 2008-10-07 08:27:38 -0400 (Tue, 07 Oct 2008)
New Revision: 9450

Modified:
   trunk/qgis/src/app/qgsattributedialog.cpp
Log:
fix #1338

Modified: trunk/qgis/src/app/qgsattributedialog.cpp
===================================================================
--- trunk/qgis/src/app/qgsattributedialog.cpp	2008-10-07 07:36:24 UTC (rev 9449)
+++ trunk/qgis/src/app/qgsattributedialog.cpp	2008-10-07 12:27:38 UTC (rev 9450)
@@ -328,11 +328,13 @@
     QString myFieldName = theField.name();
     bool myFlag = false;
     QString myFieldValue;
+    bool modified = true;
 
     QLineEdit *le = dynamic_cast<QLineEdit *>( mpWidgets.value( myIndex ) );
     if ( le )
     {
       myFieldValue = le->text();
+      modified = le->isModified();
     }
 
     QComboBox *cb = dynamic_cast<QComboBox *>( mpWidgets.value( myIndex ) );
@@ -383,10 +385,14 @@
         {
           mpFeature->changeAttribute( it.key(), QVariant( myIntValue ) );
         }
-        else
+        else if ( modified )
         {
           mpFeature->changeAttribute( it.key(), QVariant( QString::null ) );
         }
+        else
+        {
+          mpFeature->changeAttribute( it.key(), myFieldValue );
+        }
       }
       break;
       case QVariant::Double:
@@ -396,10 +402,14 @@
         {
           mpFeature->changeAttribute( it.key(), QVariant( myDblValue ) );
         }
-        else
+        else if ( modified )
         {
           mpFeature->changeAttribute( it.key(), QVariant( QString::null ) );
         }
+        else
+        {
+          mpFeature->changeAttribute( it.key(), myFieldValue );
+        }
       }
       break;
       default: //string



More information about the QGIS-commit mailing list