Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法在 QML 中的文本占位符中为特定单词着色?
我看到你可以在TextAreaorFlow但我需要在 a 的占位符中使用两种颜色TextField。我需要的是这样的:假设我的 placeholderText 是(“姓氏”)。我需要灰色的“Last”和粉红色的“name”。有没有办法做到这一点?
TextArea
Flow
TextField
我随机尝试使用 HTML 而不是纯文本,这突然起作用了:
TextField { anchors.centerIn: parent placeholderText: "<font color='grey'>Last</font> <font color='pink'>name</font>" width: 200 }
但是这种行为在任何地方都没有描述,我不会在生产中使用这种解决方法。