Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    QProgressBar and stylesheet: best way to add a vertical bar

    General and Desktop
    2
    3
    3842
    Loading More Posts
    • 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
      JulienMaille last edited by

      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 Reply Quote 0
      • G
        giesbert last edited by

        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 Reply Quote 0
        • J
          JulienMaille last edited by

          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 Reply Quote 0
          • First post
            Last post