Hi guys!

I've got the following situation:

Somewhere in my GUI I start a lengthy computation in my BackgroundImageItem which inherits from QThread:

Qt Code:
  1. BackgroundImageItem* back = new BackgroundImageItem(filename);
  2. // let the worker thread work:
  3. back->start();
To copy to clipboard, switch view to plain text mode 

to inform the user that the application is working, I have written the following simple self-updating Progressbar:

Qt Code:
  1. class ThreadedProgressBar : public QThread, public QProgressBar
  2. {
  3. public:
  4. ThreadedProgressBar(QWidget * parent)
  5. : QProgressBar(parent)
  6. {
  7. this->setGeometry(
  8. (parent->width() - 300)/2,
  9. (parent->height()-30)/2,
  10. 300, 30);
  11. this->setTerminationEnabled(true);
  12. this->start();
  13. };
  14. void run()
  15. {
  16. while(true)
  17. {
  18. this->setValue((this->value()+20)%100);
  19. this->update();
  20. this->msleep(100);
  21. }
  22. };
  23. virtual ~ThreadedProgressBar();
  24. };
To copy to clipboard, switch view to plain text mode 

What I did then to show this ThreadedProgressbar was:

Qt Code:
  1. BackgroundImageItem* back = new BackgroundImageItem(filename);
  2. // let the worker thread work:
  3. back->start();
  4. //start the progressBar,
  5. //note: this->parentWidget() is the main widget of my app
  6. ThreadedProgressBar * pbar = new ThreadedProgressBar(this->parentWidget());
  7. // Join the gui thread with the worker thread
  8. back->wait();
  9. // a thread must be terminated before being deleted
  10. pbar->terminate();
  11. //clean up
  12. delete pbar;
To copy to clipboard, switch view to plain text mode 


BUT THE PROGRESS BAR DOES NOT SHOW UP !!!!

I'm sure I just did a small mistake!

Thanks for zour help in advance,
best regards,
Olli