| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 7 | |
I have tried everything I can think of to get a QProgressBar to show a
busy indicator and have failed. The Qt documentation claims that
setting the minimum and maximum values, but this does nothing but create
a static progress bar that doesn't move at all.
QProgressBar *progressBar = new QProgressBar(NULL);
progressBar->setMaximumHeight(16);
progressBar->setMaximumWidth(200);
progressBar->setTextVisible(false);
((QMainWindow*)parent())->statusBar()->addPermanentWidget(progressBar, 0);
((QMainWindow*)parent())->statusBar()->showMessage(QString("Loading"));
progressBar->setValue(0);
progressBar->setMinimum(0);
progressBar->setMaximum(0);
I have also tried incrementing the value of the progressBar
progressively and have also tried doing nothing with the value of the
progress bar - but both of these make no difference. Does anybody know
what I might be doing wrong? Any help is greatly appreciated. Thanks,
Chris Portka
--
[ signature omitted ]
Chris Portka wrote:
> I have tried everything I can think of to get a QProgressBar to show a
> busy indicator and have failed. The Qt documentation claims that
> setting the minimum and maximum values, but this does nothing but create
> a static progress bar that doesn't move at all.
>
> QProgressBar *progressBar = new QProgressBar(NULL);
> progressBar->setMaximumHeight(16);
> progressBar->setMaximumWidth(200);
> progressBar->setTextVisible(false);
> ((QMainWindow*)parent())->statusBar()->addPermanentWidget(progressBar, 0);
> ((QMainWindow*)parent())->statusBar()->showMessage(QString("Loading"));
> progressBar->setValue(0);
> progressBar->setMinimum(0);
> progressBar->setMaximum(0);
>
> I have also tried incrementing the value of the progressBar
> progressively and have also tried doing nothing with the value of the
> progress bar - but both of these make no difference. Does anybody know
> what I might be doing wrong? Any help is greatly appreciated. Thanks,
> Chris Portka
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
Chris,
It works fine here by setting the min/max to 0 as the docs say. Are you using the Plastique style?
It seems to not work with that style on XP, but any others styles work. I'm not sure why on
Plastique it behaves like this.
regards,
--stathis
Attachment:
Attachment:
smime.p7s
Attachment:
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature
Message 3 in thread
> It works fine here by setting the min/max to 0 as the docs say. Are you using the Plastique style?
> It seems to not work with that style on XP, but any others styles work. I'm not sure why on
> Plastique it behaves like this.
Hi
I remember bumping into this problem too. I had to set a non-zero
value (in together with min/max 0) to get the busy indicator appear
with plastique style.
progressBar->setValue(1); // <--
progressBar->setMinimum(0);
progressBar->setMaximum(0);
--
[ signature omitted ]
Message 4 in thread
J-P Nurmi wrote:
>> It works fine here by setting the min/max to 0 as the docs say. Are
>> you using the Plastique style?
>> It seems to not work with that style on XP, but any others styles
>> work. I'm not sure why on
>> Plastique it behaves like this.
> Hi
>
> I remember bumping into this problem too. I had to set a non-zero
> value (in together with min/max 0) to get the busy indicator appear
> with plastique style.
>
> progressBar->setValue(1); // <--
> progressBar->setMinimum(0);
> progressBar->setMaximum(0);
>
That's right. Actually any setValue(X) triggers the busy indicator is
min/max is 0, even a reset() has the same effect in the plastique style.
progressBar->setMaximum(0);
progressBar->setMinimum(0);
progressBar->reset();
sounds like a bug to me, but even so at least there is a way to get it
working.
--stathis
--
[ signature omitted ]
Message 5 in thread
On 4/26/07, Stathis <stathis@xxxxxxxxxxxxxxxx> wrote:
> That's right. Actually any setValue(X) triggers the busy indicator is
> min/max is 0, even a reset() has the same effect in the plastique style.
>
> progressBar->setMaximum(0);
> progressBar->setMinimum(0);
> progressBar->reset();
>
> sounds like a bug to me, but even so at least there is a way to get it
> working.
Report it to Trolltech then so they can fix it :)
qt-bugs (at) trolltech (dot) com
--
[ signature omitted ]
Message 6 in thread
Robin Ericsson wrote:
> On 4/26/07, Stathis <stathis@xxxxxxxxxxxxxxxx> wrote:
>> That's right. Actually any setValue(X) triggers the busy indicator is
>> min/max is 0, even a reset() has the same effect in the plastique style.
>>
>> progressBar->setMaximum(0);
>> progressBar->setMinimum(0);
>> progressBar->reset();
>>
>> sounds like a bug to me, but even so at least there is a way to get it
>> working.
>
> Report it to Trolltech then so they can fix it :)
> qt-bugs (at) trolltech (dot) com
>
None of your suggestions work - and I am not using the Plastique style.
I have tried several styles and they all have the same behavior. I
point you once again to the code I posted:
QProgressBar *progressBar = new QProgressBar(NULL);
progressBar->setMaximumHeight(16);
progressBar->setMaximumWidth(200);
progressBar->setTextVisible(false);
((QMainWindow*)parent())->statusBar()->addPermanentWidget(progressBar, 0);
((QMainWindow*)parent())->statusBar()->showMessage(QString("Loading"));
progressBar->setValue(0);
progressBar->setMinimum(0);
progressBar->setMaximum(0);
As I said in my first post - setting the value of the progress bar using
set value changes nothing. There is no busy indicator. I think there
is some kind of problem with adding the progress bar to the status bar
of the QMainWindow because if I re-order the above statements like so:
QProgressBar *progressBar = new QProgressBar(NULL);
progressBar->setMaximumHeight(16);
progressBar->setMaximumWidth(200);
progressBar->setTextVisible(false);
progressBar->setValue(0);
progressBar->setMinimum(0);
progressBar->setMaximum(0);
((QMainWindow*)parent())->statusBar()->addPermanentWidget(progressBar, 0);
((QMainWindow*)parent())->statusBar()->showMessage(QString("Loading"));
The progress bar never shows up! The status bar is totally blank and
nothing is there. I have tried many ways of re-ordering the above
statements and adding various hide() and show() statements for the
progress bar - all with the same outcome: the progress bar never shows a
busy indicator. Anybody else have any other ideas?
-Chris Portka
--
[ signature omitted ]
Message 7 in thread
> Anybody else have any other ideas?
Does this work for you?
// main.cpp
#include <QtGui>
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QMainWindow window;
QProgressBar* progressBar = new QProgressBar(&window);
progressBar->setMaximumHeight(16);
progressBar->setMaximumWidth(200);
progressBar->setTextVisible(false);
progressBar->setRange(0, 0);
progressBar->setValue(1);
window.statusBar()->addPermanentWidget(progressBar);
window.statusBar()->showMessage("Loading");
window.show();
return app.exec();
}
--
[ signature omitted ]
Message 8 in thread
J-P Nurmi wrote:
>> Anybody else have any other ideas?
>
> Does this work for you?
>
> // main.cpp
> #include <QtGui>
>
> int main(int argc, char* argv[])
> {
> QApplication app(argc, argv);
> QMainWindow window;
> QProgressBar* progressBar = new QProgressBar(&window);
> progressBar->setMaximumHeight(16);
> progressBar->setMaximumWidth(200);
> progressBar->setTextVisible(false);
> progressBar->setRange(0, 0);
> progressBar->setValue(1);
> window.statusBar()->addPermanentWidget(progressBar);
> window.statusBar()->showMessage("Loading");
> window.show();
> return app.exec();
> }
>
Yes - this works fine in a test program - it shows the progress bar as
being busy. The only difference in my code that seems to break this is
the fact that I do not have direct access to the QMainWindow object and
I have to get a reference by using parent(). To break this down - here
is exactly what I'm doing:
QProgressBar *progressBar = new QProgressBar((QMainWindow*)parent());
progressBar->setMaximumHeight(16);
progressBar->setMaximumWidth(200);
progressBar->setTextVisible(false);
progressBar->setRange(0, 0);
progressBar->setValue(1);
((QMainWindow*)parent())->statusBar()->addPermanentWidget(progressBar);
((QMainWindow*)parent())->statusBar()->showMessage(QString("Loading"));
The progress bar shows up but it is static, not busy. For reasons
outside the scope of this discussion - I have to use parent() to access
the QMainWindow object. I don't know what else to try. A possible bug
in Qt?
-Chris Portka
--
[ signature omitted ]
Message 9 in thread
>
> QProgressBar *progressBar = new QProgressBar((QMainWindow*)parent());
> progressBar->setMaximumHeight(16);
> progressBar->setMaximumWidth(200);
> progressBar->setTextVisible(false);
> progressBar->setRange(0, 0);
> progressBar->setValue(1);
> ((QMainWindow*)parent())->statusBar()->addPermanentWidget(progressBar);
> ((QMainWindow*)parent())->statusBar()->showMessage(QString("Loading"));
>
>
> The progress bar shows up but it is static, not busy. For reasons
> outside the scope of this discussion - I have to use parent() to access
> the QMainWindow object. I don't know what else to try. A possible bug
> in Qt?
Shouldn't you do parentWidget() instead of parent()?
--st
Description: S/MIME Cryptographic Signature