Skip to content

Commit 3fd3dae

Browse files
committed
Hide subform in N:M relations
1 parent 29d2d28 commit 3fd3dae

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/gui/editorwidgets/qgsrelationwidgetwrapper.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,14 @@ void QgsRelationWidgetWrapper::initWidget( QWidget* editor )
5959

6060
w->setEditorContext( myContext );
6161

62+
QgsRelation nmrel = QgsProject::instance()->relationManager()->relation( config( "nm-rel" ).toString() );
63+
6264
// If this widget is already embedded by the same relation, reduce functionality
6365
const QgsAttributeEditorContext* ctx = &context();
6466
do
6567
{
66-
if ( ctx->relation().name() == mRelation.name() && ctx->formMode() == QgsAttributeEditorContext::Embed )
68+
if (( ctx->relation().name() == mRelation.name() && ctx->formMode() == QgsAttributeEditorContext::Embed )
69+
|| ctx->relation().name() == nmrel.name() )
6770
{
6871
w->setVisible( false );
6972
break;
@@ -72,7 +75,6 @@ void QgsRelationWidgetWrapper::initWidget( QWidget* editor )
7275
}
7376
while ( ctx );
7477

75-
QgsRelation nmrel = QgsProject::instance()->relationManager()->relation( config( "nm-rel" ).toString() );
7678

7779
w->setRelations( mRelation, nmrel );
7880

0 commit comments

Comments
 (0)