Skip to content

Commit

Permalink
Fix relation editor widget not visible if n:m relation name is empty (#…
Browse files Browse the repository at this point in the history
…42312)

Check relations for equality by Id instead of name and check only if the
relation in context is valid.

(cherry picked from commit e75b6df)
  • Loading branch information
domi4484 authored and nyalldawson committed Apr 17, 2021
1 parent 99892f1 commit 0c8aebe
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/gui/editorwidgets/qgsrelationwidgetwrapper.cpp
Expand Up @@ -258,17 +258,16 @@ void QgsRelationWidgetWrapper::setNmRelationId( const QVariant &nmRelationId )

// If this widget is already embedded by the same relation, reduce functionality
const QgsAttributeEditorContext *ctx = &context();
do
while ( ctx && ctx->relation().isValid() )
{
if ( ( ctx->relation().name() == mRelation.name() && ctx->formMode() == QgsAttributeEditorContext::Embed )
|| ( mNmRelation.isValid() && ctx->relation().name() == mNmRelation.name() ) )
if ( ( ctx->relation().id() == mRelation.id() && ctx->formMode() == QgsAttributeEditorContext::Embed )
|| ( mNmRelation.isValid() && ctx->relation().id() == mNmRelation.id() ) )
{
mWidget->setVisible( false );
break;
}
ctx = ctx->parentContext();
}
while ( ctx );

mWidget->setRelations( mRelation, mNmRelation );
}
Expand Down

0 comments on commit 0c8aebe

Please sign in to comment.