From 5f85a34bfdc997b5a469521f5bc0f78877146399 Mon Sep 17 00:00:00 2001 From: Cloud Date: Tue, 28 Jul 2026 21:43:19 +0800 Subject: [PATCH] fix(window): fix isEnabled() for Windows platform MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Windows, DPlatformHandle doesn't support isEnabledDXcb which is a Linux-specific function. Return handle existence directly instead to ensure the window reports correctly as enabled on Windows. fix(window): 修复 Windows 平台下 isEnabled() 的兼容性问题 DPlatformHandle::isEnabledDXcb 仅在 Linux 下可用,在 Windows 上直接返回 handle 是否存在以正确报告窗口启用状态。 --- src/dquickwindow.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/dquickwindow.cpp b/src/dquickwindow.cpp index de0a3bc0..47f92e38 100644 --- a/src/dquickwindow.cpp +++ b/src/dquickwindow.cpp @@ -396,8 +396,14 @@ void DQuickWindowAttached::setWindow(QQuickWindow *window) bool DQuickWindowAttached::isEnabled() const { D_DC(DQuickWindowAttached); +#ifdef Q_OS_WIN + // On Windows, DPlatformHandle doesn't support isEnabledDXcb, + // but we still need to report enabled when handle exists + return d->handle != nullptr; +#else return d->handle && (DPlatformHandle::isEnabledDXcb(window()) || DGuiApplicationHelper::testAttribute(DGuiApplicationHelper::IsWaylandPlatform)); +#endif } /*!