mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
Fixes relation reference widget by refreshing filter lists. Fixes #16400
This commit is contained in:
parent
e32589599a
commit
cea7bd39d8
@ -280,6 +280,20 @@ void QgsRelationReferenceWidget::setForeignKey( const QVariant &value )
|
||||
}
|
||||
else
|
||||
{
|
||||
QVariant nullValue = QgsApplication::nullRepresentation();
|
||||
|
||||
if ( mChainFilters && mFeature.isValid() && mFilterComboBoxes.count() >= mFilterFields.count() )
|
||||
{
|
||||
QgsFeature feature = mFeature;
|
||||
|
||||
for ( int i = 0; i < mFilterFields.size(); i++ )
|
||||
{
|
||||
QVariant v = feature.attribute( mFilterFields[i] );
|
||||
QString f = v.isNull() ? nullValue.toString() : v.toString();
|
||||
mFilterComboBoxes.at( i )->setCurrentIndex( mFilterComboBoxes.at( i )->findText( f ) );
|
||||
}
|
||||
}
|
||||
|
||||
int i = mComboBox->findData( mFeature.id(), QgsAttributeTableModel::FeatureIdRole );
|
||||
if ( i == -1 && mAllowNull )
|
||||
{
|
||||
@ -971,12 +985,12 @@ void QgsRelationReferenceWidget::disableChainedComboBoxes( const QComboBox *scb
|
||||
continue;
|
||||
}
|
||||
|
||||
cb->setCurrentIndex( 0 );
|
||||
if ( ccb->currentIndex() == 0 )
|
||||
{
|
||||
cb->setCurrentIndex( 0 );
|
||||
cb->setEnabled( false );
|
||||
}
|
||||
else
|
||||
ccb = cb;
|
||||
|
||||
ccb = cb;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user