Results 1 to 2 of 2

Thread: Is it possible to apply external stylesheets to Qt rich text?

  1. #1
    Join Date
    Nov 2007
    Posts
    1
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Is it possible to apply external stylesheets to Qt rich text?

    Hello,
    I have a QLabel component with the following rich text assigned to it:

    <html><style type="text/css">.selection {color: red;}</style><body><div class="selection">Hello</div></body></html>

    That works correctly, i.e. text "Hello" is displayed with red color.
    Then, I want to store style options for class "selection" somewhere else, for example, in a file on hard disk.
    I.e., I want something like that:

    <html>
    <link rel="stylesheet" href="file.css">
    <body>
    <div class="selection">Hello</div>
    </body>
    </html>

    --------------------
    file.css:
    --------------------
    selection {
    color: red;
    }


    Unfortunately, I haven't found a way to do it. Is there a way to apply to rich text such styleheets defined outside the text?

  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: Is it possible to apply external stylesheets to Qt rich text?

    As far as I know - no, Arthur doesn't support external stylesheets, you have to embed it into the text or use other approach to style your text (for example using the regular approach - QPalette.

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 10:49
  2. Replies: 16
    Last Post: 23rd May 2008, 11:12
  3. Rich Text Format
    By Kapil in forum Newbie
    Replies: 1
    Last Post: 4th October 2006, 11:53
  4. Link Errors
    By magikalpnoi in forum Qt Programming
    Replies: 5
    Last Post: 25th September 2006, 23:04
  5. Painting Rich Text
    By xanthine in forum Qt Programming
    Replies: 7
    Last Post: 16th April 2006, 00:35

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.