How to change color of last character in QML Text?
Solved
QML and Qt Quick
-
Hello,
Is it possible to have different colors for the same QML Text component? I want a specefic color for my text last character. -
@Babs QML and Text components support rich text formatting so something like this can work:
Text { anchors.fill:parent text: "Normal text <font color=\"#FF0000\">this part is red</font>" }
-
@Babs sure, you can reformat your strings to include the tags or do something like this
Text { anchors.fill:parent text: "%1<font color=\"#FF0000\">%2</font>".arg(stringA).arg(stringB) }