Код: Выделить всё
QThread testThr;
QObject* testObj = new QObject;
testObj->moveToThread(&testThr);
connect(&testThr, &QThread::started, [&]
{
// Do something
});
//connect(&testThr, &QThread::finished, testObj, &QObject::deleteLater);
testThr.start();
// Do something
testThr.quit();
testThr.wait();
// Do something with testObj
delete testObj; // Is this OK?
Подробнее здесь: https://stackoverflow.com/questions/796 ... s-finished
Мобильная версия