File tree 1 file changed +22
-2
lines changed
1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -4490,14 +4490,34 @@ void QgisApp::editPaste( QgsMapLayer *destinationLayer )
4490
4490
if ( pasteVectorLayer != 0 )
4491
4491
{
4492
4492
pasteVectorLayer->beginEditCommand ( tr ( " Features pasted" ) );
4493
+ QgsFeatureList features;
4493
4494
if ( mMapCanvas ->mapRenderer ()->hasCrsTransformEnabled () )
4494
4495
{
4495
- pasteVectorLayer-> addFeatures ( clipboard ()->transformedCopyOf ( pasteVectorLayer->srs () ) );
4496
+ features = clipboard ()->transformedCopyOf ( pasteVectorLayer->srs () );
4496
4497
}
4497
4498
else
4498
4499
{
4499
- pasteVectorLayer-> addFeatures ( clipboard ()->copyOf () );
4500
+ features = clipboard ()->copyOf ();
4500
4501
}
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 );
4501
4521
pasteVectorLayer->endEditCommand ();
4502
4522
mMapCanvas ->refresh ();
4503
4523
}
You can’t perform that action at this time.
0 commit comments