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>
This commit is contained in:
Yuhang Zhao 2023-02-15 11:22:52 +08:00
parent 8bd2a777d1
commit 9bf6361171
2 changed files with 3 additions and 3 deletions

View File

@ -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();
});
}

View File

@ -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);