moveToThread()
C++ (Qt)Thread::Thread(QObject *parent): QThread(parent){ moveToThread(this);} void Thread::run(){ exec();}
Thread::slot_time_out
Qt::QueueConnection
C++ (Qt)Thread::Thread(QObject*parent): QThread(parent){ } void Thread::run(){ QTimer *timer = new QTimer(); connection(timer,SIGNAL(timeOut()),this,SLOT(slot_time_out())); timer->start(500); exec();} void Thread::slot_time_out(){//}
connection(timer,SIGNAL(timeOut()),this,SLOT(slot_time_out()),Qt::DirectConnection);
Thread::slot_time_out()
QObject::connect(src, SIGNAL(itemChanged(int)), dst, SLOT(itemChanged(int))); // Qt::AutoConnection
C++ (Qt)EchoThread::EchoThread(int socketDescriptor,QObject*parent = 0): QThread(parent),m_SocketDescriptor(socketDescriptor){ } void EchoThread::run(){ m_client = new QTcpSocket(); ... connect(m_client,SIGNAL(readyRead()),this,SLOT(onRead),Qt::DirectConnection); exec();} void EchoThread::onRead(){ QByteArray block = m_client->readAll;}
moveToThread(this)
C++ (Qt)Thread::Thread(QObject*parent): QThread(parent){ } void Thread::run(){ QTimer *timer = new QTimer(); connection(timer,SIGNAL(timeOut()),this,SLOT(slot_time_out())); //тип Qt::DirectConnection указывать //или не надо??? timer->start(500); exec();} void Thread::slot_time_out(){//}
C++ (Qt) connection(timer,SIGNAL(timeOut()),this,SLOT(slot_time_out())); //тип Qt::DirectConnection указывать //или не надо???