Skip to content
Permalink
Browse files

Handle NULL case in value map when NULL is not in the map

Corner case of bug #32756, handles (NULL) value
when NULL is not in the map of allowed values.

NULL is shown as (NULL) instead of <NULL> in this case.
  • Loading branch information
elpaso committed Jun 8, 2020
1 parent 59ce5c8 commit bc0f478c5965b0938fb9bac859d0d8f9a85c7651
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 bc0f478

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