diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2021-06-29 11:58:04 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2021-09-17 13:31:59 +0200 |
commit | 2248487c6ca9d5459c70a16868d5aeee07d96157 (patch) | |
tree | d0e2c0dcb5338f58668be422bfc833215ee05323 /src/plugins/platforms/windows/qwindowstheme.cpp | |
parent | b6200de5d0894e63d58848e291f52a6ff98f3d9a (diff) |
Add QPlatformTheme::Appearance for detecting light/dark modes
And implement it on Windows and macOS.
Fixes: QTBUG-83908
Fixes: QTBUG-94859
Change-Id: I7b0c062adf5d4dbaefa64c862ab8ab1348809d71
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowstheme.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowstheme.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index 61a885953a..6fbf4183da 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -529,6 +529,11 @@ QVariant QWindowsTheme::themeHint(ThemeHint hint) const return QPlatformTheme::themeHint(hint); } +QPlatformTheme::Appearance QWindowsTheme::appearance() const +{ + return QWindowsContext::isDarkMode() ? Appearance::Dark : Appearance::Light; +} + void QWindowsTheme::clearPalettes() { qDeleteAll(m_palettes, m_palettes + NPalettes); |