Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.7.2, 4.8.5
-
Windows
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.