Struggling with QProgressBar
-
Hi,
another thread with the QProgressBar not showing. I read all the others carefully, but they do not solve the problem. I played a lot with the progress dialog and made two observations. My situation is: I have a task that takes very long. The counters to show progress are large. To reach the first percent it takes minutes. The code I use is the one for a modal progress dialog. This is necessary as everything must be blocked until the task terminates or is cancelled.
My observations are:
-
If I set my target count as maximum and use my progress count in setValue(), the progress dialog never shows up. It took me several projects with a progress dialog failing to realize that things somehow changed for QT5 and QProgressBar only seems to operate properly in the range 0..100. -> Ok, I do the calculation on my own and pass a value between 0..100. That is working with medium size tasks. The value changes, I can press the cancel button. Good.
-
If the task is a real bastard size one QProgressDialog does not show up for a long time. And then it won't update. No cancel button, no progressbar. Nothing. Yes, I tried calling processEvents(). But that creates just many GUI glitches I would like to avoid. And it does not make the progress dialog updating properly either. And as documentation states, QProgressDialog should process events on it's own anyway. It took me some time to find out, it only processes events when the value really changes. Calling setValue() with the same progress seems not to trigger the event loop. However that would be necessary to a) show the widget properly b) operate the cancel button.
Somehow 1) and 2) make it impossible to get the progress dialog to work as expected. Do I miss something obvious? Or is it a bug?
Thanks for input
Oliver
-
-
Hi,
If you can reproduce that with a minimal compilable example then it's likely to be a bug.