Skip to content

Commit

Permalink
Hide relation widgets when in multiedit/search mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 9, 2016
1 parent ec97622 commit 015ee77
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/gui/editorwidgets/qgsrelationwidgetwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ void QgsRelationWidgetWrapper::setFeature( const QgsFeature& feature )
mWidget->setFeature( feature );
}

void QgsRelationWidgetWrapper::setVisible( bool visible )
{
if ( mWidget )
mWidget->setVisible( visible );
}

void QgsRelationWidgetWrapper::initWidget( QWidget* editor )
{
QgsRelationEditorWidget* w = dynamic_cast<QgsRelationEditorWidget*>( editor );
Expand Down
1 change: 1 addition & 0 deletions src/gui/editorwidgets/qgsrelationwidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class GUI_EXPORT QgsRelationWidgetWrapper : public QgsWidgetWrapper

public slots:
void setFeature( const QgsFeature& feature ) override;
void setVisible( bool visible );

private:
QgsRelation mRelation;
Expand Down
6 changes: 6 additions & 0 deletions src/gui/qgsattributeform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ void QgsAttributeForm::setMode( QgsAttributeForm::Mode mode )
}
}

bool relationWidgetsVisible = ( mMode == QgsAttributeForm::SingleEditMode || mMode == QgsAttributeForm::AddFeatureMode );
Q_FOREACH ( QgsRelationWidgetWrapper* w, findChildren< QgsRelationWidgetWrapper* >() )
{
w->setVisible( relationWidgetsVisible );
}

switch ( mode )
{
case QgsAttributeForm::SingleEditMode:
Expand Down

0 comments on commit 015ee77

Please sign in to comment.