Skip to content

Commit ea26177

Browse files
committed
fix(dock): prevent menu hide after touch long-press
1. Add touchLongPressed flag to track touch long-press state 2. Skip mouse release handler when touch long-press was active 3. Reset flag on touch canceled to avoid stale state Log: Fix right-click menu auto-hiding after touch long-press on taskbar fix(dock): 修复长按任务栏后松手右键菜单自动隐藏的问题 1. 添加 touchLongPressed 标志位以跟踪触摸长按状态 2. 触摸长按激活时跳过鼠标释放事件的处理 3. 触摸取消时重置标志位,避免状态残留 Log: 修复长按任务栏应用和空白区域松开手指后右键菜单面板自动隐藏的问题 PMS: BUG-367313
1 parent c88557b commit ea26177

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

panels/dock/package/main.qml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ Window {
388388
id: dockContainer
389389
width: dock.useColumnLayout ? dock.dockSize : parent.width
390390
height: dock.useColumnLayout ? parent.height : dock.dockSize
391+
property bool touchLongPressed: false
391392
anchors {
392393
left: parent.left
393394
top: parent.top
@@ -437,6 +438,10 @@ Window {
437438
acceptedButtons: Qt.NoButton
438439
acceptedDevices: PointerDevice.TouchScreen
439440
onTapped: function(eventPoint, button) {
441+
if (dockContainer.touchLongPressed) {
442+
dockContainer.touchLongPressed = false
443+
return
444+
}
440445
let lastActive = MenuHelper.activeMenu
441446
MenuHelper.closeCurrent()
442447
dockMenuLoader.active = true
@@ -445,13 +450,17 @@ Window {
445450
viewDeactivated()
446451
}
447452
onLongPressed: {
453+
dockContainer.touchLongPressed = true
448454
let lastActive = MenuHelper.activeMenu
449455
MenuHelper.closeCurrent()
450456
dockMenuLoader.active = true
451457
if (lastActive !== dockMenuLoader.item) {
452458
requestShowDockMenu()
453459
}
454460
}
461+
onCanceled: {
462+
dockContainer.touchLongPressed = false
463+
}
455464
}
456465

457466
HoverHandler {

0 commit comments

Comments
 (0)