#include <QThread>
class OpenProThread : public QThread
{
Q_OBJECT
public:
OpenProThread(QObject *parent = 0)
{
}
~OpenProThread()
{}
protected:
virtual void run()
{
//……
//你的操作
//……
}
private:
};
//在另外一个类中使用
void proManDlg::OnStartProcess()
{
OpenProThread thread ;
thread.start(); //这样会挂掉,windows上提示这样的QT current thread was not started with Qthread
}
//这样就成功启动了OpenProThread 线程
void proManDlg::OnStartProcess()
{
OpenProThread * pThread = new OpenProThread();
pThread->start();
}