QShortcut blocks keyPressEvent
-
wrote on 31 Mar 2025, 09:06 last edited by
Hi,
I've set up some configurable QShortcuts in our project. They are then attached to the QWindow.
I also use keyPressEvents to get normal user input in the window.The problem is that as soon as the user presses a shortcut, there is no propagation of the keyPressEvent anymore.
So for example if you press Shift+M and a shortcut is setup for that, then there will only be a Shift event but no M event. The shortcut works of course, but now it's impossible for the user to enter uppercase M unless they use capslock.Is there a way to tell QShortcut to keep propagating the event?
-
Hi,
I've set up some configurable QShortcuts in our project. They are then attached to the QWindow.
I also use keyPressEvents to get normal user input in the window.The problem is that as soon as the user presses a shortcut, there is no propagation of the keyPressEvent anymore.
So for example if you press Shift+M and a shortcut is setup for that, then there will only be a Shift event but no M event. The shortcut works of course, but now it's impossible for the user to enter uppercase M unless they use capslock.Is there a way to tell QShortcut to keep propagating the event?
wrote on 31 Mar 2025, 13:01 last edited by Pl45m4Hi,
QEvent::ShortcutOverride
might be the right thing for you in this case.
(override the shortcut when typing text) -
wrote on 1 Apr 2025, 08:20 last edited by
Thank you!
I'll take a look and report back
1/3