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

Add this prompt when the new object in the thread:
Cannot create children for a parent that is in a different thread.
Just remove this

void SocketThread::run()
{
    
    
    qDebug() << "线程1:" << QThread::currentThread();
    QTcpSocket *m_socket = new QTcpSocket(this);//错误
}

Guess you like

Origin blog.csdn.net/sinat_33859977/article/details/100107994