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>
This commit is contained in:
parent
78a574f028
commit
43ef22045c
@ -188,8 +188,11 @@ static inline unsigned parseOptions(const QStringList ¶mList,
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user