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 inverted logic: 0 -> full, 1 -> empty
QtWS25 Last Chance

QProgressBar inverted logic: 0 -> full, 1 -> empty

Scheduled Pinned Locked Moved General and Desktop
qprogressbar
4 Posts 2 Posters 1.0k 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.
  • M Offline
    M Offline
    McLion
    wrote on 20 Apr 2015, 13:34 last edited by
    #1

    Hi

    Is it somehow possible to have the QProgressBar have an inverted display logic, say:
    Range 0-100.
    Value 0: ProgressBar shows "full"
    Value 100: ProgressBar is "empty"

    Thanks
    McL

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 20 Apr 2015, 13:42 last edited by
      #2

      Hi,

      You can call

      progressBar->setValue(progressBar->maximum() - newValue);

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        McLion
        wrote on 20 Apr 2015, 13:58 last edited by
        #3

        Of course, this starts from top. However, the value displayed will then change as well.

        Range: 0-100
        NewValue = 10
        How I would like it to be:
        Value shown: 10, Progressbar 9/10 "full"

        How it is with maximum-NewValue = 90
        Value shown: 90, Progressbar 9/10 "full"

        Since QProgressBar does not have a property to do this I'll then will go the way of not displaying the value and use a separate label instead to be able to seperate the value shown in text and the value shown on the bar as a workaround.

        Thanks anyway!

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 20 Apr 2015, 14:19 last edited by
          #4

          You can subclass QProgressBar and reimplement the text function to return what you want.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          4/4

          20 Apr 2015, 14:19

          • Login

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