Results 1 to 6 of 6

Thread: could not change QProgressBar color

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2012
    Posts
    21
    Thanks
    7
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: could not change QProgressBar color

    Hi toufic.dbouk,

    I tried with suggested ways. It's showing default color only.

    Thanks.

  2. #2
    Join Date
    Dec 2012
    Posts
    197
    Thanks
    25
    Thanked 41 Times in 33 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: could not change QProgressBar color

    Hi dpn,
    Qt Code:
    1. QProgressBar *progressbar = new QProgressBar();
    2. QPalette p = progressbar->palette();
    3. p.setColor(progressbar->backgroundRole(), QColor(Qt::green));
    4. progressbar->setPalette(p);
    5. progressbar->show();
    To copy to clipboard, switch view to plain text mode 

    this should work,

    Qt Code:
    1. QPalette pal = prog->palette();
    2. pal.setColor(prog->backgroundRole(), Qt::green);
    3. prog->setPalette(pal);
    4. prog->show();
    To copy to clipboard, switch view to plain text mode 
    this should also work,

    you dont show in your code how you are showing the progress bar
    show more code snippets if you need any further help.
    Last edited by toufic.dbouk; 16th September 2013 at 13:32.

Similar Threads

  1. Change in color map?
    By bigjoeystud in forum Qwt
    Replies: 4
    Last Post: 8th September 2010, 20:00
  2. Replies: 3
    Last Post: 22nd January 2010, 16:46
  3. how to change the color of the frame
    By wagmare in forum Qt Programming
    Replies: 5
    Last Post: 12th May 2009, 12:46
  4. how to change backgroup color, button color and shape?
    By lzha022 in forum Qt Programming
    Replies: 10
    Last Post: 16th June 2008, 22:25
  5. Change HLine color
    By smtgra011 in forum Newbie
    Replies: 3
    Last Post: 5th July 2007, 06:55

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.