Skip to content

Commit

Permalink
controll clear button by edit-state
Browse files Browse the repository at this point in the history
because it has to appear on edit-mode, otherwise not

cherry-picked from f0b0aea
  • Loading branch information
signedav committed Oct 30, 2018
1 parent cb1172b commit 47243dc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/gui/auto_generated/qgsfeaturelistcombobox.sip.in
Expand Up @@ -125,6 +125,9 @@ The index of the currently selected item.
virtual void keyPressEvent( QKeyEvent *event );


virtual bool event( QEvent *event );


signals:

void modelUpdated();
Expand Down
8 changes: 8 additions & 0 deletions src/gui/qgsfeaturelistcombobox.cpp
Expand Up @@ -203,6 +203,14 @@ void QgsFeatureListComboBox::keyPressEvent( QKeyEvent *event )
QComboBox::keyReleaseEvent( event );
}

bool QgsFeatureListComboBox::event( QEvent *event )
{
if ( event->type() == QEvent::EnabledChange )
mLineEdit->setShowClearButton( true );

return QComboBox::event( event );;
}

bool QgsFeatureListComboBox::allowNull() const
{
return mModel->allowNull();
Expand Down
2 changes: 2 additions & 0 deletions src/gui/qgsfeaturelistcombobox.h
Expand Up @@ -147,6 +147,8 @@ class GUI_EXPORT QgsFeatureListComboBox : public QComboBox

void keyPressEvent( QKeyEvent *event ) override;

bool event( QEvent *event ) override;

signals:

/**
Expand Down

0 comments on commit 47243dc

Please sign in to comment.