Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Jul 10, 2024
1 parent 2944120 commit 686f032
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/gui/qgsattributeform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3280,12 +3280,17 @@ void QgsAttributeForm::updateRelatedLayerFieldsDependencies( QgsEditorWidgetWrap

void QgsAttributeForm::updateFieldDependenciesParent( QgsEditorWidgetWrapper *eww )
{
if ( eww )
if ( eww && !eww->field().defaultValueDefinition().expression().isEmpty() )
{
QString expression = eww->field().defaultValueDefinition().expression();
if ( expression.contains( QStringLiteral( "current_parent" ) ) )
const QgsExpression expression( eww->field().defaultValueDefinition().expression() );
const QSet< QString > referencedVariablesAndFunctions = expression.referencedVariables() + expression.referencedFunctions();
for ( const QString &referenced : referencedVariablesAndFunctions )
{
mParentDependencies.insert( eww );
if ( referenced.startsWith( QStringLiteral( "current_parent" ) ) )
{
mParentDependencies.insert( eww );
break;
}
}
}
}
Expand Down

0 comments on commit 686f032

Please sign in to comment.