Skip to content

Commit

Permalink
Set form feature in current_feature variable instead of
Browse files Browse the repository at this point in the history
... setting the feature member variable
  • Loading branch information
elpaso committed May 15, 2018
1 parent 55a1984 commit 4033cc2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/qgsexpressioncontext.cpp
Expand Up @@ -747,7 +747,7 @@ class GetCurrentFormFieldValue : public QgsScopedExpressionFunction
QVariant func( const QVariantList &values, const QgsExpressionContext *context, QgsExpression *, const QgsExpressionNodeFunction * ) override
{
QString fieldName( values.at( 0 ).toString() );
const QgsFeature feat( context->feature() );
const QgsFeature feat( context->variable( QStringLiteral( "current_feature" ) ).value<QgsFeature>() );
if ( fieldName.isEmpty() || ! feat.isValid( ) )
{
return QVariant();
Expand Down Expand Up @@ -793,9 +793,9 @@ class GetProcessingParameterValue : public QgsScopedExpressionFunction
QgsExpressionContextScope *QgsExpressionContextUtils::formScope( const QgsFeature &formFeature )
{
QgsExpressionContextScope *scope = new QgsExpressionContextScope( QObject::tr( "Form" ) );
scope->setFeature( formFeature );
scope->addFunction( QStringLiteral( "current_value" ), new GetCurrentFormFieldValue( ) );
scope->setVariable( QStringLiteral( "current_geometry" ), formFeature.geometry( ), true );
scope->setVariable( QStringLiteral( "current_feature" ), formFeature, true );
return scope;
}

Expand Down

0 comments on commit 4033cc2

Please sign in to comment.