Skip to content

Commit

Permalink
Add all 'single value' input/output types as expression variables
Browse files Browse the repository at this point in the history
Since expressions can be written which convert string values
to numeric, and vice versa, it doesn't make sense to restrict
creation of expression variables to only numeric inputs/outputs.
Instead create variables for all sensible inputs/outputs, since
users may want to use these in expressions which convert the
output to a number....
  • Loading branch information
nyalldawson committed Jul 7, 2017
1 parent ac51ae1 commit d6cbf30
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/core/processing/qgsprocessingmodelalgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,9 +673,14 @@ QMap<QString, QgsProcessingModelAlgorithm::VariableDefinition> QgsProcessingMode
return s.replace( QRegularExpression( "[\\s'\"\\(\\):]" ), QStringLiteral( "_" ) );
};

// numeric sources
ChildParameterSources sources = availableSourcesForChild( childId, QStringList() << QgsProcessingParameterNumber::typeName(),
QStringList() << QgsProcessingOutputNumber::typeName() );
// "static"/single value sources
ChildParameterSources sources = availableSourcesForChild( childId, QStringList() << QgsProcessingParameterNumber::typeName()
<< QgsProcessingParameterBoolean::typeName()
<< QgsProcessingParameterExpression::typeName()
<< QgsProcessingParameterField::typeName()
<< QgsProcessingParameterString::typeName(),
QStringList() << QgsProcessingOutputNumber::typeName()
<< QgsProcessingOutputString::typeName() );
Q_FOREACH ( const ChildParameterSource &source, sources )
{
QString name;
Expand Down

0 comments on commit d6cbf30

Please sign in to comment.