title: Modal QProgressDialog updated from worker thread
body: <p>I want to update a <strong>modal</strong> QProgressDialog from my worker thread. However, if I set the dialog to be modal, my application crashes (and the dialog did not show any progress). If I do not, everything goes fine (but the user can tinker around with the rest of the program, which may cause issues).</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Minimum code sample follows:</p>
  
  <pre><code>filereader qfr;    
  
  QProgressDialog progress("Importing file.", "Cancel", 0, file_size);
  
  connect(&amp;qfr, &amp;filereader::signalProgress, &amp;progress, &amp;QProgressDialog::setValue, Qt::QueuedConnection);
  
  QThread worker_thread;
  
  std::atomic&lt;bool&gt; success = false;
  
  connect(&amp;worker_thread, &amp;QThread::started,
          [&amp;]() {
      success = qfr.read_file(/* parameters */);
      worker_thread.quit();});
  
  worker_thread.start();
  
  //progress.setWindowModality(Qt::WindowModal); // Works only fine when this line is commented !!
  
  while (worker_thread.isRunning()) {
      QApplication::processEvents();
      QThread::sleep(0);
  }
  
  progress.close();
  </code></pre>