Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Could you explain me the QKeyEvent::nativeModifiers() and key() methods ?
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
nativemodifiersqkeyeventkey
1 Posts 1 Posters 989 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • FolcoF Offline
    FolcoF Offline
    Folco
    wrote on last edited by Folco
    #1

    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 :)

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved