I'm using a QProgressDialog with the limits (0, 0) to show something during a sqlite query and preparing the results to show. The QProgressDialog window stays in blank all the time, not matter if the process took 1 second or minute. My code is something like:



Qt Code:
  1. QProgressDialog dialog(this);
  2. dialog.setLabelText("Updating");
  3. dialog.setMinimun(0)
  4. dialog.setMaximum(0);
  5. dialog.show();
  6. try
  7. {
  8. // here I call a function that executes a sql query to a sqlite database and then updates the whole interface with the result.
  9. dialog.accept();
  10. }
  11. catch (QString e)
  12. {
  13. QMessageBox::critical(this, "Error - " + qApp->applicationName(), e);
  14. qApp->exit(1);
  15. }
To copy to clipboard, switch view to plain text mode 

Reading other post I have seen that in cases of a long during process is better to use another thread instead of the main one. It's this correct? Can I block the program during the process so the user can't interact with it when using another thread?