Skip to content
Permalink
Browse files

Fixes relation reference widget by refreshing filter lists. Fixes #16400

  • Loading branch information
pblottiere committed Aug 18, 2017
1 parent e325895 commit cea7bd39d8a3575bda85acdd15bae621e2547cd1
Showing with 17 additions and 3 deletions.
  1. +17 −3 src/gui/editorwidgets/qgsrelationreferencewidget.cpp
@@ -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;
}
}

0 comments on commit cea7bd3

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