Skip to content
Snippets Groups Projects
Commit e2d5da81 authored by Aline Gondim Santos's avatar Aline Gondim Santos
Browse files

windows: watch for system theme change

Requires Windows SDK version 10.0.18362.0 and Windows Runtime
10.0.10240.0.

GitLab: #723
Change-Id: I166c236bf24419b4abfe323f88e470dd07afbd4f
parent 003b6be6
No related branches found
No related tags found
No related merge requests found
......@@ -697,6 +697,12 @@ UtilsAdapter::isSystemThemeDark()
return false;
#else
#if defined(WIN32) && __has_include(<winrt/Windows.Foundation.h>)
#if WATCHSYSTEMTHEME
if (!settings) {
settings = UISettings();
settings.ColorValuesChanged([this](auto&&...) { Q_EMIT appThemeChanged(); });
}
#endif
return readAppsUseLightThemeRegistry(true);
#else
qWarning("System theme detection is not implemented or is not supported");
......
......@@ -35,6 +35,15 @@
#if defined(WIN32) && __has_include(<winrt/Windows.Foundation.h>)
#include <winrt/Windows.Foundation.h>
#define WATCHSYSTEMTHEME \
__has_include(<winrt/Windows.UI.ViewManagement.h>)
#if WATCHSYSTEMTHEME
#include <winrt/Windows.UI.ViewManagement.h>
#endif
using winrt::Windows::UI::ViewManagement::UISettings;
#endif
class QClipboard;
......@@ -151,5 +160,9 @@ private:
GSettings* settings {nullptr};
GSettingsSchema* schema {nullptr};
#endif
#if WATCHSYSTEMTHEME
UISettings settings = NULL;
#endif
};
Q_DECLARE_METATYPE(UtilsAdapter*)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment