From d2d91bb10581e04d121daa9aab47071fa1e8215a 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 2f9944b92..e69c34922 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; } }