[Qt-qml] CSS and rich text in QML

Alex alexlordax+qt at gmail.com
Thu Sep 23 00:13:00 CEST 2010


Hi all,

I am looking for a clean way to integrate CSS with Text.RichText in
QML.  I would like to have a MyRichText component that could
interpret, for example, "<b> abc </b>" in a custom manner.  I realize
that I can create a bunch of separate Text components, one for each
style, but I often need to use multiple styles within a single line of
text.  It is a pain to break these up into separate instances and then
glue them together with a Row.

One option I've come up with is to have my custom component prefix the
desired text with predefined stylesheet.  This is obviously not very
efficient, since the stylesheet is copied into each instance of text.

Is there a better way?

Cheers,
Alex



More information about the Qt-qml mailing list