Skip to content
Permalink
Browse files
Make sure empty array in listwidget is null
Fixes #38176

(cherry picked from commit 5c225cc)
  • Loading branch information
stev-0 authored and nyalldawson committed Jan 15, 2021
1 parent 9d7bdea commit b21b863b4a24e549ffbfa70af766ad3a19544472
Showing 1 changed file with 11 additions and 2 deletions.
@@ -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 b21b863

Please sign in to comment.