From 31f3cd385f24431d68d0503014dc67b98acb19a7 Mon Sep 17 00:00:00 2001 From: zhangkun2 Date: Mon, 14 Sep 2026 12:56:27 +0800 Subject: [PATCH] fix: filter touch events in windowed icon delegate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Root cause: IconItemDelegate.qml MouseArea.onPressed lacks mouse.source check, touch-synthesized events consumed by drag mechanism, blocking parent Flickable scrolling 2. Fix: add mouse.source guard to reject synthesized events, add TapHandler for touch tap and long-press menu support 3. Impact: only IconItemDelegate.qml changed, real mouse interaction unaffected, follows same pattern as AppListView (f86bd7a) Log: fix touch scroll triggering app drag in windowed launcher Influence: 1. Test touchscreen single-finger scroll in app grid area 2. Test touchscreen tap to open app and long-press for context menu 3. Test mouse left-click, right-click, and drag remain functional fix: 过滤窗口模式图标代理的触摸事件 1. 根因:IconItemDelegate.qml 的 MouseArea.onPressed 缺少 mouse.source 检查,触摸合成事件被 drag 机制消费,阻止父级 Flickable 滚动 2. 方案:添加 mouse.source 守卫拒绝合成事件,添加 TapHandler 支持触摸点击和长按菜单 3. 影响:仅修改 IconItemDelegate.qml,真实鼠标交互不受影响, 与 AppListView(f86bd7a)修复模式一致 Log: 修复窗口模式启动器触摸滑动触发应用拖拽的问题 Influence: 1. 测试触控屏单指在应用网格区域滑动滚动 2. 测试触控屏点击打开应用和长按弹出右键菜单 3. 测试鼠标左键点击、右键菜单、拖拽功能正常 PMS: BUG-309193 --- qml/windowed/IconItemDelegate.qml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/qml/windowed/IconItemDelegate.qml b/qml/windowed/IconItemDelegate.qml index 9a8b403c..0284f3a2 100644 --- a/qml/windowed/IconItemDelegate.qml +++ b/qml/windowed/IconItemDelegate.qml @@ -59,7 +59,24 @@ Control { drag.onActiveChanged: function () { root.Drag.active = drag.active } + + TapHandler { + acceptedDevices: PointerDevice.TouchScreen + gesturePolicy: TapHandler.DragThreshold + onTapped: function(eventPoint, buttons) { + root.itemClicked() + } + onLongPressed: { + root.menuTriggered() + } + } + onPressed: function (mouse) { + // 触屏合成的鼠标事件不接受,交给 Flickable 处理滚动 + if (mouse.source !== undefined && mouse.source !== Qt.MouseEventNotSynthesized) { + mouse.accepted = false + return + } if (mouse.button === Qt.LeftButton && root.dndEnabled) { appIcon.grabToImage(function(result) { root.Drag.imageSource = result.url;