【发布时间】:2018-11-23 16:31:43
【问题描述】:
组合框的某些字符似乎有问题,至少我检测到当我们转到项目列表时,“&”显示为“_”。 我们如何解决这个问题?
一个例子:
ComboBox {
id: combobox
textRole: "text"
Layout.fillWidth: true
model: ListModel {
dynamicRoles: true
}
Component.onCompleted: {
reload()
}
Connections {
target: trans // this is a translator from a git project you are referring to
onLanguageChanged: {
combobox.reload()
}
}
function reload() {
var i = combobox.currentIndex
combobox.model = [
{text: qsTr("apple & orange")}
]
combobox.currentIndex = i
}
这是在 QT 5.11.2 上
如果我转义文本
{text: qsTr("apple && orange")}
发生这种情况
【问题讨论】: