summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowscontext.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-07-14 17:00:16 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2022-07-19 05:12:05 +0200
commit5ea7e3a8111b2939f0c91b750aa1c62ab16ab715 (patch)
treed9b93c38bec5ab49f30ff62d833afd1d378c2171 /src/plugins/platforms/windows/qwindowscontext.cpp
parent0d91f85f6cd96d321b7509c042e02636995c966c (diff)
Windows: better handling of darkmode support
43ef22045c6f4fbf76d5cfa4ca32160d919b9984 turned dark mode support on for both styling and window frames. However, the default palette and style support in Qt is too incomplete, resulting in unreadable UIs when using certain styles (e.g. fusion). Also the vista style is not supporting dark mode. If we don't turn on dark style support, then dark frame support doesn't look good either. However, many application developers have implement a dark theme themselves, and we should have a dark frame for those applications. So partially revert 43ef22045c6f4fbf76d5cfa4ca32160d919b9984 so that dark style support is disabled by default, and leave dark frame support on. However, only activate dark frames if the palette is dark, i.e. if the window background color in the default palette is darker than the text color (or if DarkModeStyle is explicitly turned on by running the application with -platform windows:darkmode=2). This way, dark-themed applications get a dark frame on dark Windows, and a light frame on light Windows; and light-themed applications (including default Qt applications) get a light frame all the time. Fixes: QTBUG-72028 Pick-to: 6.4 Change-Id: I61f1b1e43b2a4ba69848d5d8bec921c0790fe511 Reviewed-by: Marius Kittler <mariuskittler@gmx.de> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowscontext.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 916594714c..6f9a533bcd 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -1103,14 +1103,14 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
if (darkMode != QWindowsContextPrivate::m_darkMode) {
QWindowsContextPrivate::m_darkMode = darkMode;
auto integration = QWindowsIntegration::instance();
- if (integration->darkModeHandling().testFlag(QWindowsApplication::DarkModeWindowFrames)) {
- for (QWindowsWindow *w : d->m_windows)
- w->setDarkBorder(QWindowsContextPrivate::m_darkMode);
- }
if (integration->darkModeHandling().testFlag(QWindowsApplication::DarkModeStyle)) {
QWindowsTheme::instance()->refresh();
QWindowSystemInterface::handleThemeChange();
}
+ if (integration->darkModeHandling().testFlag(QWindowsApplication::DarkModeWindowFrames)) {
+ for (QWindowsWindow *w : d->m_windows)
+ w->setDarkBorder(QWindowsContextPrivate::m_darkMode);
+ }
}
}
return d->m_screenManager.handleScreenChanges();