Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QProgressBar and stylesheet: best way to add a vertical bar
Forum Updated to NodeBB v4.3 + New Features

QProgressBar and stylesheet: best way to add a vertical bar

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 4.2k Views 1 Watching
  • 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.
  • J Offline
    J Offline
    JulienMaille
    wrote on last edited by
    #1

    I would like to display a treshold value in my progressbar:
    [--------------------------|-------]

    I already style QProgressBar and QProgressBar::chunk to color my bar and background with nice gradients, and now I want to add this vertical line. What's the smartest way to do this?
    Ideally I would like to have this treshold displayed on top of the chunk.
    Should I play with background-image or another tag?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      One possibility is to use a custom progress bar class, overwrite paint event, call default painting for the styling and draw the threshold value afterwards on top.

      Background image would be behind the chunk :-(

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JulienMaille
        wrote on last edited by
        #3

        I finally took a few minutes to subclass my progressbar.
        I added a QRubberBand to handle a min and max threshold (for hysteresis). Works great for little to no efforts!

        I am now wondering if I can set a styleSheet on a QRubberBand to alter color and opacity!

        1 Reply Last reply
        0

        • Login

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