Quick Tip: QProgressBar as a Busy Indicator

This is a super simple tip that doesn’t really have much to it. A busy indicator is just a visual cue to show the user that something is happening. To use a progress bar in Qt as one, you just need to set the minimum and maximum values to 0. If you do this, you get an infinite progress indicator. This is a better alternative to a progress bar when you have a process in which you cannot calculate the percentage completed, or one that takes a really long, undetermined, amount of time. An example with the Fusion style (that I use for basically any QWidgets these days) yields an animated diagonal stitch pattern:

Busy Progress Bar

The Qt Fusion style progress bar.

On Windows 7, you get a nice animated effect as well, but with a smaller colored area moving from left to right infinitely.

Windows 7 Busy Progress Bar

The Windows 7 version of the busy progress bar indicator

I hope the tip helped you out! Happy coding!

Advertisements

2 thoughts on “Quick Tip: QProgressBar as a Busy Indicator

  1. Triangle717

    A progress bar was suggested in the PatchIt 1.1.1 RC test during Patch Creation, and when I told rio, he started talking about one on Qt. I said I wasn’t sure how it could be done, since the progress can’t be calculated. I didn’t thing about a busy indicator! This post just solved that problem. 😀

    Reply
    1. QuantumCD Post author

      You could also use a GIF like Skype does on its loading screen. Those are common as well. Progress bars are more universal and easier to integrate though, in my opinion.

      Reply

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