mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-03 00:02:25 -05:00
Set form feature in current_feature variable instead of
... setting the feature member variable
This commit is contained in:
parent
55a1984b28
commit
4033cc2ebd
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user