Skip to content
Permalink
Browse files

Make sure empty array in listwidget is null

Fixes #38176
  • Loading branch information
stev-0 authored and nyalldawson committed Dec 29, 2020
1 parent ff3bb1c commit 5c225cce8b890949ff71518ebaade16a124378f2
Showing with 11 additions and 2 deletions.
  1. +11 −2 src/gui/editorwidgets/qgslistwidgetwrapper.cpp
@@ -70,16 +70,25 @@ QVariant QgsListWidgetWrapper::value() const
{
QVariant::Type type = field().type();
if ( !mWidget ) return QVariant( type );
const QVariantList list = mWidget->list();
if ( type == QVariant::StringList )
{
QStringList result;
const QVariantList list = mWidget->list();
for ( QVariantList::const_iterator it = list.constBegin(); it != list.constEnd(); ++it )
result.append( it->toString() );
return result;
}
else
return QVariant( mWidget->list() );
{
if ( list.size() == 0 )
{
return QVariant( );
}
else
{
return list;
}
}
}

void QgsListWidgetWrapper::onValueChanged()

0 comments on commit 5c225cc

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