28#include "moc_qgsvaluemapsearchwidgetwrapper.cpp"
30using namespace Qt::StringLiterals;
39 auto combo =
new QComboBox( parent );
40 combo->setMinimumContentsLength( 1 );
41 combo->setSizeAdjustPolicy( QComboBox::SizeAdjustPolicy::AdjustToMinimumContentsLengthWithIcon );
45void QgsValueMapSearchWidgetWrapper::comboBoxIndexChanged(
int idx )
97 return fieldName +
" IS NULL";
99 return fieldName +
" IS NOT NULL";
102 if ( mComboBox->currentIndex() == 0 )
105 const QString currentKey = mComboBox->currentData().toString();
109 case QMetaType::Type::Int:
110 case QMetaType::Type::UInt:
111 case QMetaType::Type::Double:
112 case QMetaType::Type::LongLong:
113 case QMetaType::Type::ULongLong:
116 return fieldName +
'=' + currentKey;
118 return fieldName +
"<>" + currentKey;
125 return fieldName +
"='" + currentKey +
'\'';
127 return fieldName +
"<>'" + currentKey +
'\'';
137 mComboBox->setCurrentIndex( 0 );
142 mComboBox->setEnabled( enabled );
147 mComboBox = qobject_cast<QComboBox *>( editor );
152 mComboBox->insertItem( 0, tr(
"Please select" ), QString() );
154 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.