Cannot create children for a parent that is in a different thread.

在线程中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);//错误
}

猜你喜欢

转载自blog.csdn.net/sinat_33859977/article/details/100107994