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. Change color of QProgressBar.
Forum Updated to NodeBB v4.3 + New Features

Change color of QProgressBar.

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 2.8k 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.
  • A Offline
    A Offline
    Aditya1309
    wrote on last edited by
    #1

    Hi,
    I have made a progress bar with timer,
    And used the following to change the color of progressbar

    QProgressBar *m_pProgressBar;
    m_pProgressBar->setStyleSheet("QProgressBar::chunk {background: rgb(0, 0, 255, 60%);}");

    • This gives blue progress bar.

    Is there a better way to do it ?

    jsulmJ 1 Reply Last reply
    0
    • A Aditya1309

      Hi,
      I have made a progress bar with timer,
      And used the following to change the color of progressbar

      QProgressBar *m_pProgressBar;
      m_pProgressBar->setStyleSheet("QProgressBar::chunk {background: rgb(0, 0, 255, 60%);}");

      • This gives blue progress bar.

      Is there a better way to do it ?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Aditya1309 What is wrong with this way?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply
      2
      • jsulmJ jsulm

        @Aditya1309 What is wrong with this way?

        A Offline
        A Offline
        Aditya1309
        wrote on last edited by
        #3

        @jsulm Its not uniform blue in other platform.
        I am ok with that, But thinking if there is any other way like using QPalette and and setting the progressbar.

        A raven-worxR 2 Replies Last reply
        0
        • A Aditya1309

          @jsulm Its not uniform blue in other platform.
          I am ok with that, But thinking if there is any other way like using QPalette and and setting the progressbar.

          A Offline
          A Offline
          Aditya1309
          wrote on last edited by Aditya1309
          #4

          FYI, I also did not understood the concept of QPalette from QT documentation.

          1 Reply Last reply
          0
          • A Aditya1309

            @jsulm Its not uniform blue in other platform.
            I am ok with that, But thinking if there is any other way like using QPalette and and setting the progressbar.

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

            @Aditya1309 said in Change color of QProgressBar.:

            QPalette and and setting the progressbar.

            i think there is no cross platform way to change the color of a progressbar via QPalette, only via stylesheets

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

            A 1 Reply Last reply
            1
            • raven-worxR raven-worx

              @Aditya1309 said in Change color of QProgressBar.:

              QPalette and and setting the progressbar.

              i think there is no cross platform way to change the color of a progressbar via QPalette, only via stylesheets

              A Offline
              A Offline
              Aditya1309
              wrote on last edited by
              #6

              @raven-worx said in Change color of QProgressBar.:

              s no cross platform way to change the color of a progressbar via QPalette, only via stylesheets

              Thanks, I will check with setStyleSheet only.

              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