Skip to content

Commit

Permalink
Hide subform in N:M relations
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Mar 11, 2016
1 parent 29d2d28 commit 3fd3dae
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/gui/editorwidgets/qgsrelationwidgetwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,14 @@ void QgsRelationWidgetWrapper::initWidget( QWidget* editor )

w->setEditorContext( myContext );

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

// If this widget is already embedded by the same relation, reduce functionality
const QgsAttributeEditorContext* ctx = &context();
do
{
if ( ctx->relation().name() == mRelation.name() && ctx->formMode() == QgsAttributeEditorContext::Embed )
if (( ctx->relation().name() == mRelation.name() && ctx->formMode() == QgsAttributeEditorContext::Embed )
|| ctx->relation().name() == nmrel.name() )
{
w->setVisible( false );
break;
Expand All @@ -72,7 +75,6 @@ void QgsRelationWidgetWrapper::initWidget( QWidget* editor )
}
while ( ctx );

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

w->setRelations( mRelation, nmrel );

Expand Down

0 comments on commit 3fd3dae

Please sign in to comment.