QML Rich Text color formatting not working

1.2k views Asked by At

It seems the color tag of the Rich Text specification isn't working in my QML. Here's my code:

Text {
                id: messageText
                x: /*tagText.width +*/ 4
                width: logItem.width - 8//- tagText.width
                text: "<color=#FFFF0000>[RED TEXT]</color>white text"
                color: "#ccc"
                wrapMode: Text.WrapAnywhere
                textFormat: Text.RichText
            }

The text isn't being colorized properly. Only the color property of the Text object is being respected. I tried removing that but still get the same issue.

1

There are 1 answers

0
user1765354 On

Using the tag wrong. Here' the right way:

text: "<font color=\"#FF0000\">[RED TEXT]</font>white text"