Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Performing/ignoring modifiers in a QKeySequence?
I currently have a QPushButton which grabs the keyboard input once it's clicked, and then waits for a hotkey-combination until it releases the keyboard again.
I'm experiencing that the QKeyEvent has a key() attribute which is modified by the shift key, so when I'm hitting Ctrl+Meta+4, it reads it as Ctrl+Meta+$. I need it to be interpreted as Ctrl+Meta+4 as I am using a QKeySequence for QxtGlobalShorcut to register a global hotkey.
The QKeySequence is instantiated using QKeySequence(keyEvent->modifiers() + keyEvent->key()).
So my idea for a solution might be to somehow trigger a modifier on the key sequence and modifying the contents (e.g. sending "trigger shift key" inverts the $ back to 4) or don't take literal input from X11. How could I do this? Or better yet, do you know a better solution?
Thanks in advance.
andre last edited by
Are you sure that this is a good idea? Notice that not all keyboards have these symbols at the same places. So, you can't be sure that $ and 4 are only a shift key away from each other...
No, I'm not sure that this approach is a good idea, though, I don't know another solution.
The reason why I'm doing this is because when I'm registering a hotkey with QxtGlobalShorcut and the QKeySequence is "Shift+Meta+$", it doesn't react, but when it's "Shift+Meta+4", it does.