What are the wait and quit of QThread for?



  • @
    ~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?



  • 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();
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.