Skip to content
Permalink
Browse files

set value to null when pressed lineedit-clearbutton

  • Loading branch information
signedav committed Oct 4, 2018
1 parent 13d2586 commit 713192f7106214588561945225628059796acc08
Showing with 8 additions and 0 deletions.
  1. +7 −0 src/gui/qgsfeaturelistcombobox.cpp
  2. +1 −0 src/gui/qgsfeaturelistcombobox.h
@@ -54,6 +54,7 @@ QgsFeatureListComboBox::QgsFeatureListComboBox( QWidget *parent )

mLineEdit = new QgsFilterLineEdit();
mLineEdit->setSelectOnFocus( true );
connect( mLineEdit, &QgsFilterLineEdit::cleared, this, &QgsFeatureListComboBox::setValueToNull );
setEditable( true );
setLineEdit( mLineEdit );
setModel( mModel );
@@ -249,3 +250,9 @@ void QgsFeatureListComboBox::LineEditState::restore( QLineEdit *lineEdit ) const
if ( selectionStart > -1 )
lineEdit->setSelection( selectionStart, selectionLength );
}

void QgsFeatureListComboBox::setValueToNull()
{
if ( allowNull() )
setCurrentIndex( nullIndex() );
}
@@ -200,6 +200,7 @@ 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

0 comments on commit 713192f

Please sign in to comment.
You can’t perform that action at this time.