summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-07-12 10:15:52 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2022-07-12 23:57:20 +0200
commit43ef22045c6f4fbf76d5cfa4ca32160d919b9984 (patch)
treea9822cd6c99634929967f5d47947a84296bfc8ca /src/plugins
parent78a574f0282017d939defc5327fbab1ca7c28f27 (diff)
Windows: Turn on dark mode support by default
The implementation was already there, and handles theme changes at runtime as well. However, it was disabled unless the QPA parameter "darkmode" was set to either 1 (supporting only the frame) or 2 (the Windows theme also supports dark mode when reading the palette). With both Windows 10 and Windows 11 now having dark mode as a fully supported feature that is easily accessible to end-users, we should respect that setting by default. So change the default: support both dark window frames and palette, and let users turn this partially off by setting darkmode=1 or darkmode=0. This does not mean accent colors etc are fully supported by the Windows styles. [ChangeLog][QtGui][Windows] Dark mode, both for the window frames and for the palette, is now supported by default. It can be turned off (partially or entirely) by setting the QPA parameter "darkmode=0" (no dark mode support) or "darkmode=1" (darkmode support only for the window frames). Pick-to: 6.4 Fixes: QTBUG-72028 Change-Id: Ia55af101896c106cde21340b306aa81390e608a2 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index f1874b37bb..40b264d186 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -188,8 +188,11 @@ static inline unsigned parseOptions(const QStringList &paramList,
options |= QWindowsIntegration::DontUseWMPointer;
} else if (param == u"reverse") {
options |= QWindowsIntegration::RtlEnabled;
+ } else if (param == u"darkmode=0") {
+ *darkModeHandling = {};
} else if (param == u"darkmode=1") {
darkModeHandling->setFlag(DarkModeHandlingFlag::DarkModeWindowFrames);
+ darkModeHandling->setFlag(DarkModeHandlingFlag::DarkModeStyle, false);
} else if (param == u"darkmode=2") {
darkModeHandling->setFlag(DarkModeHandlingFlag::DarkModeWindowFrames);
darkModeHandling->setFlag(DarkModeHandlingFlag::DarkModeStyle);
@@ -209,7 +212,8 @@ void QWindowsIntegrationPrivate::parseOptions(QWindowsIntegration *q, const QStr
QtWindows::ProcessDpiAwareness dpiAwareness = QtWindows::ProcessPerMonitorV2DpiAware;
int tabletAbsoluteRange = -1;
- DarkModeHandling darkModeHandling;
+ DarkModeHandling darkModeHandling = DarkModeHandlingFlag::DarkModeWindowFrames
+ | DarkModeHandlingFlag::DarkModeStyle;
m_options = ::parseOptions(paramList, &tabletAbsoluteRange, &dpiAwareness, &darkModeHandling);
q->setDarkModeHandling(darkModeHandling);
QWindowsFontDatabase::setFontOptions(m_options);