title: Help me understand the QThread usage
body: <p>I have the <code>MainWindow w</code> windows and <code>TestThread testThread</code> as a member of <code>w</code>. I know it i simple, but I cannot run the <code>testThread.foo()</code> method in <code>testThread</code> thread (not in window thread). In another words: I don't understand the QThread behavior.</p>
  
  <p>Please help correct the next test application. There is a <code>QProgressBar *MainWindow::ui::progressBar</code> and <code>QPushButton *MainWindow::ui::startButton</code> (write simply). I want to start (by <code>startButton</code> click) <code>TestThread::foo(int* progress)</code> which will increment <code>int progress</code> each second.</p>
  
  <p>MainWindow:</p>
  
  <pre><code>MainWindow::MainWindow(QWidget *parent) : // ...
  {
      // ...
  
      ui-&gt;progressBar-&gt;setRange(0, 5);
      progress = 0; // int MainWindow::progress
  
      this-&gt;connect(ui-&gt;startButton, SIGNAL(clicked()), SLOT(startFoo()));
  
      connect(this, SIGNAL(startFooSignal(int*)), &amp;testThread, SLOT(foo(int*)));
          // TestThread MainWindow::testThread
  
      testThread.start();
  }
  
  // ...
  
  void MainWindow::timerEvent(QTimerEvent *event)
  {
      ui-&gt;progressBar-&gt;setValue(progress);
  }
  
  void MainWindow::startFoo() // this is a MainWindow SLOT
  {
      startTimer(100);
      emit startFooSignal(&amp;progress);
          // startFooSignal(int*) is a MainWindows SIGNAL
  }
  </code></pre>
  
  <p>TestThread:</p>
  
  <pre><code>void TestThread::foo(int *progress) // this is a TestThread SLOT
  {
      for (unsigned i = 0; i &lt; 5; ++i) {
          sleep(1);
          ++*progress; // increment MainWindow::progress
      }
  }
  </code></pre>
  
  <p>I know, this is simple. I am doing something wrong :)</p>
  
  <p><strong>P.S.</strong> I want to run the simpliest (as possible) example to understand the <code>QThread</code> behavior.</p>
  
  <p>Thanks!</p>