Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Nested QEventLoop

Nested QEventLoop

Scheduled Pinned Locked Moved Unsolved General and Desktop
qeventloopqeventqapplication
2 Posts 2 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • PhoenoxP Offline
    PhoenoxP Offline
    Phoenox
    wrote on last edited by
    #1

    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?
    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved