class myClass : public QObject{
Q_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();
}