Skip to content
Permalink
Browse files

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

  • Loading branch information
pblottiere committed Aug 21, 2017
1 parent 899a3cd commit cb390d7f5cb9b0d9d6c1a9af4e0ca2c0dcd19c7e
Showing with 17 additions and 3 deletions.
  1. +17 −3 src/gui/editorwidgets/qgsrelationreferencewidget.cpp
@@ -276,6 +276,20 @@ void QgsRelationReferenceWidget::setForeignKey( const QVariant& value )
}
else
{
QString nullValue = QSettings().value( "qgis/nullValue", "NULL" ).toString();

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 : v.toString();
mFilterComboBoxes.at( i )->setCurrentIndex( mFilterComboBoxes.at( i )->findText( f ) );
}
}

int i = mComboBox->findData( mFeature.id(), QgsAttributeTableModel::FeatureIdRole );
if ( i == -1 && mAllowNull )
{
@@ -951,12 +965,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 cb390d7

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