Skip to content

Commit

Permalink
Fixes value relation line edit not found values
Browse files Browse the repository at this point in the history
When there is no match in the relation layer,
show "(no selection)" instead of NOT updating
the widget (which was the reported issue).

Fixes #38552
  • Loading branch information
elpaso committed Sep 16, 2020
1 parent 49037e0 commit 448f7d9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.cpp
Expand Up @@ -244,14 +244,22 @@ void QgsValueRelationWidgetWrapper::updateValues( const QVariant &value, const Q
}
else if ( mLineEdit )
{
mLineEdit->clear();
bool wasFound { false };
for ( const QgsValueRelationFieldFormatter::ValueRelationItem &i : qgis::as_const( mCache ) )
{
if ( i.key == value )
{
mLineEdit->setText( i.value );
wasFound = true;
break;
}
}
// Value could not be found
if ( ! wasFound )
{
mLineEdit->setText( tr( "(no selection)" ) );
}
}
}

Expand Down

0 comments on commit 448f7d9

Please sign in to comment.