Skip to content

Commit

Permalink
Use old palette change detection method on Windows 10 and under
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Nov 5, 2024
1 parent caf7c0b commit 8312ec7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/libsync/theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -969,8 +969,15 @@ void Theme::connectToPaletteSignal()
{
if (!_paletteSignalsConnected) {
if (const auto ptr = qobject_cast<QGuiApplication *>(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;
}
}
Expand Down

0 comments on commit 8312ec7

Please sign in to comment.