25 #include <QSizePolicy> 35 return new QComboBox( parent );
38 void QgsValueMapSearchWidgetWrapper::comboBoxIndexChanged(
int idx )
90 return fieldName +
" IS NULL";
92 return fieldName +
" IS NOT NULL";
95 if ( mComboBox->currentIndex() == 0 )
98 QString currentKey = mComboBox->currentData().toString();
104 case QVariant::Double:
105 case QVariant::LongLong:
106 case QVariant::ULongLong:
109 return fieldName +
'=' + currentKey;
111 return fieldName +
"<>" + currentKey;
118 return fieldName +
"='" + currentKey +
'\'';
120 return fieldName +
"<>'" + currentKey +
'\'';
130 mComboBox->setCurrentIndex( 0 );
135 mComboBox->setEnabled( enabled );
140 mComboBox = qobject_cast<QComboBox *>( editor );
145 mComboBox->insertItem( 0, tr(
"Please select" ), QString() );
147 connect( mComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsValueMapSearchWidgetWrapper::comboBoxIndexChanged );
157 str = QStringLiteral(
"%1 = '%2'" )
158 .arg( QgsExpression::quotedColumnRef( fieldName ),
159 exp.replace(
'\'', QLatin1String(
"''" ) ) );
QgsField at(int i) const
Get field at particular index (must be in range 0..N-1)
QgsFields fields() const override
Returns the list of fields of this layer.
Represents a vector layer which manages a vector based data sets.
static void populateComboBox(QComboBox *comboBox, const QVariantMap &configuration, bool skipNull)
Populates a comboBox with the appropriate entries based on a value map configuration.