Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Key_Space event problem
Minz last edited by
Hi everyone, i'm developing a typing tutor application, on one of my widgets i have a QTextBrowser and some QPushbuttons for the keyboard layout. I implement keyPressEvent such that when a user types the text browser is updated, however when i push the space button one of the QPushbuttons on the keyboard layout is catching the event. I've tried @setFocusPolicy@ but it doesnt seem to work. Help would be much appreciated.
ChrisW67 last edited by
You need to put the focus somewhere other than a QPushbutton or pressing space (maybe enter) will trigger it. Normally users would type into a QTextEdit and it would have the focus but you seem to be avoiding that. If you cannot place the focus elsewhere then you should be able to install an event filter on the QPushButtons (either from outside or by subclassing) and block Qt::Key_Space keyboard events for that button.