Drop Queued keyboard and mouse events
-
Is there a way to turn off queueing of keyboard and mouse events?
What I want:
If a keyboard event comes in before the previous event has been processed it does't get added the the event queue; it will get dropped.What happens:
In my event queue thread (main application thread) I can make calls that can block for up to 2 seconds. While the thread is blocking, if the user presses some keys they will be queued up and processed after the block is done. The problem I am facing is sometimes the users key events will cause more 2 second blocking calls and cause even more queueing. This will make my GUI pretty much stop and is not my desired affect. I don't mind if the GUI freezes for 2 seconds here or there, but it's when the gui freezes for minutes it's a problem. -
Blocking calls in the GUI threads sounds quite evil. Why not put those into a background thread? Make it signal the foreground thread once something is done. Simply use Qt's thread-aware signal-slot mechanism.
Hope, you don't mind for my short recipe;)
-
I don't think your architecture is all right. Anyways, there was something to eat queued events... QCoreApplication::processEvents(). Maybe, you want to give it a try. Of course you can't do it directly in QML.