[Qt-interest] Correct way to manage the main event loop without QApplication::exec()

Nikos Chantziaras realnc at arcor.de
Sat Mar 20 15:39:58 CET 2010


On 03/20/2010 12:07 PM, Andreas Pakulat wrote:
>>   Right now, I simply call qApp->processEvents() whenever I get the
>>   chance.  But I'm doing that without ever having called
>>   QApplication::exec().  It does seem to work, but I simply don't know
>>   whether there are any complications besides this one:
>>
>>     In event you are running a local loop which calls this
>>     function continuously, without an event loop, the
>>     DeferredDelete  events will not be processed.
>>
>> I assume the part that says "without an event loop" means "without ever
>> having called qApp->exec()".
>
> No it means not running an eventloop, there's QEventLoop as separate class
> which can be used "standalone" (and thats also done in some places like
> QDialog::exec()). You can also pass the necessary flags to processEvents to
> also process deferred-deletes.

AFAICT, it's not possible with processEvents():

   QEventLoop::DeferredDeletion deprecated - do not use.



More information about the Qt-interest-old mailing list