0124デフォルトの名無しさん
2020/09/28(月) 22:01:36.75ID:iMi4NbKwQ_OBJECT
private:
QThread* th;
public:
myClass();
virtual ~myClass(){}
pulic slots:
void fin();
signals:
void thread_quit();
};
myClass():th(new QThead()){
connect(
this,
&myClass::thread_quit,
th,
[&]{ th->quit(); th->wait(); delete th; }
);
moveToThread(th);
// other initializations
th->start();
}
void myClass::fin(){
moveToThread(th->thread());
emit thread_quit();
}