summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qwindowsstyle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/styles/qwindowsstyle.cpp')
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index 4f8cc56e05..e275e3a714 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -78,12 +78,14 @@
#endif
#include <private/qmath_p.h>
#include <qmath.h>
+#include <QtGui/qpainterpath.h>
#include <QtGui/qscreen.h>
#include <QtGui/qwindow.h>
#include <qpa/qplatformtheme.h>
#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 +129,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
{
@@ -531,6 +549,8 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
switch (hint) {
case SH_EtchDisabledText:
+ ret = d_func()->isDarkMode() ? 0 : 1;
+ break;
case SH_Slider_SnapToValue:
case SH_PrintDialog_RightAlignButtons:
case SH_FontDialog_SelectAssociatedText:
@@ -1675,7 +1695,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
const bool vertical = pb->orientation == Qt::Vertical;
const bool inverted = pb->invertedAppearance;
- QMatrix m;
+ QTransform m;
if (vertical) {
rect = QRect(rect.y(), rect.x(), rect.height(), rect.width()); // flip width and height
m.rotate(90);