Results 1 to 3 of 3

Thread: How to install text color of an QLabel?

  1. #1
    Join Date
    Sep 2010
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Question How to install text color of an QLabel?

    On the standard form there is an QLabel with the text, would like to make at form loading text color of an the QLabel red, and after a file choice - green. Has tried:
    Qt Code:
    1. QPalette t_palette = ui->lbFileName->palette();
    2. t_palette.setColor(QPalette::Text, Qt::gray);
    3. ui->lbFileName->setPalette(t_palette);
    To copy to clipboard, switch view to plain text mode 
    Color doesn't change. Prompt, please, as it to make.
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How to install text color of an QLabel?

    Use QPalette::WindowText.

  3. The following user says thank you to Lykurg for this useful post:

    tumanovalex (24th September 2010)

  4. #3
    Join Date
    Sep 2010
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to install text color of an QLabel?

    Thanks big, all have turned out.

Similar Threads

  1. Replies: 3
    Last Post: 22nd January 2010, 16:46
  2. Replies: 1
    Last Post: 31st August 2009, 07:44
  3. QPushbutton + QLabel text color
    By Ashish in forum Qt Programming
    Replies: 5
    Last Post: 3rd February 2007, 08:13
  4. Setting text color on QLabel
    By Yorma in forum Newbie
    Replies: 11
    Last Post: 15th June 2006, 07:25
  5. QLabel background color
    By munna in forum Newbie
    Replies: 3
    Last Post: 1st May 2006, 15:36

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.