From c03d24de153fa426ea0d005d2971ee01273e0dcf Mon Sep 17 00:00:00 2001 From: Benjamin Palko Date: Tue, 16 Sep 2025 10:33:55 -0400 Subject: [PATCH] create ThemeComboBox --- components/composite/ThemeComboBox.qml | 20 ++++++++++++++++++++ modules/configuration/StylingView.qml | 10 ++-------- 2 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 components/composite/ThemeComboBox.qml diff --git a/components/composite/ThemeComboBox.qml b/components/composite/ThemeComboBox.qml new file mode 100644 index 0000000..8ba673b --- /dev/null +++ b/components/composite/ThemeComboBox.qml @@ -0,0 +1,20 @@ +import qs.components +import qs.config +import QtQuick + +StyledComboBox { + id: control + + currentIndex: Theme.themes.indexOf(Theme.currentTheme) + model: Theme.themes + onActivated: index => { + Theme.currentTheme = Theme.themes[index]; + } + + Component.onCompleted: { + control.currentIndex = Theme.themes.indexOf(Theme.currentTheme); + Theme.onCurrentThemeChanged = () => { + Theme.themes.indexOf(Theme.currentTheme); + }; + } +} diff --git a/modules/configuration/StylingView.qml b/modules/configuration/StylingView.qml index 731ecaf..5454953 100644 --- a/modules/configuration/StylingView.qml +++ b/modules/configuration/StylingView.qml @@ -1,4 +1,5 @@ import qs.components +import qs.components.composite import qs.config import QtQuick import QtQuick.Layouts @@ -10,16 +11,9 @@ StyledPane { StyledText { text: "Theme" - // font.bold: true font.pixelSize: Styling.typography.textSize.lg } - StyledComboBox { - currentIndex: Theme.themes.indexOf(Theme.currentTheme) - model: Theme.themes - onActivated: index => { - Theme.currentTheme = Theme.themes[index]; - } - } + ThemeComboBox {} } }