Skip to content

Commit a5981f3

Browse files
committedOct 30, 2018
use lambda to set value to null
cherry-picked from fbbb320
1 parent 11ebdee commit a5981f3

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed
 

‎src/gui/qgsfeaturelistcombobox.cpp

Lines changed: 3 additions & 7 deletions
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

Lines changed: 0 additions & 1 deletion
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)
Please sign in to comment.