Skip to content

Commit

Permalink
Fix applying darkmode in Qt Quick GUI on platforms with "darkmode flag"
Browse files Browse the repository at this point in the history
So far only tested on Windows with Qt 6.8.1 but it will hopefully also fix
the same problem under Android.
  • Loading branch information
Martchus committed Jan 18, 2025
1 parent 1cc4d9b commit 724037b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tray/gui/quick/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,16 @@ App::App(bool insecure, QObject *parent)
deletePipelineCache();
loadSettings();
applySettings();

// react to color scheme changes (whether "dark mode" is enabled)
// note: Doing this is actually problematic since we would apply whether dark mode is enabled before the application
// palette changes not taking any palette changes into account yet. Then, when the palette changes, we would also
// not take it into account anymore because the dark mode setting was already applied. So it make sense to only
// rely on reacting to palette changes by default. This may still be useful on platforms where Qt is not providing
// a palette matching the darkmode setting but where it can detect whether darkmode is enabled.
#ifdef SYNCTHING_APP_HANDLE_DARK_MODE_CHANGED_EXPLICITLY
QtUtilities::onDarkModeChanged([this](bool darkColorScheme) { applyDarkmodeChange(darkColorScheme, m_darkPalette); }, this);
#endif

auto &iconManager = Data::IconManager::instance();
auto statusIconSettings = StatusIconSettings();
Expand Down

0 comments on commit 724037b

Please sign in to comment.