Reputation: 8292
I have a QComboBox
, which is editable, I implemented the keyPressEvent(QKeyEvent *)
method, but it does not seem to fire this method.
I can think of the only reason this happens is that whatever editing that occurs is actually happening in lineEdit object and We should implement keyPressEvent(QKeyEvent *) of line Edit. How can I achieve this?
Upvotes: 0
Views: 418
Reputation: 98425
You have two options:
Install an event filter on the lineEdit
widget.
Use setLineEdit
to replace the existing widget with your own subclass that reimplements the event handler.
Upvotes: 1