Skip to content

Commit

Permalink
use toMap to convert to attributeMap
Browse files Browse the repository at this point in the history
(cherry-picked from 4ac0631)
  • Loading branch information
signedav committed Nov 8, 2018
1 parent 672b994 commit bd6478e
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/core/qgsvectorlayerutils.cpp
Expand Up @@ -464,15 +464,7 @@ QgsFeature QgsVectorLayerUtils::duplicateFeature( QgsVectorLayer *layer, const Q
QgsExpressionContext context = layer->createExpressionContext();
context.setFeature( feature );

//create the attribute map
QgsAttributes srcAttr = feature.attributes();
QgsAttributeMap dstAttr;
for ( int src = 0; src < srcAttr.count(); ++src )
{
dstAttr[ src ] = srcAttr.at( src );
}

QgsFeature newFeature = createFeature( layer, feature.geometry(), dstAttr, &context );
QgsFeature newFeature = createFeature( layer, feature.geometry(), feature.attributes().toMap(), &context );

const QList<QgsRelation> relations = project->relationManager()->referencedRelations( layer );

Expand Down

0 comments on commit bd6478e

Please sign in to comment.