diff --git a/qml/windowed/AppListView.qml b/qml/windowed/AppListView.qml index 86dd48b9..67c0436f 100644 --- a/qml/windowed/AppListView.qml +++ b/qml/windowed/AppListView.qml @@ -225,20 +225,23 @@ FocusScope { // 当分类菜单打开时,禁用拖拽功能 enabled: !(ddeCategoryMenu.visible || alphabetCategoryPopup.visible) - // 记录是否是触摸长按导致的,防止在 onClicked 中重复处理 - property bool isTouchLongPressed: false - TapHandler { acceptedDevices: PointerDevice.TouchScreen gesturePolicy: TapHandler.DragThreshold + onTapped: function(eventPoint, buttons) { + launchApp(desktopId) + } onLongPressed: { - mouseArea.isTouchLongPressed = true showContextMenu(itemDelegate, model) } } onPressed: function (mouse) { - isTouchLongPressed = false + // 触屏合成的鼠标事件不接受,交给 Flickable 处理滚动 + if (mouse.source !== undefined && mouse.source !== Qt.MouseEventNotSynthesized) { + mouse.accepted = false + return + } if (mouse.button === Qt.LeftButton) { itemDelegate.contentItem.grabToImage(function(result) { itemDelegate.Drag.imageSource = result.url @@ -246,11 +249,6 @@ FocusScope { } } onClicked: function (mouse) { - if (isTouchLongPressed) { - isTouchLongPressed = false - return - } - if (mouse.button === Qt.RightButton) { showContextMenu(itemDelegate, model) baseLayer.focus = true diff --git a/qml/windowed/FreeSortListView.qml b/qml/windowed/FreeSortListView.qml index 2697f52a..e03c7c64 100644 --- a/qml/windowed/FreeSortListView.qml +++ b/qml/windowed/FreeSortListView.qml @@ -335,14 +335,13 @@ Item { acceptedButtons: Qt.LeftButton | Qt.RightButton drag.target: dndTarget - // 记录是否是触摸长按导致的,防止在 onClicked 中重复处理 - property bool isTouchLongPressed: false - TapHandler { acceptedDevices: PointerDevice.TouchScreen gesturePolicy: TapHandler.DragThreshold + onTapped: function(eventPoint, buttons) { + launchItem() + } onLongPressed: { - mouseArea.isTouchLongPressed = true showContextMenu(itemDelegate, model, { hideMoveToTopMenu: index === 0 }) @@ -351,20 +350,18 @@ Item { } onPressed: function (mouse) { - isTouchLongPressed = false + // 触屏合成的鼠标事件不接受,交给 Flickable 处理滚动 + if (mouse.source !== undefined && mouse.source !== Qt.MouseEventNotSynthesized) { + mouse.accepted = false + return + } if (mouse.button === Qt.LeftButton) { itemDelegate.contentItem.grabToImage(function(result) { itemDelegate.Drag.imageSource = result.url }) } } - onClicked: function (mouse) { - if (isTouchLongPressed) { - isTouchLongPressed = false - return - } - if (mouse.button === Qt.RightButton) { showContextMenu(itemDelegate, model, { hideMoveToTopMenu: index === 0