Skip to content
Permalink
Browse files

Merge pull request #37031 from elpaso/bugfix-gh32756-value-map-not-fo…

…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 50573d5e1f0414467f42c0801f138d01cdc9a972
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/gui/editorwidgets/qgsvaluemapwidgetwrapper.cpp
@@ -16,6 +16,7 @@
#include "qgsvaluemapwidgetwrapper.h"
#include "qgsvaluemapconfigdlg.h"
#include "qgsvaluemapfieldformatter.h"
#include "qgsapplication.h"

#include <QSettings>

@@ -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 ) );
}

0 comments on commit 50573d5

Please sign in to comment.
You can’t perform that action at this time.