I am trying to set up a simple QProgressDialog while a for loop is taking place without using mutlithreading. I followed the Keeping the GUI Responsive but I cannot get it working:

Qt Code:
  1. QProgressDialog progress("Copying files...", "Abort Copy", 0, myModel->model->rowCount(), this);
  2. progress.setWindowModality(Qt::WindowModal);
  3. // progress.show();
  4.  
  5.  
  6. for( int i = 0; i< linesetIndexes.size()-1; i++ )
  7. {
  8.  
  9. progress.setValue(i);
  10. QCoreApplication::processEvents();
  11. if (progress.wasCanceled())
  12. break;
  13. ......//proccessing
  14.  
  15.  
  16. }
To copy to clipboard, switch view to plain text mode