Skip to content

Commit 61604a3

Browse files
author
mhugent
committed
Fix for bug 1892, Merge tool (Postgis features) results in shifted attribute positions
git-svn-id: http://svn.osgeo.org/qgis/trunk@11497 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 92333ed commit 61604a3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/app/qgsmergeattributesdialog.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -514,17 +514,20 @@ QgsAttributeMap QgsMergeAttributesDialog::mergedAttributesMap() const
514514
}
515515

516516
resultMap = mFeatureList[0].attributeMap();
517-
//go through all the items and replace the values in the attribute map
518-
for ( int i = 0; i < resultMap.size(); ++i )
517+
int index = 0;
518+
QgsAttributeMap::iterator it = resultMap.begin();
519+
520+
for ( ; it != resultMap.end(); ++it )
519521
{
520-
QTableWidgetItem* currentItem = mTableWidget->item( mFeatureList.size() + 1, i );
522+
QTableWidgetItem* currentItem = mTableWidget->item( mFeatureList.size() + 1, index );
521523
if ( !currentItem )
522524
{
523525
continue;
524526
}
525527
QString mergedString = currentItem->text();
526528
QVariant newValue( mergedString );
527-
resultMap.insert( i, newValue );
529+
resultMap.insert( it.key(), newValue );
530+
++index;
528531
}
529532

530533
return resultMap;

0 commit comments

Comments
 (0)