I have a requirement to hold a key to open a widget which grabs all user input, and release that key to go back to normal.
So I add codes to mainwindow's keyReleaseEvent() function when autorepeat is on, the codes install an event filter using qApp->installEventFilter(). And this event filter quits at the keyReleaseEvent() function of my widget class.
If I go without this event filter, holding a key and release generates the following events:
KeyPress
KeyRelease autorepeat
KeyPress autorepeat
KeyRelease autorepeat
KeyPress autorepeat
...
...
KeyRelease

With this event filter, I will get the following events:
KeyPress
KeyRelease autorepeat (My event filter install here)
My Widget eventFilter: KeyRelease autorepeat
My Widget eventFilter: KeyPress autorepeat
My Widget eventFilter: KeyRelease autorepeat
My Widget eventFilter: KeyPress autorepeat
...
...
My Widget eventFilter: KeyRelease autorepeat
My Widget eventFilter: KeyPress autorepeat
My Widget eventFilter: KeyRelease (My event filter quits here)
KeyPress autorepeat

The problem is about the last KayPress event, which is an autorepeat one. It looks quite evil to me. Why I get this additional event? What I want is to make sure the last event I got is KeyRelease, not KeyPress!