Skip to content

Commit

Permalink
evaluating expression only if not enabled Apply default value on update
Browse files Browse the repository at this point in the history
  • Loading branch information
VitorVieiraZ committed Dec 9, 2024
1 parent b4a95b1 commit 2f3641c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions app/attributes/attributecontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,15 @@ void AttributeController::flatten(

// Retrieving field editability expression
QgsProperty editableProperty = fieldProperties.property( QgsEditFormConfig::DataDefinedProperty::Editable );
QString editableExpressionString = editableProperty.expressionString();
QgsExpression editableExpression( editableExpressionString );
QString editableExpressionString;
QgsExpression editableExpression;

// Bypass reading the editable expression if Apply default value on update is enabled
if ( !field.defaultValueDefinition().applyOnUpdate() )
{
editableExpressionString = editableProperty.expressionString();
editableExpression = QgsExpression( editableExpressionString );
}

if ( !expression.isEmpty() )
{
Expand Down Expand Up @@ -928,7 +935,7 @@ void AttributeController::recalculateDerivedItems( bool isFormValueChange, bool
std::shared_ptr<FormItem> item = formItemsIterator.value();
QgsExpression exp = item->editableExpression();

if ( !exp.expression().isEmpty() && !item->field().defaultValueDefinition().applyOnUpdate() )
if ( !exp.expression().isEmpty() )
{
bool editable = item->isEditable();
exp.prepare( &expressionContext );
Expand Down

1 comment on commit 2f3641c

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS - version 24.12.696911 just submitted!

Please sign in to comment.