Calling Sleep() You are blocking a thread and event loop. Window is repainted in more when one event. Just replace Sleep() with mySleep like this :
Qt Code:
  1. void MainWindow::mySleep( int ms )
  2. {
  3. QEventLoop loop;
  4.  
  5. QTimer::singleShot(ms,&loop,SLOT(quit()));
  6. loop.exec();
  7. }
To copy to clipboard, switch view to plain text mode