Worker::Worker(int startPlace, QObject *parent):QThread()//позиция, откуда следует начинать путь{ x = 25.5; //абсцисса всегда такая, ибо это сразу после начальной стены y = startPlace*25+25.5; this->parent = parent; myPeople = NULL;}void Worker::run(){ emit makeWorker(this, x, y); moveTimer = new QTimer( this ); connect( moveTimer, SIGNAL(timeout()), this, SLOT(onTimerDown()) ); moveTimer->start( 50 ); qDebug("%d", this->currentThreadId()); exec();}void Worker::onTimerDown(){ qDebug("%d onTimerDown", this->currentThreadId()); emit moveWorker(this, myPeople);}
C++ (Qt)void Worker::run(){ emit makeWorker(this, x, y); QTimer moveTimer; connect( &moveTimer, SIGNAL(timeout()), this, SLOT(onTimerDown()) ); moveTimer.start( 50 ); qDebug("%d", this->currentThreadId()); exec();}