main.cpp
int main()
{
MyThread a;
MyThread b;
a.start();
b.start();
a.wait();
b.wait();
}
mythread.h
class MyThread : public QThread
{
public:
virtual void run();
};
mythread.cpp
void MyThread::run()
{
for(int count=0;count<20;count++)
{
sleep(1);
qDebug("Ping!");
}
}