Results 1 to 2 of 2

Thread: QStaticText and Style Sheets

  1. #1
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default QStaticText and Style Sheets

    Hello!

    Is there a possibility to use Style Sheets alongside QStaticText? Or I'ld have to use QLabel to draw text if I want to take advantage of the Style Sheet system?


    Thanks,

    Momergil
    May the Lord be with you. Always.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QStaticText and Style Sheets

    QStaticText is not derived from QObject or QWidget; it is just a container for formatted text that will be drawn by QPainter. So it doesn't support style sheets (which are applied to QWidget classes), but it does support formatted text such as Rich Text.

    If you need to use style sheets, then I think you are stuck with QLabel. On the other hand, if you are manually drawing text using QPainter, then you can use QStaticText.

    It would be really nice if there was a style sheet to Rich Text format converter, but I don't think there is any such thing, at least not in the documented part of Qt.
    Last edited by d_stranz; 26th August 2014 at 03:22.

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

    Momergil (27th August 2014)

Similar Threads

  1. Style Sheets
    By yakuzan in forum Newbie
    Replies: 5
    Last Post: 29th May 2010, 09:11
  2. Do Qt Style Sheets support List-style-image?
    By daiheitan in forum Qt Programming
    Replies: 6
    Last Post: 12th March 2010, 01:41
  3. style sheets
    By alisami in forum Qt Programming
    Replies: 8
    Last Post: 7th May 2009, 09:41
  4. Qt style sheets
    By locus in forum Qt Programming
    Replies: 5
    Last Post: 5th April 2007, 17:03
  5. style sheets
    By TheKedge in forum Qt Programming
    Replies: 1
    Last Post: 29th March 2007, 15:14

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.