Results 1 to 6 of 6

Thread: Change QPushButton Background Color, Qt4.3

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Change QPushButton Background Color, Qt4.3

    QWindowsXpStyle uses native theming engine which causes some palette modifications not to have any effect. Certain colors/brushes/whatever come from the underlying system. Style sheets is the solution to this problem. Follow the link and see the example of changing QPushButton's color there.
    J-P Nurmi

  2. The following user says thank you to jpn for this useful post:

    Rayven (29th June 2007)

  3. #2
    Join Date
    Jan 2006
    Location
    Third rock from the sun
    Posts
    106
    Thanks
    17
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Talking Re: Change QPushButton Background Color, Qt4.3

    Quote Originally Posted by jpn View Post
    QWindowsXpStyle uses native theming engine which causes some palette modifications not to have any effect. Certain colors/brushes/whatever come from the underlying system. Style sheets is the solution to this problem. Follow the link and see the example of changing QPushButton's color there.
    That was it!! Thanks so much jpn!

  4. #3
    Join Date
    Jun 2009
    Location
    Bato, Leyte, Philippines
    Posts
    10
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Change QPushButton Background Color, Qt4.3

    Try this. QPushButton with red background and white text color.

    m_ui->pushButton_filter->setAutoFillBackground(true);
    m_ui->pushButton_filter->setStyleSheet("background-color: rgb(255, 0, 0); color: rgb(255, 255, 255)");

Similar Threads

  1. Change background color of QPushButton
    By gtthang in forum Qt Programming
    Replies: 3
    Last Post: 26th November 2013, 10:23
  2. Change background color for a QPushButton?
    By Harvey West in forum Qt Programming
    Replies: 6
    Last Post: 5th January 2007, 14:23

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.