title: Qt UI Threading Problems
body: <p>OK so i have asked a couple of questions specifically about QFuture which is what im currently using to thread my UI application.</p>
  
  <p>Basically i have a function in a class that takes a long time so naturally i wanted it threaded so when called from my UI class it didnt just lock up my UI. </p>
  
  <p>I then implemented a QFutureWatcher to wait for the finished() signal at which point it would start another function that took ages in a new thread (this one however was doing things to the UI). I used the same code to implement the second threaded function however this one still locks up my UI.</p>
  
  <p>i have come to conclusions which may be entirely wrong but i cant seem to find out why its not working so all i can do is assume and ask here...</p>
  
  <p>Maybe i cant have 2 QFuture's using QConcurrentRun</p>
  
  <p>Cant use QFuture with ui stuff (in my case QGraphicsView adding to scene)</p>
  
  <p>if anyone has suggestions that would be great, iv read in another post  i should maybe subclass QObject but no example was given so i couldnt really implement this because i didnt know what kind of functionality i was meant to even be re implementing ..</p>
  
  <p>TLDR: HOW TO THREAD A FUNCTION THAT DOES THINGS TO UI (adding to QGraphicsScene)</p>
  
  <p>code sample, this is the function that takes ages because i call this function from a different functions loop a few hundred thousand times, takes about 30 seconds to complete in which time the UI is not responding </p>
  
  <pre><code>void GUI::paintSomething(double x, double y)
  {
      /// Decalre a QPen for Painting dots
      QPen pen;
  
      // set the pen colour
      pen.setColor(Qt::white);
  
      // Add ellipse at the x y position passed in
      scene-&gt;addEllipse(x, y, 1.5, 1.5, pen, QBrush(Qt::SolidPattern));
  }
  </code></pre>
  
  <p>Thread code, paint all being the function that calls paintSomething</p>
  
  <pre><code>*future2 = QtConcurrent::run(this, &amp;GUI::paintAll);
  
  // Set watcher to look at QFuture futre2
  watcher2-&gt;setFuture(*future2);
  </code></pre>