I'm reviewing some part of a project written with Qt:
void Editor::keyPressEvent(QKeyEvent* event)
{
int key = event->key();
switch (key) {
case Qt::Key_Tab:
...
I've put a breakpoint at int key = event->key()
.
Now, I've notice that pressing the minus "-" on the keypad shows me in debug:
Pressed 'Minus' (key:45 vKey:65453)
Qt::Key_Minus (0x002d)
Then, pressing "-" (the hyphen on the hyphen/underscore key gives me:
Pressed 'Minus' (key:45 vKey:45)"
Qt::Key_Minus (0x002d)
1439241440
So they are definitely detected as different (judging from this "vKey" number) but the event is the same: "Key_Minus".
Why can't I get the "Key_hyphen" event? How could I solve this (maybe using this "vKey" number?
CodePudding user response:
Try
event->nativeVirtualKey();
and
event->nativeScanCode();