MyThread : public QThread{ MyThread() { QTcpSocket socket = new QTcpSocket(); ...... ...... ...... } void socketWrite(QByteArray str) { socket->write(str); }}
class MyThread : public QThread{ MyThread() { } void run() { QTcpSocket* socket = new QTcpSocket(); QObject::connect(socket, SIGNAL(readyRead()), this, SLOT(SockerRead())); }}
C++ (Qt)class MyThread : public QThread{ MyThread() { } void run() { QTcpSocket* socket = new QTcpSocket(); QObject::connect(socket, SIGNAL(readyRead()), this, SLOT(SockerRead())); exec(); } }
C++ (Qt) void run() { QTcpSocket* socket = new QTcpSocket(); QObject::connect(socket, SIGNAL(readyRead()), this, SLOT(SockerRead())); exec(); } }
C++ (Qt)void MyThread::run(){ QTcpSocket* socket = new QTcpSocket(); QObject::connect(socket, SIGNAL(readyRead()), this, SLOT(SockerRead())); QThread::run(); // или exec()}