Results 1 to 2 of 2

Thread: QLabel - text in multiple colors

  1. #1

    Default QLabel - text in multiple colors

    Hello
    how can i set multiple colors inside Qlabel text?
    for example:
    QLabel ql;
    ql->setText("Hello World!");

    i want that the "Hello" will be in blue, the "World" in red & the "!" in green
    it is possible?
    thanks in advance,
    Gal

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

    Default Re: QLabel - text in multiple colors

    Qt Code:
    1. ql->setText("<font color=\"blue\">Hello</font> <font color=\"red\">World</font><font color=\"green">!</font>");
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 1
    Last Post: 18th July 2011, 07:56
  2. QLabel with multiple layers
    By augusbas in forum Qt Programming
    Replies: 4
    Last Post: 16th June 2011, 14:10
  3. Replies: 1
    Last Post: 7th April 2010, 16:26
  4. Replies: 1
    Last Post: 13th January 2010, 17:21
  5. Rich Text Tale Vol1 : Background colors
    By fullmetalcoder in forum Qt Programming
    Replies: 37
    Last Post: 9th February 2006, 15:05

Tags for this Thread

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.