From 4de7101200589f60a392eb34085db211c1202e73 Mon Sep 17 00:00:00 2001 From: talksik Date: Wed, 16 Apr 2025 12:27:31 -0700 Subject: [PATCH] fix: use system theme to prevent color mismatch The problem stems from using something like QtQuick.Controls.iOS in certain views, which will follow the operating system level control. Thus, if our app theme is dark and the human's ios system theme is light, the text on a iOS.Menu will be white from our palette on top of a light mode background. --- Theme.qml | 10 +--------- gallery/Main.qml | 6 ------ 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/Theme.qml b/Theme.qml index 04b6033..dac97b5 100644 --- a/Theme.qml +++ b/Theme.qml @@ -22,13 +22,5 @@ Item { property int radius: 5 - property bool darkTheme: false - - Settings { - property alias darkTheme: item.darkTheme - } - - function toggleTheme() { - darkTheme = !darkTheme; - } + property bool darkTheme: Application.styleHints.colorScheme === Qt.Dark } diff --git a/gallery/Main.qml b/gallery/Main.qml index 393ff70..a326ec4 100644 --- a/gallery/Main.qml +++ b/gallery/Main.qml @@ -25,12 +25,6 @@ AppWindow { Row { spacing: 5 - AppPrimaryButton { - text: "Toggle theme" - onClicked: { - Theme.toggleTheme(); - } - } AppSecondaryButton { text: "Secondary" }