From 5c04046acae6e61280fba7fef31401edd7c36087 Mon Sep 17 00:00:00 2001 From: Dylan Liu <312902918@qq.com> Date: 周五, 23 5月 2025 16:04:20 +0800 Subject: [PATCH] QWKCore/cocoawindowcontext: Use typeId() instead of type() in Qt 6.0+. (#181) --- src/core/contexts/cocoawindowcontext.mm | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/src/core/contexts/cocoawindowcontext.mm b/src/core/contexts/cocoawindowcontext.mm index 28738c6..dbf260e 100644 --- a/src/core/contexts/cocoawindowcontext.mm +++ b/src/core/contexts/cocoawindowcontext.mm @@ -745,7 +745,11 @@ Q_ASSERT(m_windowId); if (key == QStringLiteral("no-system-buttons")) { +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) if (attribute.type() != QVariant::Bool) +#else + if (attribute.typeId() != QMetaType::Type::Bool) +#endif return false; ensureWindowProxy(m_windowId)->setSystemButtonVisible(!attribute.toBool()); return true; @@ -753,14 +757,22 @@ if (key == QStringLiteral("blur-effect")) { auto mode = NSWindowProxy::BlurMode::None; +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) if (attribute.type() == QVariant::Bool) { +#else + if (attribute.typeId() == QMetaType::Type::Bool) { +#endif if (attribute.toBool()) { NSString *osxMode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"]; mode = [osxMode isEqualToString:@"Dark"] ? NSWindowProxy::BlurMode::Dark : NSWindowProxy::BlurMode::Light; } +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) } else if (attribute.type() == QVariant::String) { +#else + } else if (attribute.typeId() == QMetaType::Type::QString) { +#endif auto value = attribute.toString(); if (value == QStringLiteral("dark")) { mode = NSWindowProxy::BlurMode::Dark; -- Gitblit v1.9.1