Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to set step (chunk) number in QtProgressBar?

How to set step (chunk) number in QtProgressBar?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
3 Posts 3 Posters 385 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Inderveer Singh
    wrote on last edited by
    #1

    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?

    JonBJ raven-worxR 2 Replies Last reply
    0
    • I Inderveer Singh

      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?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @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....

      1 Reply Last reply
      0
      • I Inderveer Singh

        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?

        raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #3

        @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.

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        2

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved