36 value = mComboBox->currentData();
43 value = mLineEdit->text();
51 if (
config( QStringLiteral(
"Editable" ) ).toBool() )
55 QComboBox *combo =
new QComboBox( parent );
56 combo->setMinimumContentsLength( 1 );
57 combo->setSizeAdjustPolicy( QComboBox::SizeAdjustPolicy::AdjustToMinimumContentsLengthWithIcon );
64 mComboBox = qobject_cast<QComboBox *>( editor );
65 mLineEdit = qobject_cast<QLineEdit *>( editor );
71 const auto constValues = values;
72 for (
const QVariant &v : constValues )
76 mComboBox->addItem( v.toString(), v );
81 sValues << v.toString();
88 if ( fle && !(
field().type() == QVariant::Int ||
field().type() == QVariant::Double ||
field().type() == QVariant::LongLong ||
field().type() == QVariant::Date ) )
93 QCompleter *
c =
new QCompleter( sValues );
94 c->setCaseSensitivity( Qt::CaseInsensitive );
95 c->setCompletionMode( QCompleter::PopupCompletion );
96 mLineEdit->setCompleter(
c );
98 connect( mLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString &
value )
109 connect( mComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
116 return mComboBox || mLineEdit;
131void QgsUniqueValuesWidgetWrapper::updateValues(
const QVariant &value,
const QVariantList & )
135 mComboBox->setCurrentIndex( mComboBox->findData(
value ) );
143 mLineEdit->setText(
value.toString() );
static QString nullRepresentation()
This string is used to represent the value NULL throughout QGIS.
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
void setNullValue(const QString &nullValue)
Sets the string representation for null values in the widget.
static bool isNull(const QVariant &variant)
Returns true if the specified variant should be considered a NULL value.
Represents a vector layer which manages a vector based data sets.
QSet< QVariant > uniqueValues(int fieldIndex, int limit=-1) const FINAL
Calculates a list of unique values contained within an attribute in the layer.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
#define Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_PUSH
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.