PDA

View Full Version : QStatusBar and QProgressBar



croscato
30th July 2009, 08:28
Hi all.

I'm wish to add a QProgressBar to a QStatusBar in QMainWindow. But it must not be visible all the time.

I'm using a code similar to this and can't get it to work




Form::Form(QWidget* parent): QMainWindow(parent)
{
progress = new QProgressBar(this);
progress->setVisible(false);

statusbar->addPermanentWidget(progress);
}

Form::showProgress(bool visible)
{
progress->setVisible(visible);
}



Any ideas???

Thanks in advance!

yogeshgokul
30th July 2009, 08:58
You need to hide progress bar again, when your task is completed or when progress value reaches at highest range.

sheeeng
30th July 2009, 10:01
You need to hide progress bar again, when your task is completed or when progress value reaches at highest range.

Yup. I agree with @yogeshgokul. You have to hide it or disable it when your process is completed.

wagmare
30th July 2009, 10:10
status bar is having the option of removing and adding a QWidget ... u can use that one also ..

yogeshgokul
30th July 2009, 10:14
status bar is having the option of removing and adding a QWidget ... u can use that one also ..
I think he is using same :)

statusbar->addPermanentWidget(progress);

croscato
30th July 2009, 18:16
Hi all.

I solve the problem with the following code:



progress->setVisible(visible);
qApp->processEvents();


Thanks for the help!!!