mirror of
https://github.com/stemoretti/BaseUI.git
synced 2025-05-25 15:20:23 -04:00
Change Style.theme type to string
This commit is contained in:
parent
287d439eec
commit
768bb75de4
@ -294,22 +294,17 @@ UI.App {
|
|||||||
id: themeDialog
|
id: themeDialog
|
||||||
|
|
||||||
title: "Choose theme style"
|
title: "Choose theme style"
|
||||||
model: [
|
model: [ "Dark", "Light", "System" ]
|
||||||
{ name: "Dark", style: Material.Dark },
|
|
||||||
{ name: "Light", style: Material.Light },
|
|
||||||
{ name: "System", style: Material.System }
|
|
||||||
]
|
|
||||||
delegate: RowLayout {
|
delegate: RowLayout {
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
RadioButton {
|
RadioButton {
|
||||||
checked: modelData.name === root.themeStyle
|
checked: modelData === root.themeStyle
|
||||||
text: modelData.name
|
text: modelData
|
||||||
Layout.leftMargin: 4
|
Layout.leftMargin: 4
|
||||||
onClicked: {
|
onClicked: {
|
||||||
themeDialog.close()
|
themeDialog.close()
|
||||||
root.themeStyle = modelData.name
|
root.themeStyle = modelData
|
||||||
UI.Style.theme = modelData.style
|
|
||||||
root.theme = root.Material.theme === Material.Dark
|
root.theme = root.Material.theme === Material.Dark
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -395,5 +390,6 @@ UI.App {
|
|||||||
UI.Style.primaryColor = Qt.binding(function() { return root.primary })
|
UI.Style.primaryColor = Qt.binding(function() { return root.primary })
|
||||||
UI.Style.accentColor = Qt.binding(function() { return root.accent })
|
UI.Style.accentColor = Qt.binding(function() { return root.accent })
|
||||||
UI.Style.isDarkTheme = Qt.binding(function() { return root.theme })
|
UI.Style.isDarkTheme = Qt.binding(function() { return root.theme })
|
||||||
|
UI.Style.theme = Qt.binding(function() { return root.themeStyle })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,5 +23,7 @@ ApplicationWindow {
|
|||||||
|
|
||||||
Material.primary: Style.primaryColor
|
Material.primary: Style.primaryColor
|
||||||
Material.accent: Style.accentColor
|
Material.accent: Style.accentColor
|
||||||
Material.theme: Style.theme
|
Material.theme: Style.theme == "System"
|
||||||
|
? Material.System
|
||||||
|
: (Style.theme == "Dark" ? Material.Dark : Material.Light)
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import QtQuick.Controls.Material
|
|||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
property bool isDarkTheme: false
|
property bool isDarkTheme: false
|
||||||
property int theme: Material.System
|
property string theme: "System"
|
||||||
property bool toolBarPrimary: true
|
property bool toolBarPrimary: true
|
||||||
|
|
||||||
property color primaryColor: Material.color(Material.BlueGrey)
|
property color primaryColor: Material.color(Material.BlueGrey)
|
||||||
|
Loading…
Reference in New Issue
Block a user