Skip to content

Commit

Permalink
Merge pull request #37031 from elpaso/bugfix-gh32756-value-map-not-fo…
Browse files Browse the repository at this point in the history
…und-handle-null

Handle NULL case in value map when NULL is not in the map
  • Loading branch information
elpaso committed Jun 8, 2020
2 parents 59ce5c8 + bc0f478 commit 50573d5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/gui/editorwidgets/qgsvaluemapwidgetwrapper.cpp
Expand Up @@ -16,6 +16,7 @@
#include "qgsvaluemapwidgetwrapper.h"
#include "qgsvaluemapconfigdlg.h"
#include "qgsvaluemapfieldformatter.h"
#include "qgsapplication.h"

#include <QSettings>

Expand Down Expand Up @@ -81,7 +82,14 @@ void QgsValueMapWidgetWrapper::updateValues( const QVariant &value, const QVaria
{
if ( mComboBox->findData( v ) == -1 && !( v.startsWith( '(' ) && v.endsWith( ')' ) ) )
{
mComboBox->addItem( v.prepend( '(' ).append( ')' ), v );
if ( value.isNull( ) )
{
mComboBox->addItem( QgsApplication::nullRepresentation().prepend( '(' ).append( ')' ), v );
}
else
{
mComboBox->addItem( v.prepend( '(' ).append( ')' ), v );
}
}
mComboBox->setCurrentIndex( mComboBox->findData( v ) );
}
Expand Down

0 comments on commit 50573d5

Please sign in to comment.