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 qgis#38552

(cherry picked from commit 448f7d9)
  • Loading branch information
elpaso authored and nyalldawson committed Oct 5, 2020
1 parent 10949ac commit 2bca017
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,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 2bca017

Please sign in to comment.