Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-19176

keyPressEvent fails to register

    XMLWordPrintable

Details

    Description

      The first time my application receives a keyPressEvent for a "4" key pressed in my keyboard, it registers it wrong. They QKeyEvent::key() should return 52, but it actually returns 126. QKeyEvent::text() returns "4" as expected.

      This only happens for the first "4" I press, as the next inputs work as expected: key() returns 52 and text() returns "4".

      I'm pretty sure this bug only happens on Windows (tested on 7 and XP), and not on GNU/Linux.

      I'm attaching a minimal test case. I've tested it pressing keys 1, 2, 3, 4, 4 again, and 5.

      Expected output:

      49 "1"
      50 "2"
      51 "3"
      52 "4"
      52 "4"
      53 "5"

      Actual output:

      49 "1"
      50 "2"
      51 "3"
      126 "4"
      52 "4"
      53 "5"

      Attachments

        1. keyeventtest.pro
          0.3 kB
          Ismael Barros²
        2. main.cpp
          0.2 kB
          Ismael Barros²
        3. mainwindow.cpp
          0.4 kB
          Ismael Barros²
        4. mainwindow.h
          0.3 kB
          Ismael Barros²
        5. mainwindow.ui
          0.6 kB
          Ismael Barros²

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              kleint Friedemann Kleint
              raziel Ismael Barros²
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes