[Qt-interest] Intercept Esc and Return/Enter keys in a QComboBox line edit
Luper Rouch
luper.rouch at gmail.com
Tue Mar 10 16:24:40 CET 2009
I would like to make a QComboBox that acts like this :
* if the last item is selected:
* make the combo box editable,
* select the text in the combo box line edit then,
* if the user presses Esc: return the combo box to its initial state
* if the user presses Return, Enter or the focus leaves the combo
box:
* insert the edited text as a new item in the combo box
* return the combo box to its initial, non editable state
What I have done is almost working, except that when Esc or Return is
pressed, the key press is also passed to the parent dialog, which closes
it. How could I "trap" the key press in the line edit while it's being
edited ?
Thanks,
Luper
More information about the Qt-interest-old
mailing list