16,213
社区成员
发帖
与我相关
我的任务
分享
class MyThread : public QThread
{
Q_OBJECT
public:
MyThread();
~MyThread();
void Something();
public slots:
void OnSomething();
};
MyThread::MyThread()
{
this->start();
this->moveToThread(this);
}
MyThread::~MyThread()
{
this->exit();
for (int i = 0; i < 10 && this->isRunning(); ++i)
{
this->wait(1);
}
}
void MyThread::Something()
{
QMetaObject::invokeMethod(this, "OnSomething", Qt::QueuedConnection);
}
void MyThread::OnSomething()
{
}