Skip to content

Commit f0b0aea

Browse files
committedOct 25, 2018
controll clear button by edit-state
because it has to appear on edit-mode, otherwise not
1 parent 2e01811 commit f0b0aea

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed
 

‎python/gui/auto_generated/qgsfeaturelistcombobox.sip.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ The index of the currently selected item.
125125
virtual void keyPressEvent( QKeyEvent *event );
126126

127127

128+
virtual bool event( QEvent *event );
129+
130+
128131
signals:
129132

130133
void modelUpdated();

‎src/gui/qgsfeaturelistcombobox.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,14 @@ void QgsFeatureListComboBox::keyPressEvent( QKeyEvent *event )
203203
QComboBox::keyReleaseEvent( event );
204204
}
205205

206+
bool QgsFeatureListComboBox::event( QEvent *event )
207+
{
208+
if ( event->type() == QEvent::EnabledChange )
209+
mLineEdit->setShowClearButton( true );
210+
211+
return QComboBox::event( event );;
212+
}
213+
206214
bool QgsFeatureListComboBox::allowNull() const
207215
{
208216
return mModel->allowNull();

‎src/gui/qgsfeaturelistcombobox.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ class GUI_EXPORT QgsFeatureListComboBox : public QComboBox
147147

148148
void keyPressEvent( QKeyEvent *event ) override;
149149

150+
bool event( QEvent *event ) override;
151+
150152
signals:
151153

152154
/**

0 commit comments

Comments
 (0)
Please sign in to comment.