Skip to content

Commit

Permalink
Merge pull request #33989 from obrix/fix_33488
Browse files Browse the repository at this point in the history
Memory layer (and more): Delete field and re-use its name. Fixes #33488
  • Loading branch information
luipir authored and obrix committed Jan 27, 2020
1 parent e9cc765 commit 054b86f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/analysis/processing/qgsalgorithmjoinbyattribute.cpp
Expand Up @@ -154,7 +154,7 @@ QVariantMap QgsJoinByAttributeAlgorithm::processAlgorithm( const QVariantMap &pa
{ {
for ( int i = 0; i < outFields2.count(); ++i ) for ( int i = 0; i < outFields2.count(); ++i )
{ {
outFields2[ i ].setName( prefix + outFields2[ i ].name() ); outFields2.rename( i, prefix + outFields2[ i ].name() );
} }
} }


Expand Down
2 changes: 1 addition & 1 deletion src/analysis/processing/qgsalgorithmjoinbynearest.cpp
Expand Up @@ -160,7 +160,7 @@ QVariantMap QgsJoinByNearestAlgorithm::processAlgorithm( const QVariantMap &para
{ {
for ( int i = 0; i < outFields2.count(); ++i ) for ( int i = 0; i < outFields2.count(); ++i )
{ {
outFields2[ i ].setName( prefix + outFields2[ i ].name() ); outFields2.rename( i, prefix + outFields2[ i ].name() );
} }
} }


Expand Down
2 changes: 1 addition & 1 deletion src/core/providers/memory/qgsmemoryprovider.cpp
Expand Up @@ -512,7 +512,7 @@ bool QgsMemoryProvider::renameAttributes( const QgsFieldNameMap &renamedAttribut
continue; continue;
} }


mFields[ fieldIndex ].setName( renameIt.value() ); mFields.rename( fieldIndex, renameIt.value() );
} }
return result; return result;
} }
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayerexporter.cpp
Expand Up @@ -276,7 +276,7 @@ QgsVectorLayerExporter::exportLayer( QgsVectorLayer *layer,
// convert field names to lowercase // convert field names to lowercase
for ( int fldIdx = 0; fldIdx < fields.count(); ++fldIdx ) for ( int fldIdx = 0; fldIdx < fields.count(); ++fldIdx )
{ {
fields[fldIdx].setName( fields.at( fldIdx ).name().toLower() ); fields.rename( fldIdx, fields.at( fldIdx ).name().toLower() );
} }
} }


Expand Down

0 comments on commit 054b86f

Please sign in to comment.