Skip to content
Permalink
Browse files

fixes invalid relation in search form (#37137)

* fixes invalid relation in search form

fixes #34410

* fetch the relation if only one is present
  • Loading branch information
3nids committed Jul 7, 2020
1 parent 961e6e8 commit 9eef5d78036f16ee4671180029c93b06ad049992
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/gui/editorwidgets/qgsrelationreferencesearchwidgetwrapper.cpp
@@ -207,6 +207,9 @@ void QgsRelationReferenceSearchWidgetWrapper::initWidget( QWidget *editor )
}

QgsRelation relation = QgsProject::instance()->relationManager()->relation( config( QStringLiteral( "Relation" ) ).toString() );
// if no relation is given from the config, fetch one if there is only one available
if ( !relation.isValid() && !layer()->referencingRelations( mFieldIdx ).isEmpty() && layer()->referencingRelations( mFieldIdx ).count() == 1 )
relation = layer()->referencingRelations( mFieldIdx )[0];
mWidget->setRelation( relation, false );

mWidget->showIndeterminateState();

0 comments on commit 9eef5d7

Please sign in to comment.
You can’t perform that action at this time.