Skip to content
Permalink
Browse files

Merge pull request #33989 from obrix/fix_33488

Memory layer (and more): Delete field and re-use its name. Fixes #33488
  • Loading branch information
luipir committed Jan 25, 2020
2 parents d453f74 + 2540f0f commit f82932e39a6b497d769140eabcbb0394ca2e7099
@@ -154,7 +154,7 @@ QVariantMap QgsJoinByAttributeAlgorithm::processAlgorithm( const QVariantMap &pa
{
for ( int i = 0; i < outFields2.count(); ++i )
{
outFields2[ i ].setName( prefix + outFields2[ i ].name() );
outFields2.rename( i, prefix + outFields2[ i ].name() );
}
}

@@ -159,7 +159,7 @@ QVariantMap QgsJoinByLocationAlgorithm::processAlgorithm( const QVariantMap &par
{
for ( int i = 0; i < joinFields.count(); ++i )
{
joinFields[ i ].setName( prefix + joinFields[ i ].name() );
joinFields.rename( i, prefix + joinFields[ i ].name() );
}
}

@@ -160,7 +160,7 @@ QVariantMap QgsJoinByNearestAlgorithm::processAlgorithm( const QVariantMap &para
{
for ( int i = 0; i < outFields2.count(); ++i )
{
outFields2[ i ].setName( prefix + outFields2[ i ].name() );
outFields2.rename( i, prefix + outFields2[ i ].name() );
}
}

@@ -90,7 +90,7 @@ QgsFields QgsRenameTableFieldAlgorithm::outputFields( const QgsFields &inputFiel
if ( outFields.lookupField( mNewName ) >= 0 )
throw QgsProcessingException( QObject::tr( "A field already exists with the name %1" ).arg( mNewName ) );

outFields[ index ].setName( mNewName );
outFields.rename( index, mNewName );
return outFields;
}

@@ -512,7 +512,7 @@ bool QgsMemoryProvider::renameAttributes( const QgsFieldNameMap &renamedAttribut
continue;
}

mFields[ fieldIndex ].setName( renameIt.value() );
mFields.rename( fieldIndex, renameIt.value() );
}
return result;
}
@@ -276,7 +276,7 @@ QgsVectorLayerExporter::exportLayer( QgsVectorLayer *layer,
// convert field names to lowercase
for ( int fldIdx = 0; fldIdx < fields.count(); ++fldIdx )
{
fields[fldIdx].setName( fields.at( fldIdx ).name().toLower() );
fields.rename( fldIdx, fields.at( fldIdx ).name().toLower() );
}
}

0 comments on commit f82932e

Please sign in to comment.
You can’t perform that action at this time.