17#include "moc_qgsvaluemapsearchwidgetwrapper.cpp"
36 auto combo =
new QComboBox( parent );
37 combo->setMinimumContentsLength( 1 );
38 combo->setSizeAdjustPolicy( QComboBox::SizeAdjustPolicy::AdjustToMinimumContentsLengthWithIcon );
42void QgsValueMapSearchWidgetWrapper::comboBoxIndexChanged(
int idx )
94 return fieldName +
" IS NULL";
96 return fieldName +
" IS NOT NULL";
99 if ( mComboBox->currentIndex() == 0 )
102 const QString currentKey = mComboBox->currentData().toString();
106 case QMetaType::Type::Int:
107 case QMetaType::Type::UInt:
108 case QMetaType::Type::Double:
109 case QMetaType::Type::LongLong:
110 case QMetaType::Type::ULongLong:
113 return fieldName +
'=' + currentKey;
115 return fieldName +
"<>" + currentKey;
122 return fieldName +
"='" + currentKey +
'\'';
124 return fieldName +
"<>'" + currentKey +
'\'';
134 mComboBox->setCurrentIndex( 0 );
139 mComboBox->setEnabled( enabled );
144 mComboBox = qobject_cast<QComboBox *>( editor );
149 mComboBox->insertItem( 0, tr(
"Please select" ), QString() );
151 connect( mComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsValueMapSearchWidgetWrapper::comboBoxIndexChanged );
161 str = QStringLiteral(
"%1 = '%2'" )
163 exp.replace(
'\'', QLatin1String(
"''" ) ) );
static QString quotedColumnRef(QString name)
Returns a quoted column reference (in double quotes)
QgsField at(int i) const
Returns the field at particular index (must be in range 0..N-1).
static void populateComboBox(QComboBox *comboBox, const QVariantMap &configuration, bool skipNull)
Populates a comboBox with the appropriate entries based on a value map configuration.
Represents a vector layer which manages a vector based data sets.