Results 1 to 3 of 3

Thread: How to change text color of push button?

  1. #1
    Join Date
    Jun 2009
    Location
    India
    Posts
    143
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question How to change text color of push button?

    Hi ,

    i need to change the PushButton Text Color to White . Please Help me .

    I had done Push Button as transparent so i need to change the color

  2. #2
    Join Date
    Sep 2008
    Posts
    25
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to change text color of push button?

    Hi!

    Just change the buttons stylesheet or it's parents stylesheet if you want to change the foreground color of multiple buttons.

    In the 1st case:
    Qt Code:
    1. color:white;
    To copy to clipboard, switch view to plain text mode 

    2nd case:
    Qt Code:
    1. {
    2. color:white;
    3. }
    To copy to clipboard, switch view to plain text mode 

  3. #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: How to change text color of push button?

    Quote Originally Posted by augusbas View Post
    Hi ,

    i need to change the PushButton Text Color to White . Please Help me .

    I had done Push Button as transparent so i need to change the color
    Hello my friend try this in your program, I've tested it on my project it worked rgb(255, 0, 0) stands for red background color and rgb(255, 255, 255) for 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. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. Custom QStyle: change only tool button text color
    By Lykurg in forum Qt Programming
    Replies: 0
    Last Post: 27th February 2009, 19:55
  3. Line edit and push button
    By dela in forum Newbie
    Replies: 1
    Last Post: 10th December 2008, 16:10
  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. Can't change the text display of a QTreeview item.
    By johnny_sparx in forum Qt Programming
    Replies: 3
    Last Post: 2nd June 2006, 01:03

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.