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. Missing keyEvents for Qt::Key_Alt

Missing keyEvents for Qt::Key_Alt

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 554 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.
  • A Offline
    A Offline
    Audetto
    wrote on 18 Jun 2020, 15:54 last edited by Audetto
    #1

    Ubuntu - Gnome - X11 - Qt 5.12.8

    I am logging all keys pressed using

    keyPressEvent(QKeyEvent *event)

    and

    keyReleaseEvent(QKeyEvent *event)

    It works for all keys except Qt::Key_Alt (ok the windows key gives nothing but this is expected)

    Imagine I press and release twice

    All keys will give me

    Press - Event
    Release - Event
    Press - Event
    Release - Event

    for Alt I get

    Press - Event
    Release - No event triggered
    Press - No event triggered
    Release - Event

    Why is that? Has it to do with GNOME?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      Kent-Dorfman
      wrote on 28 Jun 2020, 04:55 last edited by
      #2

      Yes.. GNOME is an abomination....and the underlying X11 system receives the alt scancode but "something" is mofidying the behaviour.

      install and use xev to see what the native X11 system is generating.

      1 Reply Last reply
      2
      • A Offline
        A Offline
        Audetto
        wrote on 4 Jul 2020, 19:53 last edited by
        #3

        I tried xev and the events reported for Alt and AltGr are similar, one for press and one for release.
        From this I can only imagine Qt is doing something to filter it.

        KeyPress event, serial 37, synthetic NO, window 0x5200001,
        root 0x143, subw 0x0, time 48633066, (480,-15), root:(833,969),
        state 0x10, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
        XKeysymToKeycode returns keycode: 92
        XLookupString gives 0 bytes:
        XmbLookupString gives 0 bytes:
        XFilterEvent returns: False

        KeyRelease event, serial 37, synthetic NO, window 0x5200001,
        root 0x143, subw 0x0, time 48633218, (480,-15), root:(833,969),
        state 0x90, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
        XKeysymToKeycode returns keycode: 92
        XLookupString gives 0 bytes:
        XFilterEvent returns: False

        KeyPress event, serial 37, synthetic NO, window 0x5200001,
        root 0x143, subw 0x0, time 48634514, (480,-15), root:(833,969),
        state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
        XLookupString gives 0 bytes:
        XmbLookupString gives 0 bytes:
        XFilterEvent returns: False

        KeyRelease event, serial 37, synthetic NO, window 0x5200001,
        root 0x143, subw 0x0, time 48634650, (480,-15), root:(833,969),
        state 0x18, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
        XLookupString gives 0 bytes:
        XFilterEvent returns: False

        1 Reply Last reply
        0
        • K Offline
          K Offline
          Kent-Dorfman
          wrote on 4 Jul 2020, 20:02 last edited by
          #4

          Don't assume it is Qt. Many modern abonimation desktop environments layer that stuff to hide it from the Luser, because we all know low level is dangerous and folks should not be trusted with anything but point-n-click...but I digres. You may/probably have a keyboard management layer that is remapping keysyms.

          Now that you understand xev, you should learn about xmodmap.
          http://xahlee.info/linux/linux_xmodmap_tutorial.html

          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