From 413cbabae246a42ba57acfe09834f93e41f453f3 Mon Sep 17 00:00:00 2001 From: yeshanshan Date: Mon, 26 Jan 2026 17:07:30 +0800 Subject: [PATCH] fix: fix touchscreen double-tap and long-press handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Fixed touchscreen double-tap not maximizing/restoring windows by adding a separate TapHandler for non-mouse devices 2. Fixed touchscreen long-press not showing system window menu by handling it in the non-mouse TapHandler 3. Added device filtering to prevent conflicts between mouse and touchscreen events 4. The original TapHandler now only accepts mouse events with acceptedDevices: PointerDevice.Mouse 5. The new TapHandler accepts all non-mouse devices (touchscreen, stylus, etc.) and handles their gestures Log: Fixed touchscreen double-tap to maximize/restore windows and long- press to show system menu Influence: 1. Test double-tap on touchscreen to maximize and restore windows 2. Test long-press on touchscreen to show system window menu 3. Verify mouse right-click and left-click double-tap still work correctly 4. Test with different input devices (touchscreen, mouse, stylus) to ensure proper device filtering 5. Verify no conflicts between mouse and touchscreen event handling fix: 修复触摸屏双击和长按处理问题 1. 通过为非鼠标设备添加单独的TapHandler修复触摸屏双击无法最大化/还原窗口 的问题 2. 通过在非鼠标TapHandler中处理长按修复触摸屏长按无法显示系统窗口菜单的 问题 3. 添加设备过滤以防止鼠标和触摸屏事件冲突 4. 原TapHandler现在只接受鼠标事件(acceptedDevices: PointerDevice.Mouse) 5. 新的TapHandler接受所有非鼠标设备(触摸屏、手写笔等)并处理其手势 Log: 修复触摸屏双击最大化/还原窗口和长按显示系统菜单功能 Influence: 1. 测试触摸屏双击以最大化和还原窗口 2. 测试触摸屏长按以显示系统窗口菜单 3. 验证鼠标右键和左键双击功能是否正常工作 4. 测试不同输入设备(触摸屏、鼠标、手写笔)以确保正确的设备过滤 5. 验证鼠标和触摸屏事件处理之间没有冲突 PMS: BUG-348313 --- qt6/src/qml/TitleBar.qml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/qt6/src/qml/TitleBar.qml b/qt6/src/qml/TitleBar.qml index b8fae800..9291d3fb 100644 --- a/qt6/src/qml/TitleBar.qml +++ b/qt6/src/qml/TitleBar.qml @@ -57,6 +57,7 @@ Item { } TapHandler { acceptedButtons: Qt.RightButton | Qt.LeftButton + acceptedDevices: PointerDevice.AllDevices & ~PointerDevice.TouchScreen onDoubleTapped: function (eventPoint, button) { if (button === Qt.LeftButton) { control.toggleWindowState() @@ -70,6 +71,15 @@ Item { } } } + TapHandler { + acceptedDevices: PointerDevice.TouchScreen + onDoubleTapped: function () { + control.toggleWindowState() + } + onLongPressed: function () { + __dwindow.popupSystemWindowMenu() + } + } Loader { id: background