From b607988e9c2d33c84a5c4e6f6e4248fb94cb7e1d Mon Sep 17 00:00:00 2001 From: yeshanshan Date: Fri, 6 Mar 2026 15:09:56 +0800 Subject: [PATCH] fix: prevent mouse drag from blocking icon clicks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed an issue where dragging on application icons could block subsequent click events. Added explicit onClicked handler to MouseArea that only triggers root.itemClicked() when not actively dragging. This ensures that drag operations don't interfere with normal click behavior for launching applications. Log: Fixed application launch failure when clicking icons after drag operations Influence: 1. Test clicking application icons to ensure they launch correctly 2. Test dragging icons and verify drag functionality still works 3. Test quick click-drag-release scenarios to ensure no interference 4. Verify both mouse and touch interactions work properly 5. Test edge cases like partial drags and cancellations fix: 修复鼠标拖动导致图标点击失效的问题 修复了在应用程序图标上拖动操作会阻止后续点击事件的问题。为MouseArea添加 了显式的onClicked处理程序,仅在非拖动状态下触发root.itemClicked()。这确 保拖动操作不会干扰正常的点击启动应用程序行为。 Log: 修复拖动操作后点击图标无法启动应用的问题 Influence: 1. 测试点击应用程序图标,确保能正确启动应用 2. 测试拖动图标功能,验证拖动操作仍然有效 3. 测试快速点击-拖动-释放场景,确保没有相互干扰 4. 验证鼠标和触摸交互都能正常工作 5. 测试边缘情况,如部分拖动和取消操作 --- qml/windowed/IconItemDelegate.qml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/qml/windowed/IconItemDelegate.qml b/qml/windowed/IconItemDelegate.qml index c4133d0c..11d848f5 100644 --- a/qml/windowed/IconItemDelegate.qml +++ b/qml/windowed/IconItemDelegate.qml @@ -88,6 +88,11 @@ Control { }) } } + onClicked: { + if (!drag.active) { + root.itemClicked() + } + } } } @@ -120,12 +125,6 @@ Control { radius: 8 button: iconButton } - - // FIXME: This event never get triggered if and only if the DragHandler is enabled, - // which is not expected. This is a workaround for now. - onClicked: { - root.itemClicked() - } } background: DebugBounding { }