Fix encoding choice is ignored in Add Vector Layer dialog

This commit is contained in:
Nyall Dawson 2023-03-01 11:33:49 +10:00
parent 3c91c624c8
commit b650fbd92b

View File

@ -394,12 +394,6 @@ QList< QgsMapLayer * > QgsAppLayerHandling::addOgrVectorLayers( const QStringLis
QgsProject::instance()->addMapLayers( layersToAdd );
for ( QgsMapLayer *l : std::as_const( layersToAdd ) )
{
if ( !encoding.isEmpty() )
{
if ( QgsVectorLayer *vl = qobject_cast< QgsVectorLayer * >( l ) )
vl->setProviderEncoding( encoding );
}
QgisApp::instance()->askUserForDatumTransform( l->crs(), QgsProject::instance()->crs(), l );
QgsAppLayerHandling::postProcessAddedLayer( l );
}
@ -407,6 +401,16 @@ QList< QgsMapLayer * > QgsAppLayerHandling::addOgrVectorLayers( const QStringLis
ok = true;
addedLayers.append( layersToAdd );
for ( QgsMapLayer *l : std::as_const( addedLayers ) )
{
if ( !encoding.isEmpty() )
{
if ( QgsVectorLayer *vl = qobject_cast< QgsVectorLayer * >( l ) )
vl->setProviderEncoding( encoding );
}
}
return addedLayers;
}