Skip to content

Commit

Permalink
checking if there is expression
Browse files Browse the repository at this point in the history
  • Loading branch information
VitorVieiraZ committed Oct 17, 2024
1 parent 5a9e8c0 commit a66ef1e
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions app/attributes/attributecontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,19 +925,23 @@ void AttributeController::recalculateDerivedItems( bool isFormValueChange, bool
while ( formItemsIterator != mFormItems.end() )
{
std::shared_ptr<FormItem> item = formItemsIterator.value();
bool editable = item->isEditable();
QgsExpression exp = item->editableExpression();
exp.prepare( &expressionContext );

if ( exp.isValid() )
if ( !exp.expression().isEmpty() )
{
editable = exp.evaluate( &expressionContext ).toInt();
}
bool editable = item->isEditable();
exp.prepare( &expressionContext );

if ( item->isEditable() != editable )
{
item->setEditable( editable );
changedFormItems << item->id();
if ( exp.isValid() )
{
editable = exp.evaluate( &expressionContext ).toInt();
}

if ( item->isEditable() != editable )
{
item->setEditable( editable );
changedFormItems << item->id();
}
}

++formItemsIterator;
Expand All @@ -950,19 +954,23 @@ void AttributeController::recalculateDerivedItems( bool isFormValueChange, bool
while ( formItemsIterator != mFormItems.end() )
{
std::shared_ptr<FormItem> item = formItemsIterator.value();
QString name = item->name();
QgsExpression exp = item->nameExpression();
exp.prepare( &expressionContext );

if ( exp.isValid() )
if ( !exp.expression().isEmpty() )
{
name = exp.evaluate( &expressionContext ).toString();
}
QString name = item->name();
exp.prepare( &expressionContext );

if ( item->name() != name )
{
item->setName( name );
changedFormItems << item->id();
if ( exp.isValid() )
{
name = exp.evaluate( &expressionContext ).toString();
}

if ( item->name() != name )
{
item->setName( name );
changedFormItems << item->id();
}
}

++formItemsIterator;
Expand Down

1 comment on commit a66ef1e

@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.10.670411 just submitted!

Please sign in to comment.