16,203
社区成员
发帖
与我相关
我的任务
分享
#include <QtGui/QApplication>
#include <QtGui/QDialog>
#include <QtCore/QThread>
#include <iostream>
class Thread:public QThread
{
public:
Thread():QThread(0){}
protected:
void run()
{
int num;
for (int i=0; i<10; ++i) {
std::cin>>num;
std::cout<<"ok:"<<num<<std::endl;
}
}
};
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QDialog w;
w.show();
Thread t;
t.start();
return a.exec();
}