Hi, I have a problem with the GUI for a laser beam propagation simulation I am currently writing with C++ and QT. The simulation itself works, but I implemented a dialog which should actually update a plot, using QCustomPlot and a progressBar. Unfortunately, the QDialog only appears after all the calculations are done, showing the plot of the final result and a progress bar at 100%.

Is there any way to make sure my dialog is actually visible during the calculations?

Here is how I create the dialog, after the preceding information has been processed:
Qt Code:
  1. void bpmSettings::runBPM()
  2. {
  3. //...
  4. bpmdialog *b = new bpmdialog;
  5. b->show();
  6. this->close();
  7. }
To copy to clipboard, switch view to plain text mode 
Here is the header of the dialog:
Qt Code:
  1. #ifndef BPMDIALOG_H
  2. #define BPMDIALOG_H
  3.  
  4. #include <QDialog>
  5. #include "vector2d.h" // a vector class I wrote which the simulation is based on
  6.  
  7. extern GaussData globalData;
  8.  
  9. namespace Ui {
  10. class bpmdialog;
  11. }
  12.  
  13. class bpmdialog : public QDialog
  14. {
  15. Q_OBJECT
  16.  
  17. public:
  18. explicit bpmdialog(QWidget *parent = 0);
  19. ~bpmdialog();
  20.  
  21. private:
  22. Ui::bpmdialog *ui;
  23. void envPlot(const vector2d<double>& field); // plots the vector2d field by using the QCustomPlot widget in the ui.
  24. void bpm(); // starts simulation
  25. };
  26.  
  27. #endif // BPMDIALOG_H
To copy to clipboard, switch view to plain text mode 
And this is how my implementation of the dialog looks like:
Qt Code:
  1. bpmdialog::bpmdialog(QWidget *parent) :
  2. QDialog(parent),
  3. ui(new Ui::bpmdialog)
  4. {
  5. ui->setupUi(this);
  6. bpm();
  7. }
To copy to clipboard, switch view to plain text mode 
I hope I provided enough information. The bpm() method is basically a for loop calculating a new 2d field in every iteration, by using a Gauss Seidel algorithm to solve a linear system. The 2d field is then plotted with the envPlot(field) method in every iteration.

Thank you very much in advance for your help!
Best regards,
Richard