how to use QT QProgressBar to show busy/indefinite status

A progress bar is used to give the user an indication of the progress of an operation and to reassure them that the application is still running.

The progress bar uses the concept of steps. You set it up by specifying the minimum and maximum possible step values, and it will display the percentage of steps that have been completed when you later give it the current step value.

In QT we can use QProgressBar widget which provides a horizontal or vertical progress bar for the same.

To show busy or indefinite time in progress bar using QT, just set the maximum and minimum limits of QProgressBar to 0.

QProgressBar *pbarDL;
//To start indefinite/busy progress bar
pbarDL->setMaximum(0);
pbarDL->setMinimum(0);
//To stop just set any value to maximum
pbarDL->setMaximum(10);
And you will get
QProgressBar showing Busy status

QProgressBar showing Busy status

That’s it.. Easy enough na..Winking smile

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s