> Sent: Wednesday, August 03, 2016 at 1:22 PM > From: "Jorge Fierro" <jo...@jorgefierro.com> > To: interest@qt-project.org > Subject: [Interest] Relationship between a QEventLoop and > QCoreApplication::exec(). > > Hi. I've been reading through the documentation and mailing list > archives and I haven't found an authoritative and/or conclusive answer to > the following question: > > What exactly is the relationship between an event loop entered by > calling QEventLoop::exec() and *the* main event loop (the one running > when you can QCoreApplication::exec())? > > There are a number of related questions: > > - Does QEventLoop::exec() enter *the* main event loop? Or, > - Does QEventLoop::exec() enter a different event loop independent > from QCoreApplication::exec()? > - Can QEventLoop::exec() be called outside QCoreApplication::exec() > (i.e., in a call stack that didn't originate from > QCoreApplication::exec())? > - If QEventLoop::exec() spins the main loop then any event at all can > be generated. Is this why one must use it very carefully to avoid > reentrancy issues?
As far as I know QCoreApplication::exec() does call QEventLoop::exec(). A thread can have a event loop, and cross-thread signal/slot communication is done via messages in each thread's event loop. A thread may have more than one event loop. (I think I used this in the past to handle some modal dialog issues. I think while the second event loop is running that the first is unresponsive.) HTH. _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest