Skip to content

Commit 49dc996

Browse files
author
jef
committed
fix #2819
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13808 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent f9c984e commit 49dc996

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/app/qgisapp.cpp

+22-2
Original file line numberDiff line numberDiff line change
@@ -4490,14 +4490,34 @@ void QgisApp::editPaste( QgsMapLayer *destinationLayer )
44904490
if ( pasteVectorLayer != 0 )
44914491
{
44924492
pasteVectorLayer->beginEditCommand( tr( "Features pasted" ) );
4493+
QgsFeatureList features;
44934494
if ( mMapCanvas->mapRenderer()->hasCrsTransformEnabled() )
44944495
{
4495-
pasteVectorLayer->addFeatures( clipboard()->transformedCopyOf( pasteVectorLayer->srs() ) );
4496+
features = clipboard()->transformedCopyOf( pasteVectorLayer->srs() );
44964497
}
44974498
else
44984499
{
4499-
pasteVectorLayer->addFeatures( clipboard()->copyOf() );
4500+
features = clipboard()->copyOf();
45004501
}
4502+
4503+
QgsAttributeList dstAttr = pasteVectorLayer->pendingAllAttributesList();
4504+
4505+
for ( int i = 0; i < features.size(); i++ )
4506+
{
4507+
QgsFeature &f = features[i];
4508+
QgsAttributeMap srcMap = f.attributeMap();
4509+
QgsAttributeMap dstMap;
4510+
4511+
int j = 0;
4512+
foreach( int id, srcMap.keys() )
4513+
{
4514+
dstMap[ dstAttr[j++] ] = srcMap[id];
4515+
}
4516+
4517+
f.setAttributeMap( dstMap );
4518+
}
4519+
4520+
pasteVectorLayer->addFeatures( features );
45014521
pasteVectorLayer->endEditCommand();
45024522
mMapCanvas->refresh();
45034523
}

0 commit comments

Comments
 (0)