谢谢你,我还不太清除怎么使用QTread ,是不是在一个.h 文件中声明类
例如: #include <qthread.h>
#include <qmessagebox.h>
#include<unistd.h>
class MyThread : public QThread
{
public:
virtual void run() ;
};
在.cpp文件中:
#include "thread.h"
void MyThread::run()
{
for( int count = 0; count < 20; count++ ) {
sleep( 1 );
// qDebug( "Ping!" );
QMessageBox::information( 0, "", ("thread!!") );
}
}
之后就可以在其他文件中:
int main()
{
MyThread a;
MyThread b;
a.start();
b.start();
a.wait();
b.wait();
}
请指教,很原意交对QT感兴趣的朋友,QQ:43885970 我是西安电子科技大学的学生