Skip to content

Commit a206c65

Browse files
committed
fix: enable touch scrolling in launcher
1. Update the icon press handling in AppListView.qml and FreeSortListView.qml. 2. Detect synthesized mouse events generated from touch input by checking mouse.source. 3. When the event comes from touch rather than a real mouse, mark it as not accepted and return early so the parent Flickable can handle vertical scrolling. 4. Keep the existing left-click image grab and subsequent interaction logic unchanged for real mouse input. 5. This change is necessary because launcher icons were consuming touch-generated press events, which blocked swipe up/down gestures and prevented smooth scrolling in the app list. Log: Enabled vertical touch scrolling on launcher app icons Influence: 1. Verify that swiping up and down directly on launcher icons scrolls the app list smoothly. 2. Verify that mouse left-click behavior on icons is unchanged, including image grab related interactions. 3. Test long-press behavior on touch devices to ensure it does not regress unexpectedly. 4. Verify scrolling behavior in both AppListView and FreeSortListView. 5. Test with real mouse input and touch input separately to confirm correct event routing. 6. Check that icon click, drag, and reorder related interactions still work as expected after the event acceptance change. fix: 启动器支持图标区域触控滑动 1. 更新了 AppListView.qml 和 FreeSortListView.qml 中的图标按下事件处理 逻辑。 2. 通过检查 mouse.source 来识别由触摸输入合成的鼠标事件。 3. 当事件来源于触摸而不是真实鼠标时,将事件设置为不接受并提前返回,让父 级 Flickable 接管上下滑动处理。 4. 对真实鼠标输入,保留原有的左键截图抓取及后续交互逻辑不变。 5. 之所以需要此修改,是因为启动器图标此前会消费触摸生成的按下事件,导致 用户在图标区域上下滑动时手势被拦截,应用列表无法顺畅滚动。 Log: 已支持在启动器应用图标区域进行上下触控滑动 Influence: 1. 验证在启动器图标区域直接上下滑动时,应用列表能够平滑滚动。 2. 验证鼠标左键点击图标的行为保持不变,包括相关的图像抓取交互。 3. 在触屏设备上测试长按行为,确认没有引入异常回归。 4. 分别验证 AppListView 和 FreeSortListView 中的滚动表现。 5. 使用真实鼠标输入和触摸输入分别测试,确认事件分发符合预期。 6. 检查图标点击、拖拽、自由排序等相关交互在事件接受逻辑调整后仍然正常。 PMS: BUG-362161 Change-Id: I54e01447f677a2275ab285c576dabbf84799f5f5
1 parent e5e72a1 commit a206c65

2 files changed

Lines changed: 16 additions & 21 deletions

File tree

qml/windowed/AppListView.qml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,32 +225,30 @@ FocusScope {
225225
// 当分类菜单打开时,禁用拖拽功能
226226
enabled: !(ddeCategoryMenu.visible || alphabetCategoryPopup.visible)
227227

228-
// 记录是否是触摸长按导致的,防止在 onClicked 中重复处理
229-
property bool isTouchLongPressed: false
230-
231228
TapHandler {
232229
acceptedDevices: PointerDevice.TouchScreen
233230
gesturePolicy: TapHandler.DragThreshold
231+
onTapped: function(eventPoint, buttons) {
232+
launchApp(desktopId)
233+
}
234234
onLongPressed: {
235-
mouseArea.isTouchLongPressed = true
236235
showContextMenu(itemDelegate, model)
237236
}
238237
}
239238

240239
onPressed: function (mouse) {
241-
isTouchLongPressed = false
240+
// 触屏合成的鼠标事件不接受,交给 Flickable 处理滚动
241+
if (mouse.source !== undefined && mouse.source !== 0) {
242+
mouse.accepted = false
243+
return
244+
}
242245
if (mouse.button === Qt.LeftButton) {
243246
itemDelegate.contentItem.grabToImage(function(result) {
244247
itemDelegate.Drag.imageSource = result.url
245248
})
246249
}
247250
}
248251
onClicked: function (mouse) {
249-
if (isTouchLongPressed) {
250-
isTouchLongPressed = false
251-
return
252-
}
253-
254252
if (mouse.button === Qt.RightButton) {
255253
showContextMenu(itemDelegate, model)
256254
baseLayer.focus = true

qml/windowed/FreeSortListView.qml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -335,14 +335,13 @@ Item {
335335
acceptedButtons: Qt.LeftButton | Qt.RightButton
336336
drag.target: dndTarget
337337

338-
// 记录是否是触摸长按导致的,防止在 onClicked 中重复处理
339-
property bool isTouchLongPressed: false
340-
341338
TapHandler {
342339
acceptedDevices: PointerDevice.TouchScreen
343340
gesturePolicy: TapHandler.DragThreshold
341+
onTapped: function(eventPoint, buttons) {
342+
launchItem()
343+
}
344344
onLongPressed: {
345-
mouseArea.isTouchLongPressed = true
346345
showContextMenu(itemDelegate, model, {
347346
hideMoveToTopMenu: index === 0
348347
})
@@ -351,20 +350,18 @@ Item {
351350
}
352351

353352
onPressed: function (mouse) {
354-
isTouchLongPressed = false
353+
// 触屏合成的鼠标事件不接受,交给 Flickable 处理滚动
354+
if (mouse.source !== undefined && mouse.source !== 0) {
355+
mouse.accepted = false
356+
return
357+
}
355358
if (mouse.button === Qt.LeftButton) {
356359
itemDelegate.contentItem.grabToImage(function(result) {
357360
itemDelegate.Drag.imageSource = result.url
358361
})
359362
}
360363
}
361-
362364
onClicked: function (mouse) {
363-
if (isTouchLongPressed) {
364-
isTouchLongPressed = false
365-
return
366-
}
367-
368365
if (mouse.button === Qt.RightButton) {
369366
showContextMenu(itemDelegate, model, {
370367
hideMoveToTopMenu: index === 0

0 commit comments

Comments
 (0)