Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
use lambda to set value to null
- Loading branch information
Showing
with
3 additions
and
8 deletions.
-
+3
−7
src/gui/qgsfeaturelistcombobox.cpp
-
+0
−1
src/gui/qgsfeaturelistcombobox.h
|
@@ -53,7 +53,9 @@ QgsFeatureListComboBox::QgsFeatureListComboBox( QWidget *parent ) |
|
|
|
|
|
mLineEdit = new QgsFilterLineEdit(); |
|
|
mLineEdit->setSelectOnFocus( true ); |
|
|
connect( mLineEdit, &QgsFilterLineEdit::cleared, this, &QgsFeatureListComboBox::setValueToNull ); |
|
|
//set value of combo to null if delete button is pressed |
|
|
connect( mLineEdit, &QgsFilterLineEdit::cleared, this, [ = ] { if ( allowNull() ) setCurrentIndex( nullIndex() ); } ); |
|
|
|
|
|
setEditable( true ); |
|
|
setLineEdit( mLineEdit ); |
|
|
setModel( mModel ); |
|
@@ -256,9 +258,3 @@ void QgsFeatureListComboBox::LineEditState::restore( QLineEdit *lineEdit ) const |
|
|
if ( selectionStart > -1 ) |
|
|
lineEdit->setSelection( selectionStart, selectionLength ); |
|
|
} |
|
|
|
|
|
void QgsFeatureListComboBox::setValueToNull() |
|
|
{ |
|
|
if ( allowNull() ) |
|
|
setCurrentIndex( nullIndex() ); |
|
|
} |
|
@@ -200,7 +200,6 @@ class GUI_EXPORT QgsFeatureListComboBox : public QComboBox |
|
|
void storeLineEditState(); |
|
|
void restoreLineEditState(); |
|
|
void onDataChanged( const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>() ); |
|
|
void setValueToNull(); |
|
|
|
|
|
private: |
|
|
struct LineEditState |
|
|