title: qt thread with movetothread
body: <p>I'm trying to create a program using threads:
  the main start with a loop.
  When a test returns true, I create an object and I want  that object to work in an other thread
  then return and start the test .</p>
  
  <pre><code>QCoreApplication a(argc, argv);
  while(true){
      Cmd cmd;
      cmd =db-&gt;select(cmd);
      if(cmd.isNull()){ 
          sleep(2);  
          continue ;
      }
      QThread *thread = new QThread( );
      process *class= new process ();
      class-&gt;moveToThread(thread);
      thread-&gt;start();
  
      qDebug() &lt;&lt; " msg"; // this doesn't run until  class finish it's work 
  }
  return a.exec();
  </code></pre>
  
  <p>the problem is when i start the new thread the main thread stops and wait for the new thread's finish .</p>