Skip to content

Commit

Permalink
support relation editor widgets of autoconfigured form configured in …
Browse files Browse the repository at this point in the history
…previous versions
  • Loading branch information
signedav committed Aug 13, 2020
1 parent 259f9e8 commit e4691e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/gui/editorwidgets/qgsrelationwidgetwrapper.cpp
Expand Up @@ -155,7 +155,8 @@ void QgsRelationWidgetWrapper::initWidget( QWidget *editor )

QgsAttributeEditorContext myContext( QgsAttributeEditorContext( context(), mRelation, QgsAttributeEditorContext::Multiple, QgsAttributeEditorContext::Embed ) );

// read the legacy config of force-suppress-popup to support settings made by the API
// read the legacy config of force-suppress-popup to support settings made by the API and autoconfigurated forms
// it will be overwritten on specific widget configuration
if ( config( QStringLiteral( "force-suppress-popup" ), false ).toBool() )
{
const_cast<QgsVectorLayerTools *>( myContext.vectorLayerTools() )->setForceSuppressFormPopup( true );
Expand All @@ -168,7 +169,8 @@ void QgsRelationWidgetWrapper::initWidget( QWidget *editor )
}
*/

// read the legacy config of nm-rel to support settings made by the API
// read the legacy config of nm-rel to support settings made by the API and autoconfigurated forms
// it will be overwritten on specific widget configuration
mNmRelation = QgsProject::instance()->relationManager()->relation( config( QStringLiteral( "nm-rel" ) ).toString() );

// If this widget is already embedded by the same relation, reduce functionality
Expand Down Expand Up @@ -231,10 +233,7 @@ void QgsRelationWidgetWrapper::setForceSuppressFormPopup( bool forceSuppressForm
if ( mWidget )
{
mWidget->setForceSuppressFormPopup( forceSuppressFormPopup );
if ( forceSuppressFormPopup )
{
const_cast<QgsVectorLayerTools *>( mWidget->editorContext().vectorLayerTools() )->setForceSuppressFormPopup( true );
}
const_cast<QgsVectorLayerTools *>( mWidget->editorContext().vectorLayerTools() )->setForceSuppressFormPopup( forceSuppressFormPopup );
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/gui/qgsattributeform.cpp
Expand Up @@ -1254,6 +1254,8 @@ QList<QgsEditorWidgetWrapper *> QgsAttributeForm::constraintDependencies( QgsEdi
QgsRelationWidgetWrapper *QgsAttributeForm::setupRelationWidgetWrapper( const QgsRelation &rel, const QgsAttributeEditorContext &context )
{
QgsRelationWidgetWrapper *rww = new QgsRelationWidgetWrapper( mLayer, rel, nullptr, this );
const QVariantMap config = mLayer->editFormConfig().widgetConfig( rel.id() );
rww->setConfig( config );
rww->setContext( context );

return rww;
Expand Down

0 comments on commit e4691e6

Please sign in to comment.