QProgressbar resets to -1
-
Hi,
I was wondering why our progressbars in the dialogs never reached the maximum.
The backend only increased the value by a delta, which was then handled in the dialog with something like:myBar->SetValue(myBar->value() + delta);
As it turned out the Progressbar initializes with value = -1.
Why is that?best,
Megamouse -
@Megamouse Is it possible that at some point
myBar->value() + delta
were bigger than what you set using setRange()?
-
@jsulm actually from what I remember, set range does not change the current value.
e.g
value == 20 -> setRange(0,10) -> value still at 20I don't know why its done, but creating a QProgressBar or calling reset() on an existing one will set the current value to -1;
I would assume that this is done, to allow the valueChanged() signal to be emitted when the value is set to 0?
-
@jsulm no the value wasn't exceeding the max. (but that was another issue later as you can read below)
I think this whole implementation is simply weird.
as J.Hilk said: the reset and init of any progressbar/dialog set the value to minimum-1 (apart from the QWinTaskBarProgress).
Also apart from that... any increase/decrease above/below the min and max just returns without doing anything.....
I think that is just wrong. the progressbar should always increase until max is reached. There is no logical explanation for this choice of implementation ...