问题
Hello i would like to add different color on specific words of a string to be used in QML Text
Text {
text: "Blue Red Yellow Green"
}
I know that you can add color to the whole text, but i would like to add specific color on specific words. is this possible? and how is it achieved?
回答1:
Text
items can display both plain and rich text. For example you can have:
Text {
text: "<font color=\"#0000FF\">Blue</font> <font color=\"#FF0000\">Red</font>"
}
来源:https://stackoverflow.com/questions/55003748/how-to-add-color-on-specific-words-on-qml-text