You should never access widgets and GUI-related things directly from a thread other than the main thread. Also, calling functions from an object in another thread directly is illegal and leads to crashes and undefined.
The correct way to update the progress bar is to use the signal slot mechanism. Just connect the signal from the stream to the slot of your widget, which updates the progress bar. Each time you want to set a new value, simply issue a signal. The signal may also contain an argument containing the percentage of completion.
source share