Nested QEventLoop
Unsolved
General and Desktop
-
I have a general question regarding nested QEventLoops:
So imagine having a local QEventLoop running inside a QApplication.
How is the management of events organized between the main event loop and the local one?
Especially:- At the time I call
QEventLoop::exec()
on the local one, will it also take "ownership" of the events still remaining in the main event loop? Or will those events only be processed when the local event loop exits? - If new events arrive at the main event loop, will they also be processed by the local event loop, or does the latter need to finish first?
- At the time I call
-
Events are not posted to a particular instance of an event loop object. They are posted to a thread. An event loop object does not "own" any events. It's basically a while loop that calls processEvents of a per thread event dispatcher.
That being said if you nest event loops they all process the same pile of events. It's just that only the top one gets to do it while the calling ones wait for it to return.