[Qt-interest] Is there a way to process all queued events before continuing?

william.crocker at analog.com william.crocker at analog.com
Wed Dec 16 17:58:32 CET 2009


>>
>> Thanks for the reply. I'm trying to clear all pending events in my 
>> secondary thread's event queue. Doesn't processEvents do this for my 
>> main Gui thread? (not what I want to do). There's no 
>> QThread::ProcessEvents() function... I'm looking for such an analog.
>>
>> -Preet
>>     
> Interesting question. QEventLoop has a processEvents, but I don't see a 
> method in QThread to access the thread's event loop... Perhaps the 
> source could give you a pointer if there is an (undocumented) loophope 
> to get it anyway?
>
>   
I've written my own GUI testing framework based on recording and then
playing back events and one of my on going problems is how to know
when all of the side effects of synthetic event posted to the GUI thread
by the play back thread have completed such that it is time to send the
next event.

I wish I could scrutinize the main GUI event queue to see what
remains to be done. Just processing all events for some period of
time is not sufficient as the execution of some activities involves the
scheduling of other parts at a non-zero time in the future. I could
wait for 100 ms, lets say, but when running under Purify or valgrind
that might not be sufficient.

And, you can't just post all events, because the the main GUI thread
reenters the main event loop as part of processing an event (due to
use of QStatusBar::showMessage and QProgressBar for example.)

Bill



More information about the Qt-interest-old mailing list