I tried to put a QWebSocket
connection into a QThread
QThread *thread = new QThread;
connect(&websocket,&QWebSocket::connected,this,&Widget::onWsConnect);
websocket.moveToThread(thread);
connect(thread, &QThread::finished, &websocket, &QObject::deleteLater);
websocket.open(wsUrl);
thread->start();
The program compiled without errors and is running normal, but when it tried to connect to the websocket server throws this error:
QObject::connect: Cannot queue arguments of type 'QAbstractSocket::SocketState' (Make sure 'QAbstractSocket::SocketState' is registered using qRegisterMetaType().)
When I do
websocket.open(wsUrl);
without threading the connection works fine.
Any ideas?