How to set step (chunk) number in QtProgressBar?
-
Hi all,
I am new to Qt . Right now I am trying to create a battery icon for an app. For that I am using QProgressBar and I am trying to set the number of steps for showing the battery capacity.
Currently the progress bar is showing around 15 steps (chunks) for 100 percent battery.I want to set it to 5 steps such that each step can signify 20 percent battery. I tried to search on internet regarding this query but all I can find is to set value range of battery and size of those steps. Is there a way to set the number of steps in the progress bar? -
@Inderveer-Singh said in How to set step (chunk) number in QtProgressBar?:
but all I can find is to set value range of battery and size of those steps. Is there a way to set the number of steps in the progress bar?
Number of steps == range / size of one step
?
EDIT
Sorry, my bad, there doesn't seem to be a "size of one step". I don't think you can tell the progress bar how many discrete step markers/individual block width it should have. You can set the minimum & maximum values (range), and the current value within that, and it shows the step blocks/percentage corresponding? Maybe changing the width of the progress bar determines how many physical blocks it contains, I don't know. I stand to be corrected if I am wrong about this.... -
@Inderveer-Singh
by default the chunks are drawn by the platform style (which may be present or not).
The only way would be to use stylesheets. But you would need to update the stylesheet every time the size of the progressbar changes to get your desired chunk count, whats rather ugly.