Results 1 to 3 of 3

Thread: Change color of a link in QLabel using Style Sheets?

  1. #1
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Unhappy Change color of a link in QLabel using Style Sheets?

    Hello, I have a QLabel with a link in it inserted with rich text. How would I change the color of that link? Changing the color property of QLabel doesn't seem to do anything. Thanks in advance!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Change color of a link in QLabel using Style Sheets?

    You can use CSS to change the color.

    Qt Code:
    1. label->setText("<a href=\"http://www.qtcentre.org\" style=\"color: red;\">Qt Centre</a>");
    To copy to clipboard, switch view to plain text mode 

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

    codeslicer (15th April 2008)

  4. #3
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Change color of a link in QLabel using Style Sheets?

    Wow! So obvious yet so discreet. Thanks!

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.