Skip to content

Commit

Permalink
Less autos more consts
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Jun 10, 2019
1 parent a295701 commit a45a82e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/fieldformatter/qgsvaluerelationfieldformatter.cpp
Expand Up @@ -276,13 +276,14 @@ bool QgsValueRelationFieldFormatter::expressionIsUsable( const QString &expressi

QgsVectorLayer *QgsValueRelationFieldFormatter::resolveLayer( const QVariantMap &config )
{
auto layer { QgsProject::instance()->mapLayer<QgsVectorLayer *>( config.value( QStringLiteral( "Layer" ) ).toString() ) };
QgsVectorLayer *layer { QgsProject::instance()->mapLayer<QgsVectorLayer *>( config.value( QStringLiteral( "Layer" ) ).toString() ) };
if ( ! layer )
{
const auto name { config.value( QStringLiteral( "LayerName" ) ).toString() };
if ( ! name.isEmpty() )
{
for ( QgsMapLayer *l : QgsProject::instance()->mapLayers( true ) )
const auto constLayers { QgsProject::instance()->mapLayers( true ) };
for ( QgsMapLayer *l : constLayers )
{
QgsVectorLayer *vl { qobject_cast<QgsVectorLayer *>( l ) };
if ( vl && vl->name() == name )
Expand Down

0 comments on commit a45a82e

Please sign in to comment.