0

I have a QWizard subclass that for some pages, it will take a long time calling a method, so I want to put in a QProgressBar. My first thought is I created a QTimer and setup a method to gets called to updateProgressBar, but it seems that this runs in the same thread as the Wizard, so only gets updated when the QWizard is not busy. How can I get this to run in another thread?

CptanPanic
  • 609
  • 8
  • 22

2 Answers2

0

Move your long running task into a worker thread that is a subclass of QThread. Have the worker thread emit a signal to indicate its progress (percent complete, if you can know that), and connect that signal to your progress bar's setValue(int) slot.

kenrogers
  • 1,350
  • 6
  • 17
0

Thanks, I ended creating a QThread object in my QWizard class and calling moveToThread to move objects to thread. Such as http://www.developer.nokia.com/Community/Wiki/How_to_move_a_QObject_to_a_thread

CptanPanic
  • 609
  • 8
  • 22