PDA

View Full Version : Is it possible to apply external stylesheets to Qt rich text?



pepper
27th November 2007, 10:49
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?

wysota
27th November 2007, 11:10
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.