while (queryDevice.next()){ MyThread *thread = new MyThread(); thread->setObjectName(queryDevice.value(0).toString()); }
while (queryDevice.next()){ MyThread *thread = new MyThread(); threads.append(thread); thread->setObjectName(queryDevice.value(0).toString()); connect(this, SIGNAL(StringSignal(QString , QString)), thread, SLOT(StringSlot(QString , QString))); }...... if(threads.at(0)=="0024") threads.at(0)->start();
while (queryDevice.next()){ MyThread *thread = new MyThread(); threads.append(thread); thread->setObjectName(queryDevice.value(0).toString()); connect(this, SIGNAL(StringSignal(QStringList)), thread, SLOT(messageFomMtHostTh(QStringList))); connect(thread, SIGNAL(StringSignalToMain(QString)), this, SLOT(slotWriteToMtHost(QString))); connect(thread, SIGNAL(logMtHost(QString)), this, SLOT(slotLogFromMtHost(QString))); connect(thread, SIGNAL(logPostgres(QString)), this, SLOT(slotLogFromPostgres(QString))); connect(thread, SIGNAL(logServer(QString)), this, SLOT(slotLogFromServer(QString))); connect(thread, SIGNAL(finished()), this, SLOT(slotThFinished())); }
if(!threads.at(i)->isFinished()) threads.at(i)->start(); list.append(threads.at(i)->objectName()); qDebug()<<threads.at(i)->objectName()<<thread()->currentThread(); //"0024" QThread(0x889c58) threads.at(i)->messageFomMtHostTh(list);
virtual void run() { qDebug()<<currentThreadId()<<currentThread(); //0xf30 MyThread(0x7b62a0, name = "0024") //делаем что то в контексте нового потока exec(); //запускаем обработку очереди сообщений потока }
thread()->currentThread()->objectName(); //пустая строка
timer->stop(); emit finished();..... if (thread()->isFinished()) qDebug()<<thread()->currentThread();