diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-07-24 15:26:13 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-07-25 21:59:37 +0200 |
commit | 6d4b3582adaf3cea23b0ef777a1bf3e7597fd8da (patch) | |
tree | e5ba098842acc19330caa11ac542f3752b0a5034 /src/widgets | |
parent | f06dfb60b96004971917a27559713314b7f60de6 (diff) |
Windows QPA: Move dark mode handling to the new interface
Move options to new interface, making them settable from
code on this occasion.
Task-number: QTBUG-83252
Change-Id: Idd80667c502a8cde5d7c66d7e597ea34c22738e7
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/styles/qwindowsstyle.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index c442636e06..c402446df1 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -85,7 +85,7 @@ #include <qpa/qplatformscreen.h> #include <private/qguiapplication_p.h> #include <private/qhighdpiscaling_p.h> -#include <qpa/qplatformnativeinterface.h> +#include <qpa/qplatformintegration.h> #include <private/qwidget_p.h> #include <private/qstylehelper_p.h> @@ -133,13 +133,12 @@ bool QWindowsStylePrivate::isDarkMode() { bool result = false; #ifdef Q_OS_WIN + using QWindowsApplication = QPlatformInterface::Private::QWindowsApplication; // 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>(); + if (auto windowsApp = dynamic_cast<QWindowsApplication *>(QGuiApplicationPrivate::platformIntegration())) { + result = windowsApp->isDarkMode() + && windowsApp->darkModeHandling().testFlag(QWindowsApplication::DarkModeStyle); } #endif return result; |