Skip to content

Commit 4033cc2

Browse files
committed
Set form feature in current_feature variable instead of
... setting the feature member variable
1 parent 55a1984 commit 4033cc2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/core/qgsexpressioncontext.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ class GetCurrentFormFieldValue : public QgsScopedExpressionFunction
747747
QVariant func( const QVariantList &values, const QgsExpressionContext *context, QgsExpression *, const QgsExpressionNodeFunction * ) override
748748
{
749749
QString fieldName( values.at( 0 ).toString() );
750-
const QgsFeature feat( context->feature() );
750+
const QgsFeature feat( context->variable( QStringLiteral( "current_feature" ) ).value<QgsFeature>() );
751751
if ( fieldName.isEmpty() || ! feat.isValid( ) )
752752
{
753753
return QVariant();
@@ -793,9 +793,9 @@ class GetProcessingParameterValue : public QgsScopedExpressionFunction
793793
QgsExpressionContextScope *QgsExpressionContextUtils::formScope( const QgsFeature &formFeature )
794794
{
795795
QgsExpressionContextScope *scope = new QgsExpressionContextScope( QObject::tr( "Form" ) );
796-
scope->setFeature( formFeature );
797796
scope->addFunction( QStringLiteral( "current_value" ), new GetCurrentFormFieldValue( ) );
798797
scope->setVariable( QStringLiteral( "current_geometry" ), formFeature.geometry( ), true );
798+
scope->setVariable( QStringLiteral( "current_feature" ), formFeature, true );
799799
return scope;
800800
}
801801

0 commit comments

Comments
 (0)