Skip to content

Commit

Permalink
Merge pull request #38801 from elpaso/bugfix-gh38552-value-relation-n…
Browse files Browse the repository at this point in the history
…ull-with-linedit

Fixes value relation line edit not found values
  • Loading branch information
elpaso committed Sep 16, 2020
2 parents bc3d8fd + 448f7d9 commit 5fc05e2
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 5fc05e2

Please sign in to comment.