Search code examples
qt4qt4.7

How to create progress bar like in the following picture?


This came from Qt SDK setup wizard , seems that QProgressBar only support accumulative bars , how did they made the following ? is that included in the open-source edition of Qt ?

enter image description here


Solution

  • It's simpler then you think... You just need to setRange(0, 0) on QProgressBar. Note that it won't behave exactly like that on all platforms.

    With Mac OS X style it will look like this:

    enter image description here

    Blue stripes will move to the right

    On windows it will look like this (with Vista/7 style):

    enter image description here

    Green indicator will appear from left to the right. It will take only part of progress bar of course.