25 #include <QStringListModel> 50 int cbxIdx = mComboBox->currentIndex();
53 v = mComboBox->currentData();
61 if ( i.
value == mLineEdit->text() )
89 return fieldName +
" IS NULL";
91 return fieldName +
" IS NOT NULL";
101 case QVariant::Double:
102 case QVariant::LongLong:
103 case QVariant::ULongLong:
106 return fieldName +
'=' + v.toString();
108 return fieldName +
"<>" + v.toString();
115 return fieldName +
"='" + v.toString() +
'\'';
117 return fieldName +
"<>'" + v.toString() +
'\'';
129 mComboBox->setCurrentIndex( 0 );
133 mLineEdit->setText( QString() );
141 mComboBox->setEnabled( enabled );
145 mLineEdit->setEnabled( enabled );
156 QVariant vl =
value();
177 if ( exp == nullValue )
183 str = QStringLiteral(
"%1 = '%3'" )
185 exp.replace(
'\'', QLatin1String(
"''" ) )
193 if (
config( QStringLiteral(
"AllowMulti" ) ).toBool() )
197 else if (
config( QStringLiteral(
"UseCompleter" ) ).toBool() )
203 return new QComboBox( parent );
211 mComboBox = qobject_cast<QComboBox *>( editor );
212 mLineEdit = qobject_cast<QLineEdit *>( editor );
216 mComboBox->addItem( tr(
"Please select" ), QVariant() );
217 if (
config( QStringLiteral(
"AllowNull" ) ).toBool() )
219 mComboBox->addItem( tr(
"(no selection)" ), QVariant(
layer()->fields().at(
mFieldIdx ).type() ) );
224 mComboBox->addItem( element.
value, element.
key );
229 else if ( mLineEdit )
232 values.reserve( mCache.size() );
238 QStringListModel *m =
new QStringListModel( values, mLineEdit );
239 QCompleter *completer =
new QCompleter( m, mLineEdit );
240 completer->setCaseSensitivity( Qt::CaseInsensitive );
241 mLineEdit->setCompleter( completer );
static QString quotedColumnRef(QString name)
Returns a quoted column reference (in double quotes)
QgsField at(int i) const
Gets field at particular index (must be in range 0..N-1)
QgsFields fields() const override
Returns the list of fields of this layer.
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.
Represents a vector layer which manages a vector based data sets.