Skip to content

Commit

Permalink
post review adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
VitorVieiraZ committed Jan 10, 2025
1 parent d8015b3 commit 36bc8ce
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions app/attributes/attributecontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,29 +238,30 @@ void AttributeController::flatten(

// Retrieving field name expression
QgsProperty nameProperty = fieldProperties.property( QgsEditFormConfig::DataDefinedProperty::Alias );
QString nameExpressionString = nameProperty.expressionString();
QgsExpression nameExpression( nameExpressionString );
QgsExpression nameExpression; // empty if users set to hide the field label

if ( !editorField->showLabel() )
{
QgsExpression nameExpression = QgsExpression( nameProperty.expressionString() );
}

// Retrieving field editability expression
QgsProperty editableProperty = fieldProperties.property( QgsEditFormConfig::DataDefinedProperty::Editable );
QString editableExpressionString;
QgsExpression editableExpression;
bool isReadOnly = ( layer->editFormConfig().readOnly( fieldIndex ) ) ||
( !field.defaultValueDefinition().expression().isEmpty() && field.defaultValueDefinition().applyOnUpdate() );
QgsExpression isEditableExpression; // empty if the field is read-only

// Bypass reading the editable expression if Apply default value on update is enabled
if ( !field.defaultValueDefinition().applyOnUpdate() )
if ( !isReadOnly )
{
editableExpressionString = editableProperty.expressionString();
editableExpression = QgsExpression( editableExpressionString );
QgsProperty editableProperty = fieldProperties.property( QgsEditFormConfig::DataDefinedProperty::Editable );
isEditableExpression = QgsExpression( editableProperty.expressionString() );
}

if ( !expression.isEmpty() )
{
expressions << field.constraints().constraintExpression();
}

bool isReadOnly = ( layer->editFormConfig().readOnly( fieldIndex ) ) ||
( !field.defaultValueDefinition().expression().isEmpty() && field.defaultValueDefinition().applyOnUpdate() );

const QString groupName = container->isGroupBox() ? container->name() : QString();
std::shared_ptr<FormItem> formItemData =
std::shared_ptr<FormItem>(
Expand All @@ -273,7 +274,7 @@ void AttributeController::flatten(
nameExpression,
editorField->showLabel(),
!isReadOnly,
editableExpression,
isEditableExpression,
getEditorWidgetSetup( layer, fieldIndex ),
fieldIndex,
parentVisibilityExpressions // field doesn't have visibility expression itself
Expand Down

1 comment on commit 36bc8ce

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

Please sign in to comment.