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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Aug 25 04:22:55 EDT 2009


Author: mhugent
Date: 2009-08-25 04:22:54 -0400 (Tue, 25 Aug 2009)
New Revision: 11497

Modified:
   trunk/qgis/src/app/qgsmergeattributesdialog.cpp
Log:
Fix for bug 1892, Merge tool (Postgis features) results in shifted attribute positions

Modified: trunk/qgis/src/app/qgsmergeattributesdialog.cpp
===================================================================
--- trunk/qgis/src/app/qgsmergeattributesdialog.cpp	2009-08-24 19:51:50 UTC (rev 11496)
+++ trunk/qgis/src/app/qgsmergeattributesdialog.cpp	2009-08-25 08:22:54 UTC (rev 11497)
@@ -514,17 +514,20 @@
   }
 
   resultMap = mFeatureList[0].attributeMap();
-  //go through all the items and replace the values in the attribute map
-  for ( int i = 0; i < resultMap.size(); ++i )
+  int index = 0;
+  QgsAttributeMap::iterator it = resultMap.begin();
+
+  for ( ; it != resultMap.end(); ++it )
   {
-    QTableWidgetItem* currentItem = mTableWidget->item( mFeatureList.size() + 1, i );
+    QTableWidgetItem* currentItem = mTableWidget->item( mFeatureList.size() + 1, index );
     if ( !currentItem )
     {
       continue;
     }
     QString mergedString = currentItem->text();
     QVariant newValue( mergedString );
-    resultMap.insert( i, newValue );
+    resultMap.insert( it.key(), newValue );
+    ++index;
   }
 
   return resultMap;



More information about the QGIS-commit mailing list