Skip to content

Commit

Permalink
Hide relationship label widgets if not supported by connection
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 16, 2023
1 parent ad1b6a5 commit d28bbf2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/gui/qgsdbrelationshipwidget.cpp
Expand Up @@ -58,6 +58,19 @@ QgsDbRelationWidget::QgsDbRelationWidget( QgsAbstractDatabaseProviderConnection
mStrengthCombo->addItem( QgsRelation::strengthToDisplayString( strength ), QVariant::fromValue( strength ) );
}

const Qgis::RelationshipCapabilities capabilities = mConnection->supportedRelationshipCapabilities();
if ( !( capabilities & Qgis::RelationshipCapability::ForwardPathLabel ) )
{
mForwardLabelLineEdit->hide();
mForwardLabel->hide();
}

if ( !( capabilities & Qgis::RelationshipCapability::BackwardPathLabel ) )
{
mBackwardLabelLineEdit->hide();
mReverseLabel->hide();
}

const QStringList relatedTableTypes = mConnection->relatedTableTypes();
mRelatedTableTypeCombo->addItems( relatedTableTypes );

Expand Down
4 changes: 2 additions & 2 deletions src/ui/qgsdbrelationshipwidgetbase.ui
Expand Up @@ -70,7 +70,7 @@
<widget class="QLineEdit" name="mForwardLabelLineEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_12">
<widget class="QLabel" name="mForwardLabel">
<property name="text">
<string>Forward label</string>
</property>
Expand All @@ -80,7 +80,7 @@
<widget class="QComboBox" name="mRelatedTableTypeCombo"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_13">
<widget class="QLabel" name="mReverseLabel">
<property name="text">
<string>Reverse label</string>
</property>
Expand Down

0 comments on commit d28bbf2

Please sign in to comment.