The QT docs are clear that QTCPSocket should not be used in streams. IE, create a QTCPSocket in the main thread and bind the signal to an object in another thread.
I suspect that you are implementing something like a web server where the listener creates a QTCPSocket upon acceptance. Then you want another thread to handle the processing task of this socket. You can not.
As I worked around, I kept the socket in the stream in which it was born. I served all incoming data in this thread and threw it into a queue where another thread could work on this data.
Michael
source share