Skip to content

Commit fbbb320

Browse files
committed
use lambda to set value to null
1 parent 8a22667 commit fbbb320

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/gui/qgsfeaturelistcombobox.cpp

+3-7
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ QgsFeatureListComboBox::QgsFeatureListComboBox( QWidget *parent )
5353

5454
mLineEdit = new QgsFilterLineEdit();
5555
mLineEdit->setSelectOnFocus( true );
56-
connect( mLineEdit, &QgsFilterLineEdit::cleared, this, &QgsFeatureListComboBox::setValueToNull );
56+
//set value of combo to null if delete button is pressed
57+
connect( mLineEdit, &QgsFilterLineEdit::cleared, this, [ = ] { if ( allowNull() ) setCurrentIndex( nullIndex() ); } );
58+
5759
setEditable( true );
5860
setLineEdit( mLineEdit );
5961
setModel( mModel );
@@ -256,9 +258,3 @@ void QgsFeatureListComboBox::LineEditState::restore( QLineEdit *lineEdit ) const
256258
if ( selectionStart > -1 )
257259
lineEdit->setSelection( selectionStart, selectionLength );
258260
}
259-
260-
void QgsFeatureListComboBox::setValueToNull()
261-
{
262-
if ( allowNull() )
263-
setCurrentIndex( nullIndex() );
264-
}

src/gui/qgsfeaturelistcombobox.h

-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ class GUI_EXPORT QgsFeatureListComboBox : public QComboBox
200200
void storeLineEditState();
201201
void restoreLineEditState();
202202
void onDataChanged( const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>() );
203-
void setValueToNull();
204203

205204
private:
206205
struct LineEditState

0 commit comments

Comments
 (0)