如何确保在运行QT后删除我的线程。我试图将完成的信号连接到我创建的删除插槽但它无效。
答案 0 :(得分:3)
//Destructor Connections
connect(this, SIGNAL(finished()), &cThread, SLOT(quit()));
connect(this, SIGNAL(finished()), this, SLOT(deleteLater()));
connect(&cThread, SIGNAL(finished()), &cThread, SLOT(deleteLater()));
这适用于C ++