User interface QML富文本颜色格式设置不起作用
富文本规范的颜色标签似乎在我的QML中不起作用。这是我的密码:User interface QML富文本颜色格式设置不起作用,user-interface,qml,richtext,User Interface,Qml,Richtext,富文本规范的颜色标签似乎在我的QML中不起作用。这是我的密码: Text { id: messageText x: /*tagText.width +*/ 4 width: logItem.width - 8//- tagText.width text: "<color=#FFFF0000>[RED TEXT]</color>white text
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
}
文本{
id:messageText
x:/*tagText.width+*/4
宽度:logItem.width-8//-tagText.width
文本:“[红色文本]白色文本”
颜色:“ccc”
wrapMode:Text.WrapAnywhere
Text格式:Text.RichText
}
文本没有正确着色。只考虑文本对象的颜色属性。我尝试删除该标签,但仍然遇到相同的问题。标签使用错误。以下是正确的方法:
text: "<font color=\"#FF0000\">[RED TEXT]</font>white text"
text:“[红色文本]白色文本”