在线程中new对象时添加this提示:
Cannot create children for a parent that is in a different thread.
去掉this就好了
void SocketThread::run()
{
qDebug() << "线程1:" << QThread::currentThread();
QTcpSocket *m_socket = new QTcpSocket(this);//错误
}
在线程中new对象时添加this提示:
Cannot create children for a parent that is in a different thread.
去掉this就好了
void SocketThread::run()
{
qDebug() << "线程1:" << QThread::currentThread();
QTcpSocket *m_socket = new QTcpSocket(this);//错误
}