Skip to content
Permalink
Browse files

Set form feature in current_feature variable instead of

... setting the feature member variable
  • Loading branch information
elpaso committed May 15, 2018
1 parent 55a1984 commit 4033cc2ebd411767adacfc61946c6294aa7a8519
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/core/qgsexpressioncontext.cpp
@@ -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();
@@ -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;
}

0 comments on commit 4033cc2

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