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. Unable to change progress bar background color [SOLVED]
Forum Updated to NodeBB v4.3 + New Features

Unable to change progress bar background color [SOLVED]

Scheduled Pinned Locked Moved General and Desktop
8 Posts 2 Posters 5.7k 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
    adnan
    wrote on last edited by
    #1

    I tried this as per documentation, but it didn't work:
    @ui->progressBar->setStyleSheet("background-color: #05B8CC;width: 20px;");@

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      your code is working on ubuntu, plastique style.(and others, you can try it out using the preview in Qt Creator)

      I guess you are on windows? It's the windows style that prevents it then.

      Have a look at the " style sheet" example. That's a good way of testing al your stylesheets out.

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • A Offline
        A Offline
        adnan
        wrote on last edited by
        #3

        I also use Ubuntu (Gnome3 gtk+). I tried again with a simple form having just a progress bar, but no change.
        @#include "mainwindow.h"
        #include "ui_mainwindow.h"

        MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
        {
        ui->setupUi(this);
        ui->progressBar->setStyleSheet("background-color: yellow");
        }

        MainWindow::~MainWindow()
        {
        delete ui;
        }@

        1 Reply Last reply
        0
        • EddyE Offline
          EddyE Offline
          Eddy
          wrote on last edited by
          #4

          did you try it out using plastique style?

          As I mentioned it's the style preventing stylesheets to make changes. I guess you will need to make your own style.

          Qt Certified Specialist
          www.edalsolutions.be

          1 Reply Last reply
          0
          • A Offline
            A Offline
            adnan
            wrote on last edited by
            #5

            I tried plastique style also but no effect. Isn't there any other alternative, nevertheless thanks!

            1 Reply Last reply
            0
            • A Offline
              A Offline
              adnan
              wrote on last edited by
              #6

              It is working in style sheets example but not otherwise, i need to look into it. Is there anything wrong in my syntax

              1 Reply Last reply
              0
              • A Offline
                A Offline
                adnan
                wrote on last edited by
                #7

                Yes it worked at last, but not with GTK+. Most probably it’s the GTK+ style preventing stylesheets to make changes as my system style is also GTK+

                1 Reply Last reply
                0
                • EddyE Offline
                  EddyE Offline
                  Eddy
                  wrote on last edited by
                  #8

                  If changing the used style is ok for you then it's solved? AFAIK GTK+ style is like windows style preventing stylesheet changes on some parts.

                  Could you please edit your first post and add [solved] in the title?

                  Qt Certified Specialist
                  www.edalsolutions.be

                  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