Hi,

i am writing a program which calculates the irradiation dose for cancer treatment. This can take some time, so my idea was, to show up a simple dialog with a progress-bar in it. I dont know really how to do it because when the dialog is started, the program stops as long it is opened.

I like to implement such an interface:
Qt Code:
  1. class ProgressDialog : public QWidget {
  2. public:
  3. signalProgress(); //the bar should move a bit to right
  4. setTotalProgress(int); //maxValue of progress bar
  5. }
To copy to clipboard, switch view to plain text mode 

My programm is a console program actually. I dont want to do all the calulation stuff in a window. So - how should i implement the main() function. My idea was like following, but this won't work:

Qt Code:
  1. void doComplicatedStuff(ProgressDialog& pd){
  2. while(calculating){
  3. someCalculation;
  4. pd.signalProgress();
  5. }
  6. }
  7.  
  8. main(argc,argv){
  9. QApplication a(argc,argv);
  10. ProgressDialog pd;
  11. pd.show();
  12. doComplicatedStuff(pd);//no dialog visible
  13. return a.exec(); //here, the dialog pops up - swapping last lines is no solution
  14. }
To copy to clipboard, switch view to plain text mode 

So what can i do instead? I hope, you can help me.
Thanks! Thanks! Thanks!

Cheers