Skip to content
Permalink
Browse files

Fix option "show label" on relation editor

If the option was disabled, the label was still shown.
  • Loading branch information
m-kuhn authored and nyalldawson committed Jun 12, 2020
1 parent 8e09f4e commit d8b3adab949677484c6890fe005c1e65e5c2a9e6
Showing with 13 additions and 9 deletions.
  1. +1 −2 src/gui/qgsattributeform.cpp
  2. +11 −7 src/gui/qgsrelationeditorwidget.cpp
  3. +1 −0 src/gui/qgsrelationeditorwidget.h
@@ -1927,8 +1927,6 @@ QgsAttributeForm::WidgetInfo QgsAttributeForm::createWidgetFromDef( const QgsAtt

QgsRelationWidgetWrapper *rww = setupRelationWidgetWrapper( relDef->relation(), context );

rww->setShowLabel( relDef->showLabel() );

QgsAttributeFormRelationEditorWidget *formWidget = new QgsAttributeFormRelationEditorWidget( rww, this );
formWidget->createSearchWidgetWrappers( mContext );

@@ -1938,6 +1936,7 @@ QgsAttributeForm::WidgetInfo QgsAttributeForm::createWidgetFromDef( const QgsAtt
rww->setShowLinkButton( relDef->showLinkButton() );
rww->setShowUnlinkButton( relDef->showUnlinkButton() );
rww->setShowSaveChildEditsButton( relDef->showSaveChildEditsButton() );
rww->setShowLabel( relDef->showLabel() );

mWidgets.append( rww );
mFormWidgets.append( formWidget );
@@ -228,8 +228,7 @@ void QgsRelationEditorWidget::setRelationFeature( const QgsRelation &relation, c
connect( mRelation.referencingLayer(), &QgsVectorLayer::editingStarted, this, &QgsRelationEditorWidget::updateButtons );
connect( mRelation.referencingLayer(), &QgsVectorLayer::editingStopped, this, &QgsRelationEditorWidget::updateButtons );

if ( mShowLabel )
setTitle( relation.name() );
updateTitle();

QgsVectorLayer *lyr = relation.referencingLayer();

@@ -340,7 +339,7 @@ void QgsRelationEditorWidget::setRelations( const QgsRelation &relation, const Q
connect( mNmRelation.referencedLayer(), &QgsVectorLayer::editingStopped, this, &QgsRelationEditorWidget::updateButtons );
}

setTitle( relation.name() );
updateTitle();

QgsVectorLayer *lyr = relation.referencingLayer();

@@ -972,10 +971,7 @@ void QgsRelationEditorWidget::setShowLabel( bool showLabel )
{
mShowLabel = showLabel;

if ( mShowLabel && mRelation.isValid() )
setTitle( mRelation.name() );
else
setTitle( QString() );
updateTitle();
}

void QgsRelationEditorWidget::showContextMenu( QgsActionMenu *menu, const QgsFeatureId fid )
@@ -1014,6 +1010,14 @@ void QgsRelationEditorWidget::unsetMapTool()
disconnect( mMapToolDigitize, &QgsMapToolDigitizeFeature::digitizingCompleted, this, &QgsRelationEditorWidget::onDigitizingCompleted );
}

void QgsRelationEditorWidget::updateTitle()
{
if ( mShowLabel && mRelation.isValid() )
setTitle( mRelation.name() );
else
setTitle( QString() );
}

QgsFeature QgsRelationEditorWidget::feature() const
{
return mFeature;
@@ -250,6 +250,7 @@ class GUI_EXPORT QgsRelationEditorWidget : public QgsCollapsibleGroupBox
void initDualView( QgsVectorLayer *layer, const QgsFeatureRequest &request );
void setMapTool( QgsMapTool *mapTool );
void unsetMapTool();
void updateTitle();

QgsDualView *mDualView = nullptr;
QPointer<QgsMessageBarItem> mMessageBarItem;

0 comments on commit d8b3ada

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