From e33059ee1ef7e1be07490ad0245676ded42589f4 Mon Sep 17 00:00:00 2001 From: Zhao Yuhang <2546789017@qq.com> Date: 周五, 22 12月 2023 23:12:16 +0800 Subject: [PATCH] win: allow dynamic switch dark mode --- src/core/shared/qwkwindowsextra_p.h | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/src/core/shared/qwkwindowsextra_p.h b/src/core/shared/qwkwindowsextra_p.h index 03adf7e..cc6744b 100644 --- a/src/core/shared/qwkwindowsextra_p.h +++ b/src/core/shared/qwkwindowsextra_p.h @@ -293,6 +293,11 @@ return result; } + static inline bool isWin101809OrGreater() { + static const bool result = IsWindows101809OrGreater_Real(); + return result; + } + static inline bool isWin11OrGreater() { static const bool result = IsWindows11OrGreater_Real(); return result; @@ -327,6 +332,13 @@ return value.first; } + static inline bool isHighContrastModeEnabled() { + HIGHCONTRASTW hc{}; + hc.cbSize = sizeof(hc); + ::SystemParametersInfoW(SPI_GETHIGHCONTRAST, sizeof(hc), &hc, FALSE); + return (hc.dwFlags & HCF_HIGHCONTRASTON); + } + static inline bool isDarkThemeActive() { #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) return QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark; -- Gitblit v1.9.1