From 9bf6361171c6fc596400eb7a2457023af3edbaa9 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Wed, 15 Feb 2023 11:22:52 +0800 Subject: [PATCH] qt: adapt to latest qt dev code It was decided to rename the property from Appearance to ColorScheme. Signed-off-by: Yuhang Zhao <2546789017@qq.com> --- src/core/framelessmanager.cpp | 4 ++-- src/core/utils.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/framelessmanager.cpp b/src/core/framelessmanager.cpp index a61b3aa..cd49c14 100644 --- a/src/core/framelessmanager.cpp +++ b/src/core/framelessmanager.cpp @@ -355,8 +355,8 @@ void FramelessManagerPrivate::initialize() QStyleHints * const styleHints = QGuiApplication::styleHints(); Q_ASSERT(styleHints); if (styleHints) { - connect(styleHints, &QStyleHints::appearanceChanged, this, [this](const Qt::Appearance appearance){ - Q_UNUSED(appearance); + connect(styleHints, &QStyleHints::colorSchemeChanged, this, [this](const Qt::ColorScheme colorScheme){ + Q_UNUSED(colorScheme); notifySystemThemeHasChangedOrNot(); }); } diff --git a/src/core/utils.cpp b/src/core/utils.cpp index 6ae3aff..35316bc 100644 --- a/src/core/utils.cpp +++ b/src/core/utils.cpp @@ -282,7 +282,7 @@ QColor Utils::calculateSystemButtonBackgroundColor(const SystemButtonType button bool Utils::shouldAppsUseDarkMode() { #if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)) - return (QGuiApplication::styleHints()->appearance() == Qt::Appearance::Dark); + return (QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark); #elif ((QT_VERSION >= QT_VERSION_CHECK(6, 2, 1)) && !defined(FRAMELESSHELPER_CORE_NO_PRIVATE)) if (const QPlatformTheme * const theme = QGuiApplicationPrivate::platformTheme()) { return (theme->appearance() == QPlatformTheme::Appearance::Dark);