我正在玩Qt 5.8 RC以及在Universal和Material主題中引入的新屬性System。如何在最新的Qt 5.8中使用Universal.System或Material.System?
但是,當設計一個可定製的應用程序時,可以選擇通用或材質與黑暗,光線或系統組合。我怎麼知道系統實際上不是字符串「System」,而是「Dark」或「Light」?
RadioButton {
text: qsTr("Light")
checked: appSettings.theme === "Light"
ButtonGroup.group: modeBG
onClicked: {
appSettings.theme = "Light"
appSettings.background = "white"
appSettings.menuPaneColor = "#eeeeee"
}
}
RadioButton {
text: qsTr("Dark")
checked: appSettings.theme === "Dark"
ButtonGroup.group: modeBG
onClicked: {
appSettings.theme = "Dark"
appSettings.background = "black"
appSettings.menuPaneColor = "#171717"
}
}
RadioButton {
text: qsTr("System theme")
ButtonGroup.group: modeBG
onClicked: {
appSettings.theme = "System"
//appSettings.background = "black"
//appSettings.menuPaneColor = "#171717"
}
}
顯然,下面的代碼,其曾經工作的「硬」的價值觀不再有效(main.qml):
ToolButton {
id: burgerMenu
checkable: appSettings.burgerMenuIsChecked
contentItem: Image {
fillMode: Image.Pad
horizontalAlignment: Image.AlignHCenter
verticalAlignment: Image.AlignVCenter
source: "qrc:/images/" + appSettings.style + "/" + appSettings.theme + "/drawer.png"
}
...
}
任何想法?
你可以指定不同的[配置文件](https://doc-snapshots.qt.io/qt5-5.8/qtquickcontrols2-configuration.html),並嘗試做檢查在C + + – DuKes0mE