Skip to content
Permalink
Browse files

Add all 'single value' input/output types as expression variables

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 d6cbf30cc4115cf40084bfe60c3139564a57428a
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/core/processing/qgsprocessingmodelalgorithm.cpp
@@ -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;

0 comments on commit d6cbf30

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