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

André Somers andre at familiesomers.nl
Thu Dec 17 18:28:23 CET 2009


Hi Bradley,

 

Ah
 ok
 I missed the “for the calling thread” part. Interesting; I would not
have noticed or searched that myself there. I would have assumed (I know,
never assume, always read docs) that QCoreApplication::processEvents would
work for the global event loop. Perhaps a remark in the QThread
documentation would be in order?

 

Thanks,

 

André

 

 

On Wed, Dec 16, 2009 at 11:46 AM, Bradley T. Hughes <
<mailto:bradley.hughes at nokia.com> bradley.hughes at nokia.com> wrote:

Andre Somers wrote:
> Preet wrote:
>> Hi,
>>
>> 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'll do you one better, here's how do to it (and it's documented):

http://qt.nokia.com/doc/4.6/qcoreapplication.html#processEvents

"void QCoreApplication::processEvents ( QEventLoop::ProcessEventsFlags flags
= QEventLoop::AllEvents )   [static]

Processes all pending events for the calling thread according to the
specified flags until there are no more events to process."

--
Bradley T. Hughes (Nokia-D-Qt/Oslo), bradley.hughes at nokia.com
Sandakervn. 116, P.O. Box 4332 Nydalen, 0402 Oslo, Norway

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091217/cb337eaa/attachment.html 


More information about the Qt-interest-old mailing list