diff options
Diffstat (limited to 'src/widgets/styles/qwindowsstyle.cpp')
-rw-r--r-- | src/widgets/styles/qwindowsstyle.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
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 <qpa/qplatformscreen.h> #include <private/qguiapplication_p.h> #include <private/qhighdpiscaling_p.h> +#include <qpa/qplatformnativeinterface.h> #include <private/qwidget_p.h> #include <private/qstylehelper_p.h> @@ -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<bool>() + && ni->property("darkMode").value<bool>(); + } +#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 { |