Skip to content

Commit

Permalink
Fix @current_parent_* default value not saved on child creation
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Jun 19, 2024
1 parent b5d593e commit c39e379
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/attributeformmodelbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,11 @@ void AttributeFormModelBase::applyParentDefaultValues()
QgsExpression exp( fields.at( fidx ).defaultValueDefinition().expression() );
exp.prepare( &mExpressionContext );
const QVariant defaultValue = exp.evaluate( &mExpressionContext );
item->setData( defaultValue, AttributeFormModel::AttributeValue );
synchronizeFieldValue( fidx, defaultValue );
const bool success = mFeatureModel->setData( mFeatureModel->index( fidx ), defaultValue, FeatureModel::AttributeValue );
if ( success )
{
synchronizeFieldValue( fidx, defaultValue );
}
}
}
}
Expand Down

0 comments on commit c39e379

Please sign in to comment.