Skip to content

Commit 892f8bc

Browse files
committed
fix: resolve popup cursor display incorrect as arrow when hovering links
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
1 parent 9711b96 commit 892f8bc

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/loader/widgetplugin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

@@ -79,7 +79,7 @@ class Q_DECL_HIDDEN EventFilter : public QObject
7979

8080
auto windowHandle = widget->window()->windowHandle();
8181
if (auto pluginPopup = Plugin::PluginPopup::getWithoutCreating(windowHandle)) {
82-
Qt::CursorShape cursorShape = widget->cursor().shape();
82+
Qt::CursorShape cursorShape = windowHandle->cursor().shape();
8383
Q_EMIT pluginPopup->requestSetCursor(static_cast<int>(cursorShape));
8484
}
8585
}

0 commit comments

Comments
 (0)