Could you explain me the QKeyEvent::nativeModifiers() and key() methods ?



  • Hi,

    I'm using Windows.
    I use Qt Creator 4.0.2, (Qt 5.7.0)
    I'm currently writing a custom widget which needs it's own key handler. No problem to install it, using QKeyEvent.
    My questions are about two methods of this class.

    1. QKeyEvent::nativeModifiers() return elements of the structure I found by chance here.

    The questions are :

    • where is that structure documented ?
    • why the nativeModifiers() method don't return the native modifiers, as described in the WinAPI doc. Reading the source of translateKeyEventInternal shows that the real native codes are returned for nativeVirtualKey() and nativeScanCode (see lParam and wParam), why not for nativeModifiers() ?
    • is there a way to get the real native modifiers ?
    1. QKeyEvent::key() should return the Qt::Key who triggered the event.
      So when pressing a single key, let say 'D', I should get 0x44 (Qt::Key_D). But I get 0x6B7CDF4F
      When I press Shift, I get 0x6BC7DF4F.
      Could you explain me that behaviour, please, I can't figure out how it works...

    Thanks in advance, I spent a lot of hours in the docs and in the source without success. Any help will be appreciated :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.