combobox steal keyboard from main window in pyqt
I'm writing a small pyqt program. I want the main window to to react to
arrow movement. I added an event to my MainGui class, keyPressEvent, that
handle this. The event work fine as long as I don't press certain buttons
such as Key_Up or Key_Down are directed to my (currently only) QComboBox
and not to my mainGui. I tried to give the focus to mainGui after each
paintEvent but then I need to double click on buttons/comboBox.
Then I tried to use the MousePressEvent to check if a certain element is
under the mouse. This work fine with the comboBox, but not with the
button.
So, how can I direct key events to the mainGui or give the focus to QButtons?
No comments:
Post a Comment