...class MyTask: public QThread{Q_OBJECTprotected: void run();signals: void mymess(int);private: int N;};...
...extern bool FlagStop;void MyTask::run(){ QString S; N=0; do { if (FlagStop == 1) { break; } msleep(500); emit mymess(N); N++; } while (N<1000);}...
...connect(task,SIGNAL(mymess(int)),this,SLOT(PrintMess()));...
C++ (Qt)void MyTask::abort(){ /*this->*/FlagStop = 1;}
C++ (Qt)class MainWindow : ...{ ...protected slots: void PrintMess(int K);};
private slots: void PrintMess(int K);
connect(task,SIGNAL(mymess(int)),this,SLOT(PrintMess(int)));