From 859307d7a590873d8df5f8094e13043370fccaa7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 25 Sep 2019 15:04:36 +0200 Subject: Windows QPA: Provide an experimental palette for dark mode Provide a simple palette for dark mode, implementing dark mode support level 2. Task-number: QTBUG-72028 Change-Id: I6f71870b251ccb7da30c01abb22c224e600f2b27 Reviewed-by: Oliver Wolff --- src/widgets/styles/qwindowsstyle.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/widgets/styles/qwindowsstyle.cpp') diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 8496a2c223..497afd17e1 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -84,6 +84,7 @@ #include #include #include +#include #include #include @@ -127,6 +128,22 @@ qreal QWindowsStylePrivate::appDevicePixelRatio() return qApp->devicePixelRatio(); } +bool QWindowsStylePrivate::isDarkMode() +{ + bool result = false; +#ifdef Q_OS_WIN + // Windows only: Return whether dark mode style support is desired and + // dark mode is in effect. + if (auto ni = QGuiApplication::platformNativeInterface()) { + const QVariant darkModeStyleP = ni->property("darkModeStyle"); + result = darkModeStyleP.type() == QVariant::Bool + && darkModeStyleP.value() + && ni->property("darkMode").value(); + } +#endif + return result; +} + // Returns \c true if the toplevel parent of \a widget has seen the Alt-key bool QWindowsStylePrivate::hasSeenAlt(const QWidget *widget) const { -- cgit v1.2.3