I have a Qt application that has two threads: the main thread that handles the GUI and a second thread that manages network connections. Here is the thread code:
void thread::run()
{
QTcpServer server;
server.connect(&server,SIGNAL(newConnection()),this,SLOT(OnConnect()));
//...
}
When I put a breakpoint at the start of OnConnect()
and debug the application, it announces that OnConnect()
is being called from the main thread!
How can I have OnConnect()
run in the same thread as the QTcpServer
?