Skip to content

Commit 613514a

Browse files
committed
fix: allow right-click long press to trigger context menu on touchscreen
1. Previously, onPressAndHold handlers only triggered when mouse.button was Qt.NoButton 2. Added Qt.RightButton as an additional trigger condition for long press 3. This allows right-click long press to also trigger context menus 4. Applied consistently across all relevant QML files: IconItemDelegate, AppListView, FreeSortListView, and windowed IconItemDelegate Log: Fixed context menu not opening on right-click long press Influence: 1. Test right-click long press on icons to verify context menu appears 2. Test regular long press (no button) still works as before 3. Verify no regression for touchscreen long press behavior 4. Test in both normal and windowed mode fix: 允许右键长按触发上下文菜单 1. 之前 onPressAndHold 处理器仅在 mouse.button 为 Qt.NoButton 时触发 2. 增加了 Qt.RightButton 作为长按的额外触发条件 3. 使右键长按也能触发上下文菜单 4. 在所有相关的 QML 文件中统一应用此修改:IconItemDelegate、 AppListView、FreeSortListView 和窗口模式下的 IconItemDelegate Log: 修复右键长按时上下文菜单无法打开的问题 Influence: 1. 在图标上测试右键长按,验证上下文菜单是否弹出 2. 测试常规长按(无按钮)是否仍正常工作 3. 验证触控屏长按行为没有回归问题 4. 在普通模式和窗口模式下分别测试 PMS: BUG-358827
1 parent ca88a70 commit 613514a

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

qml/IconItemDelegate.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Control {
158158
}
159159
// touchscreen long press.
160160
onPressAndHold: function (mouse) {
161-
if (mouse.button === Qt.NoButton) {
161+
if (mouse.button === Qt.NoButton ||| mouse.button === Qt.RightButton) {
162162
root.menuTriggered()
163163
}
164164
}

qml/windowed/AppListView.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ FocusScope {
242242
}
243243
// touchscreen long press.
244244
onPressAndHold: function (mouse) {
245-
if (mouse.button === Qt.NoButton) {
245+
if (mouse.button === Qt.NoButton || mouse.button === Qt.RightButton) {
246246
showContextMenu(itemDelegate, model)
247247
}
248248
}

qml/windowed/FreeSortListView.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ Item {
353353

354354
// touchscreen long press.
355355
onPressAndHold: function (mouse) {
356-
if (mouse.button === Qt.NoButton) {
356+
if (mouse.button === Qt.NoButton || mouse.button === Qt.RightButton) {
357357
showContextMenu(itemDelegate, model, {
358358
hideMoveToTopMenu: index === 0
359359
})

qml/windowed/IconItemDelegate.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Control {
6666
}
6767
// touchscreen long press.
6868
onPressAndHold: function (mouse) {
69-
if (mouse.button === Qt.NoButton) {
69+
if (mouse.button === Qt.NoButton || mouse.button === Qt.RightButton) {
7070
root.menuTriggered()
7171
}
7272
}

0 commit comments

Comments
 (0)