【Qt-QThread】

Qt编程指南

  • ■ QThread

■ QThread

#include 
class myThread : public QThread
{
    Q_OBJECT
signals:
    downloaded(int);
public:
    myThread();
    void run()
    {
        for(int i=0;i<100; i++)
        {
            //p1->setValue(i);
            emit downloaded(i);
            QThread::sleep(2);
        }
    }
};
t2 = new myThread;
t2->start();




你可能感兴趣的:(#,Qt,qt,开发语言)