From fb2c3112024a4583b1bb0ebc84c8df11b2df415c Mon Sep 17 00:00:00 2001 From: zhaoyingzhen Date: Thu, 19 Mar 2026 21:56:03 +0800 Subject: [PATCH] fix: resolve popup cursor display incorrect as arrow when hovering links MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By default, Qt's QWidgetWindow forwards unhandled events (like CursorChange) to its top-level QWidget. If the global EventFilter monitors all widgets indiscriminately, it will intercept the forwarded event on the root widget and wrongly capture its ArrowCursor fallback value, thereby overwriting the correct PointingHand cursor globally. Instead of evaluating the widget's personal cursor state when a CursorChange happens, we now read the globally computed cursor shape straight from the target native windowHandle, ensuring Wayland popups consistently reflect the correct pointer shape. 修复悬浮超链接时气泡游标异常显示为箭头的问题 Qt 内部窗口事件回传机制会导致系统原生的 QWindow 将自身游标变化转发给底下的 最顶层 QWidget 容器。因为原事件监听器无差别捕获所有由于转发而受到的游标改变 信号,而顶层容器并未独立设过游标(呈现默认箭头),导致在捕获后向 Wayland 误传 了箭头重置。 通过将取值对象从转发目标(Widget小组件自身)改为实际的载体原生窗口(WindowHandle), 彻底绕过组件树转发污染,使得弹窗在 Wayland 环境下可以随时反馈准确的游标状态。 Log: resolve popup cursor display incorrect as arrow when hovering links --- src/loader/widgetplugin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/loader/widgetplugin.cpp b/src/loader/widgetplugin.cpp index 56fbfa8b7..c5f3c276d 100644 --- a/src/loader/widgetplugin.cpp +++ b/src/loader/widgetplugin.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -79,7 +79,7 @@ class Q_DECL_HIDDEN EventFilter : public QObject auto windowHandle = widget->window()->windowHandle(); if (auto pluginPopup = Plugin::PluginPopup::getWithoutCreating(windowHandle)) { - Qt::CursorShape cursorShape = widget->cursor().shape(); + Qt::CursorShape cursorShape = windowHandle->cursor().shape(); Q_EMIT pluginPopup->requestSetCursor(static_cast(cursorShape)); } }