From 8312ec79a2a33eecfcffafe287f090fdb4f7829e Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 5 Nov 2024 17:02:32 +0900 Subject: [PATCH] Use old palette change detection method on Windows 10 and under Signed-off-by: Claudio Cambra --- src/libsync/theme.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index c12782f014ecd..5db2bb949b4bf 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -969,8 +969,15 @@ void Theme::connectToPaletteSignal() { if (!_paletteSignalsConnected) { if (const auto ptr = qobject_cast(QGuiApplication::instance())) { - connect(ptr, &QGuiApplication::paletteChanged, this, &Theme::systemPaletteChanged); - connect(ptr->styleHints(), &QStyleHints::colorSchemeChanged, this, &Theme::darkModeChanged); +#ifdef Q_OS_WIN + // Windows 10 does not have proper dark mode support via Qt 6 so hack detection + if (!IsWindows11OrGreater()) { + connect(ptr, &QGuiApplication::paletteChanged, this, &Theme::darkModeChanged); + } else +#endif + { + connect(ptr->styleHints(), &QStyleHints::colorSchemeChanged, this, &Theme::darkModeChanged); + } _paletteSignalsConnected = true; } }