26 #include <QStringListModel> 51 int cbxIdx = mComboBox->currentIndex();
54 v = mComboBox->currentData();
62 if ( i.
value == mLineEdit->text() )
90 return fieldName +
" IS NULL";
92 return fieldName +
" IS NOT NULL";
102 case QVariant::Double:
103 case QVariant::LongLong:
104 case QVariant::ULongLong:
107 return fieldName +
'=' + v.toString();
109 return fieldName +
"<>" + v.toString();
116 return fieldName +
"='" + v.toString() +
'\'';
118 return fieldName +
"<>'" + v.toString() +
'\'';
130 mComboBox->setCurrentIndex( 0 );
134 mLineEdit->setText( QString() );
142 mComboBox->setEnabled( enabled );
146 mLineEdit->setEnabled( enabled );
157 QVariant vl =
value();
178 if ( exp == nullValue )
184 str = QStringLiteral(
"%1 = '%3'" )
186 exp.replace(
'\'', QLatin1String(
"''" ) )
194 if (
config( QStringLiteral(
"AllowMulti" ) ).toBool() )
198 else if (
config( QStringLiteral(
"UseCompleter" ) ).toBool() )
204 return new QComboBox( parent );
212 mComboBox = qobject_cast<QComboBox *>( editor );
213 mLineEdit = qobject_cast<QLineEdit *>( editor );
217 mComboBox->addItem( tr(
"Please select" ), QVariant() );
218 if (
config( QStringLiteral(
"AllowNull" ) ).toBool() )
220 mComboBox->addItem( tr(
"(no selection)" ), QVariant(
layer()->fields().at(
mFieldIdx ).type() ) );
225 mComboBox->addItem( element.
value, element.
key );
230 else if ( mLineEdit )
233 values.reserve( mCache.size() );
239 QStringListModel *m =
new QStringListModel( values, mLineEdit );
240 QCompleter *completer =
new QCompleter( m, mLineEdit );
241 completer->setCaseSensitivity( Qt::CaseInsensitive );
242 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 FINAL
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.