If Qt doesn't already handle this (and I would think it did, but could be mistaken), then you'll need to do a bit more than just handle the key press event in the combo box. When you are selecting an item for a combo box, another window has been shown with the list of items in it. You would need to handle the key press event for that window, somehow.
To do that, I would suggest inheriting from QComboBox
, and install an event filter on the pop up that is shown (look at the showPopup()
, hidePopup()
, and view()
functions). Make a slot that connects to the highlighted
signal, and keep track of which index is highlighted. Then, when the popup window gets a space key event, hide the popup and set the current index to the last highlighted index.