title: Qt - GUI freezing
body: <p>I wrote in C++ a solver for the 8-puzzle game, and now I'm trying to use Qt to give it a GUI.</p>
  
  <p>Basically I have an underlying object of type "Board" which represents the board of the puzzle, and I have organized the GUI as a grid of QPushButton. Then I have a method updateUI which associates to every button the correct text, based on the Board. Something like</p>
  
  <pre><code>    for(int i=0; i&lt;Board::MATRIX_DIM * Board::MATRIX_DIM; i++)
      {
          m_buttons[i]-&gt;setText(m_values[i]);
      }
  </code></pre>
  
  <p>In another method (solveGUI) I have</p>
  
  <pre><code>void MainWindow::solveGUI()
  {
      m_game-&gt;solve();
      int solutionDepth = m_game-&gt;getSolutionDepth();
      Move *solutionMoves = m_game-&gt;getSolutionMoves();
      for(int i=0; i&lt;solutionDepth; i++)
      {
          Move m = solutionMoves[i];
          m_board.performMove(m);     /* perform the move on the Board object */
          updateUI();       /* should update the GUI so that it represents the Board */
          Sleep(1000);
      }
  }
  </code></pre>
  
  <p>where the first line (m_game->solve) takes some time. Then I obtain a list of the moves performed, in solutionMoves, and what I would like to do is showing this moves on the board, with some delay between a move and the next one. This method is called by my main, which looks like this:</p>
  
  <pre><code>QApplication app(argc, argv);
  MainWindow w;
  w.show();
  w.solveGUI();
  
  return app.exec();
  </code></pre>
  
  <p>The result is that the GUI hangs and, after some time, it displays only the solution, completely skipping the moves.</p>
  
  <p>What am I missing? Thank you!</p>
  
  <p>P.S. I don't think I need a different Thread for the solver because I want the solver to run <em>before</em> the solution is displayed. Is it right?</p>