summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/kernel/qwindow_p.h4
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp8
2 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index cf6a6934eb8..ef633d093a1 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -23,7 +23,8 @@
#include <QtCore/private/qobject_p.h>
#include <QtCore/qelapsedtimer.h>
#include <QtCore/qxpfunctional.h>
-#include <QtGui/QIcon>
+#include <QtGui/qicon.h>
+#include <QtGui/qpalette.h>
QT_BEGIN_NAMESPACE
@@ -53,6 +54,7 @@ public:
QWindow *topLevelWindow(QWindow::AncestorMode mode = QWindow::IncludeTransients) const;
virtual QWindow *eventReceiver() { Q_Q(QWindow); return q; }
+ virtual QPalette windowPalette() const { return QPalette(); }
virtual void setVisible(bool visible);
void updateVisibility();
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index e4614392f75..7e3be1c0c3a 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -852,11 +852,13 @@ static inline bool shouldApplyDarkFrame(const QWindow *w)
// the application has explicitly opted out of dark frames
if (!QWindowsIntegration::instance()->darkModeHandling().testFlag(QWindowsApplication::DarkModeWindowFrames))
return false;
+
// if the application supports a dark border, and the palette is dark (window background color
// is darker than the text), then turn dark-border support on, otherwise use a light border.
- const QPalette defaultPalette;
- return defaultPalette.color(QPalette::WindowText).lightness()
- > defaultPalette.color(QPalette::Window).lightness();
+ auto *dWindow = QWindowPrivate::get(const_cast<QWindow*>(w));
+ const QPalette windowPal = dWindow->windowPalette();
+ return windowPal.color(QPalette::WindowText).lightness()
+ > windowPal.color(QPalette::Window).lightness();
}
QWindowsWindowData