28#include "moc_qgsvaluemapsearchwidgetwrapper.cpp"
30using namespace Qt::StringLiterals;
40 auto combo =
new QComboBox( parent );
41 combo->setMinimumContentsLength( 1 );
42 combo->setSizeAdjustPolicy( QComboBox::SizeAdjustPolicy::AdjustToMinimumContentsLengthWithIcon );
46void QgsValueMapSearchWidgetWrapper::comboBoxIndexChanged(
int idx )
98 return fieldName +
" IS NULL";
100 return fieldName +
" IS NOT NULL";
103 if ( mComboBox->currentIndex() == 0 )
106 const QString currentKey = mComboBox->currentData().toString();
110 case QMetaType::Type::Int:
111 case QMetaType::Type::UInt:
112 case QMetaType::Type::Double:
113 case QMetaType::Type::LongLong:
114 case QMetaType::Type::ULongLong:
117 return fieldName +
'=' + currentKey;
119 return fieldName +
"<>" + currentKey;
126 return fieldName +
"='" + currentKey +
'\'';
128 return fieldName +
"<>'" + currentKey +
'\'';
138 mComboBox->setCurrentIndex( 0 );
143 mComboBox->setEnabled( enabled );
148 mComboBox = qobject_cast<QComboBox *>( editor );
153 mComboBox->insertItem( 0, tr(
"Please select" ), QString() );
155 connect( mComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsValueMapSearchWidgetWrapper::comboBoxIndexChanged );
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 dataset.