Skip to content
Permalink
Browse files

use QVariant::fromValue as suggested in review

  • Loading branch information
luipir committed Jul 21, 2018
1 parent 5a3b319 commit 3a67c5d287ccca382928ef263de98041f14c5729
Showing with 1 addition and 3 deletions.
  1. +1 −3 src/core/processing/models/qgsprocessingmodelalgorithm.cpp
@@ -531,9 +531,7 @@ QMap<QString, QgsProcessingModelAlgorithm::VariableDefinition> QgsProcessingMode
if ( !layer )
layer = QgsProcessingUtils::mapLayerFromString( value.toString(), context );

// TODO: should I tag variable name with type? e.g. %1_maplayer
variables.insert( safeName( QStringLiteral( "%1" ).arg( name ) ), VariableDefinition( value, source, description ) );

variables.insert( safeName( QStringLiteral( "%1" ).arg( name ) ), VariableDefinition( QVariant::fromValue( layer ), source, description ) );
variables.insert( safeName( QStringLiteral( "%1_minx" ).arg( name ) ), VariableDefinition( layer ? layer->extent().xMinimum() : QVariant(), source, QObject::tr( "Minimum X of %1" ).arg( description ) ) );
variables.insert( safeName( QStringLiteral( "%1_miny" ).arg( name ) ), VariableDefinition( layer ? layer->extent().yMinimum() : QVariant(), source, QObject::tr( "Minimum Y of %1" ).arg( description ) ) );
variables.insert( safeName( QStringLiteral( "%1_maxx" ).arg( name ) ), VariableDefinition( layer ? layer->extent().xMaximum() : QVariant(), source, QObject::tr( "Maximum X of %1" ).arg( description ) ) );

0 comments on commit 3a67c5d

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