我对 SystemDialogs 有疑问?我需要在 QML 中实现一个,但 Github 上可用的示例项目(“对话框”)在使用 10.1 SDK 构建时显示为包含错误。但是,它们确实运行正常。
感兴趣的代码如下:
SystemDialog {
id: dialog
title: qsTr("DIALOG")
body: qsTr("Dialog body")
confirmButton.label: qsTr("Okay button")
confirmButton.enabled: true
cancelButton.label: qsTr("Cancel button")
cancelButton.enabled: true
buttons: [
SystemUiButton {
id: random
label: qsTr("RANDOM")
enabled: true
},
SystemUiButton {
id: random2
label: qsTr("RANDOM2")
enabled: true
}
]
…
}
“错误”属性是确认label
和enabled
取消按钮的和buttons
属性以及 SystemDialog 的数组属性。如前所述,尽管 IDE 将它们突出显示为错误,但代码似乎按预期工作。
我的问题是,有没有办法在 SDK10.1 中做类似的事情?我需要在对话框中的按钮上设置文本。