Skip to content

Commit

Permalink
Fixes relation reference widget by refreshing filter lists. Fixes #16400
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Aug 21, 2017
1 parent 899a3cd commit cb390d7
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/gui/editorwidgets/qgsrelationreferencewidget.cpp
Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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.