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. What are the wait and quit of QThread for?

What are the wait and quit of QThread for?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 868 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.
  • S Offline
    S Offline
    stereomatching
    wrote on last edited by
    #1

    @
    ~Controller() {
    workerThread.quit();
    workerThread.wait();
    }
    @

    In the document of QThread(Qt5.2.1), the destructor of the Controller(The class which launch the task) call the functions quit and wait.Why do we need to call them after we already connect the thread to deleteLater?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dbzhang800
      wrote on last edited by
      #2

      It's easy to understand that, when the thread finished, we should delete it.
      @
      connect(workerThread, &QThread::finished, worker, &QObject::deleteLater);
      @

      But, how to make the thread finished?

      @
      workerThread.quit();
      workerThread.wait();
      @

      1 Reply Last reply
      0

      • Login

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