Hi there. I'd like to know what is the proper way of using moveToThread function. I have QTcpSocket object as a member of QThread derived class. I've got some warning messages about thread affinity. To solve that I call moveToThread inside my thread class:

Qt Code:
  1. class MyDownloadingThread: public QThread
  2. {
  3. //...
  4. protected:
  5. QTcpSocket socket;
  6. //...
  7. }
  8.  
  9. //....
  10.  
  11. MyDownloadingThread::MyDownloadingThread(ParentThread *parentThread)
  12. {
  13. this->parentThread = parentThread;
  14. this->socket.moveToThread(this);
  15. }
To copy to clipboard, switch view to plain text mode 

Is it correct? Or maybe I should call moveToThread after starting the target thread?