23#include "moc_qgslistwidgetwrapper.cpp"
25using namespace Qt::StringLiterals;
33 mWidget->setList( QVariantList() );
40 mWidget->setReadOnly( !enabled );
46 QFrame *ret =
new QFrame( parent );
47 ret->setFrameShape( QFrame::StyledPanel );
48 QHBoxLayout *layout =
new QHBoxLayout( ret );
49 layout->setContentsMargins( 0, 0, 0, 0 );
51 layout->addWidget(
widget );
56 ret->setMinimumSize( QSize( 320, 110 ) );
63 mWidget = qobject_cast<QgsListWidget *>( editor );
74 return mWidget ? mWidget->valid() :
true;
77void QgsListWidgetWrapper::updateValues(
const QVariant &value,
const QVariantList & )
84 const QMetaType::Type type =
field().
type();
87 const QVariantList list = mWidget->list();
88 if ( list.size() == 0 &&
config( u
"EmptyIsNull"_s ).toBool() )
92 if ( type == QMetaType::Type::QStringList )
95 for ( QVariantList::const_iterator it = list.constBegin(); it != list.constEnd(); ++it )
96 result.append( it->toString() );
105void QgsListWidgetWrapper::onValueChanged()
static QVariant createNullVariant(QMetaType::Type metaType)
Helper method to properly create a null QVariant from a metaType Returns the created QVariant.
Represents a vector layer which manages a vector based dataset.