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

Key release event is not delivered when a widget is disabled

    XMLWordPrintable

Details

    Description

      The issue is reproducible with the attached example. The program is a modification to examples/tutorial/widgets/toplevel. I added a button with an event filter. The filter traps key events and when it gets a key press that is not an autorepeat and is equivalent to 'Ctrl+D', it disables the main window and fires a single-shot timer which will re-enable the main window and refocus the button.

      Run the application in the debugger with trace points enabled (solution provided with trace points). Click the button to focus it and press and release 'Ctrl+D'. You will see the window grey out for three seconds and will not see the KeyRelease events. Once the window is re-enabled, press and release 'Ctrl+D' again. You will notice that nothing happens. This is because no one handled the KeyRelease event from before and so Qt thinks it's an autorepeat. My code filters out autorepeats, so the 'Ctrl+D' is not handled the second time. If you repeat these actions, you will see the KeyPress events alternate between autorepeat and non-autorepeat.

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            mpejcoch Martin Pejcoch (Inactive)
            Votes:
            19 Vote for this issue
            Watchers:
            14 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes