Hide relationship label widgets if not supported by connection

This commit is contained in:
Nyall Dawson 2023-01-11 15:11:23 +10:00
parent ad1b6a5fa0
commit d28bbf207e
2 changed files with 15 additions and 2 deletions

View File

@ -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 );

View File

@ -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>
@ -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>