I am writing an accessibility tool using Qt which will allow the user to operate the mouse using only the keyboard. People who just really hate mice can use it too.
The unique challenges of this application are stretching what is possible with Qt, but luckily Qt is elastic.
The user presses Caps Lock to activate the tool, after which the tool steals focus. A grid appears on the screen and the user presses keys which move the mouse smaller amounts each time.
Pressing 0 left mouse clicks, and the grid disappears. Adding Alt double clicks.
Pressing Shift 0 should right mouse click, and pressing Ctrl Shift 0 should middle click.
The problem I am facing is that, while on my keyboard, Shift+0
will result in a QKeyEvent(QKeyEvent.KeyPress, Qt.NoModifier, Qt.Key_ParenRight)
(so, a )
), this is not at all guaranteed. If my computer is in Japanese IME, I will get a QKeyEvent(QKeyEvent.KeyPress, Qt.ShiftModifier, Qt.Key_0)
.
Help, how can I get information I need about the user's current keyboard layout so I can choose the right Qt.KeyEvent to listen for?