From 443a9fa2bd2d934abaef61715f0e9bcfeb50eadc Mon Sep 17 00:00:00 2001 From: Wladimir Leuschner Date: Mon, 22 May 2023 12:05:11 +0300 Subject: [PATCH] Use correct parameters to query highcontrastmode on Windows Task-number: QTBUG-113645 Change-Id: Ib400253a5589345648025c22c1487598cbefbd23 Pick-to: 6.5 Reviewed-by: Yuhang Zhao Reviewed-by: Oliver Wolff (cherry picked from commit e5c136c1797ca9a5f4763bfe30c570f6c4faf64f) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/windows/qwindowstheme.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index febec34d683..4fccec98fb6 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -1107,7 +1107,11 @@ bool QWindowsTheme::queryDarkMode() bool QWindowsTheme::queryHighContrast() { - return booleanSystemParametersInfo(SPI_GETHIGHCONTRAST, false); + HIGHCONTRAST hcf = {}; + hcf.cbSize = static_cast(sizeof(HIGHCONTRAST)); + if (SystemParametersInfo(SPI_GETHIGHCONTRAST, hcf.cbSize, &hcf, FALSE)) + return hcf.dwFlags & HCF_HIGHCONTRASTON; + return false; } QPlatformMenuItem *QWindowsTheme::createPlatformMenuItem() const