Qt-jambi-interest Archive, March 2007
QProgressBar percent text
Message 1 in thread
If minimum/maximum is specified as 0/0, the progress bar displays
continuous progress but the percentage label is still present w/o any
text which doesn't allow the progress bar to fill up that space. It
makes the dialog look a bit strange.
Message 2 in thread
Vadim Berezniker wrote:
> If minimum/maximum is specified as 0/0, the progress bar displays
> continuous progress but the percentage label is still present w/o any
> text which doesn't allow the progress bar to fill up that space. It
> makes the dialog look a bit strange.
>
Hi, Vadim.
I agree this should at least be consistent between styles. Right now it
seems that Plastique is the only style which does not reserve space for
the missing text on the indeterminate progress bar. I have registered
this as a bug for our Qt team.
As a fix for your application, you can use the function setTextVisible()
in QProgressBar:
QProgressBar bar = new QProgressBar();
bar.setMaximum(0);
bar.setMinimum(0);
bar.setTextVisible(false);
bar.show();
Thank you for the report!
-- Eskil
Message 3 in thread
Eskil A. Blomfeldt wrote:
> Vadim Berezniker wrote:
>
>> If minimum/maximum is specified as 0/0, the progress bar displays
>> continuous progress but the percentage label is still present w/o any
>> text which doesn't allow the progress bar to fill up that space. It
>> makes the dialog look a bit strange.
>>
>
> Hi, Vadim.
>
> I agree this should at least be consistent between styles. Right now it
> seems that Plastique is the only style which does not reserve space for
> the missing text on the indeterminate progress bar. I have registered
> this as a bug for our Qt team.
>
> As a fix for your application, you can use the function setTextVisible()
> in QProgressBar:
>
> QProgressBar bar = new QProgressBar();
> bar.setMaximum(0);
> bar.setMinimum(0);
> bar.setTextVisible(false);
> bar.show();
> Thank you for the report!
>
> -- Eskil
I actually did try that. The problem, it seems, is that QProgressBar
seems to provide its own timer if you use the default progress bar. It's
not a big deal but I was trying to avoid adding unnecessary stuff.
Message 4 in thread
Vadim Berezniker wrote:
>>> If minimum/maximum is specified as 0/0, the progress bar displays
>>> continuous progress but the percentage label is still present w/o
>>> any text which doesn't allow the progress bar to fill up that space.
>>> It makes the dialog look a bit strange.
>>>
>>
>> bar.setTextVisible(false);
>
>
> I actually did try that. The problem, it seems, is that QProgressBar
> seems to provide its own timer if you use the default progress bar.
> It's not a big deal but I was trying to avoid adding unnecessary stuff.
Hi, Vadim.
I'm not quite sure I'm understanding the problem here. Was the issue not
that QProgressbar reserved space for an empty text label? This can, at
least, be avoided by setting the textVisible property to false. This
should also work if you are subclassing QProgressBar. Did I
misunderstand the question? :-)
-- Eskil
Message 5 in thread
Eskil A. Blomfeldt wrote:
> Vadim Berezniker wrote:
>
>>>> If minimum/maximum is specified as 0/0, the progress bar displays
>>>> continuous progress but the percentage label is still present w/o
>>>> any text which doesn't allow the progress bar to fill up that space.
>>>> It makes the dialog look a bit strange.
>>>>
>>>
>>> bar.setTextVisible(false);
>>
>>
>> I actually did try that. The problem, it seems, is that QProgressBar
>> seems to provide its own timer if you use the default progress bar.
>> It's not a big deal but I was trying to avoid adding unnecessary stuff.
>
>
> Hi, Vadim.
>
> I'm not quite sure I'm understanding the problem here. Was the issue not
> that QProgressbar reserved space for an empty text label? This can, at
> least, be avoided by setting the textVisible property to false. This
> should also work if you are subclassing QProgressBar. Did I
> misunderstand the question? :-)
>
> -- Eskil
>
>
If I use the default progress bar, it automatically moves.
If I use setBar() to set a different one, it does not. While I get the
benefit of not having the text label, I get the burden of updating the
progressbar. At least that's my understanding.
Message 6 in thread
Vadim Berezniker wrote:
>
> If I use the default progress bar, it automatically moves.
> If I use setBar() to set a different one, it does not. While I get the
> benefit of not having the text label, I get the burden of updating the
> progressbar. At least that's my understanding.
Hi again, Vadim.
Are we talking about QProgressDialog?
If so, this code works for me:
QProgressDialog dialog = new QProgressDialog();
QProgressBar bar = new QProgressBar(dialog);
bar.setMaximum(0);
bar.setMinimum(0);
bar.setTextVisible(false);
dialog.setBar(bar);
dialog.exec();
The progress bar is animated in this example, and does not have the
extra space for the label.
-- Eskil
Message 7 in thread
Eskil A. Blomfeldt wrote:
> Vadim Berezniker wrote:
>
>>
>> If I use the default progress bar, it automatically moves.
>> If I use setBar() to set a different one, it does not. While I get the
>> benefit of not having the text label, I get the burden of updating the
>> progressbar. At least that's my understanding.
>
>
> Hi again, Vadim.
>
> Are we talking about QProgressDialog?
>
> If so, this code works for me:
>
> QProgressDialog dialog = new QProgressDialog();
> QProgressBar bar = new QProgressBar(dialog);
> bar.setMaximum(0);
> bar.setMinimum(0);
> bar.setTextVisible(false);
> dialog.setBar(bar);
> dialog.exec();
>
>
> The progress bar is animated in this example, and does not have the
> extra space for the label.
>
> -- Eskil
>
I will have to try it again later. When I tried it, it didn't move.
Message 8 in thread
Vadim Berezniker wrote:
>>
>> The progress bar is animated in this example, and does not have the
>> extra space for the label.
>>
>> -- Eskil
>>
>
> I will have to try it again later. When I tried it, it didn't move.
It was my mistake. I assumed a new QProgressBar is initialized with 0/0
minimum/maximum. It started working once I set the maximum to zero. Sorry.