35 value = mComboBox->currentData();
42 value = mLineEdit->text();
50 if (
config( QStringLiteral(
"Editable" ) ).toBool() )
53 return new QComboBox( parent );
58 mComboBox = qobject_cast<QComboBox *>( editor );
59 mLineEdit = qobject_cast<QLineEdit *>( editor );
65 Q_FOREACH (
const QVariant &v, values )
69 mComboBox->addItem( v.toString(), v );
74 sValues << v.toString();
81 if ( fle && !(
field().type() == QVariant::Int ||
field().type() == QVariant::Double ||
field().type() == QVariant::LongLong ||
field().type() == QVariant::Date ) )
86 QCompleter *
c =
new QCompleter( sValues );
87 c->setCaseSensitivity( Qt::CaseInsensitive );
88 c->setCompletionMode( QCompleter::PopupCompletion );
89 mLineEdit->setCompleter( c );
91 connect( mLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString &
value ) { emit
valueChanged( value ); } );
96 connect( mComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
103 return mComboBox || mLineEdit;
122 mComboBox->setCurrentIndex( mComboBox->findData( value ) );
127 if ( value.isNull() )
130 mLineEdit->setText( value.toString() );
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
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
static QString nullRepresentation()
This string is used to represent the value NULL throughout QGIS.
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
QSet< QVariant > uniqueValues(int fieldIndex, int limit=-1) const FINAL
Calculates a list of unique values contained within an attribute in the layer.
void setNullValue(const QString &nullValue)
Sets the string representation for null values in the widget.
Represents a vector layer which manages a vector based data sets.