Skip to content

Commit

Permalink
[expression builder] clear fields values when changing field (#8703)
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Dec 19, 2018
1 parent 498d51e commit 565d999
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/gui/qgsexpressionbuilderwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,19 @@ void QgsExpressionBuilderWidget::currentChanged( const QModelIndex &index, const
if ( !item )
return;

if ( item->getItemType() == QgsExpressionItem::Field && mFieldValues.contains( item->text() ) )
bool isField = mLayer && item->getItemType() == QgsExpressionItem::Field;
if ( isField )
{
const QStringList &values = mFieldValues[item->text()];
mValuesModel->setStringList( values );
if ( mFieldValues.contains( item->text() ) )
{
const QStringList &values = mFieldValues[item->text()];
mValuesModel->setStringList( values );
}
else
{
mValuesModel->setStringList( QStringList() );
}
}

bool isField = mLayer && item->getItemType() == QgsExpressionItem::Field;
mValueGroupBox->setVisible( isField );
mShowHelpButton->setText( isField ? tr( "Show Values" ) : tr( "Show Help" ) );

Expand Down

0 comments on commit 565d999

Please sign in to comment.