From d506eb93a4872ce9d4927b214c43071ea724564e Mon Sep 17 00:00:00 2001 From: wjyrich Date: Mon, 2 Feb 2026 10:38:55 +0800 Subject: [PATCH] fix: improve focus management for wheel scrolling in fullscreen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Added scrolledByWheel property to track mouse wheel page navigation 2. Modified focus behavior to always focus first app when scrolling with wheel 3. Fixed inconsistent focus positioning after wheel vs keyboard navigation 4. Reset scrolledByWheel flag after processing to prevent stale state Log: Improved application focus behavior when using mouse wheel to navigate pages in fullscreen mode Influence: 1. Test mouse wheel page navigation in fullscreen mode 2. Verify focus correctly moves to first application after wheel scrolling 3. Compare focus behavior between wheel scrolling and keyboard navigation 4. Test edge cases like scrolling from first to last page and vice versa 5. Verify focus is not lost when switching between different navigation methods fix: 修复全屏模式下滚轮滚动时的焦点管理问题 1. 添加 scrolledByWheel 属性来跟踪鼠标滚轮翻页操作 2. 修改焦点行为,滚轮翻页时始终聚焦到第一个应用 3. 修复滚轮导航和键盘导航后焦点位置不一致的问题 4. 处理完成后重置 scrolledByWheel 标志,防止状态残留 Log: 改进了全屏模式下使用鼠标滚轮翻页时的应用焦点行为 Influence: 1. 测试全屏模式下的鼠标滚轮翻页功能 2. 验证滚轮翻页后焦点是否正确移动到第一个应用 3. 比较滚轮滚动和键盘导航的焦点行为差异 4. 测试边缘情况,如从第一页滚动到最后一页及反向操作 5. 验证在不同导航方法切换时焦点不会丢失 PMS: BUG-337493 --- qml/FullscreenFrame.qml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/qml/FullscreenFrame.qml b/qml/FullscreenFrame.qml index a76dc9ad..fbc75e6f 100644 --- a/qml/FullscreenFrame.qml +++ b/qml/FullscreenFrame.qml @@ -252,12 +252,14 @@ InputEventItem { if (!searchEdit.focus) { // reset keyboard focus when using mouse to flip page, but keep searchEdit focus baseLayer.focus = true } + listviewPage.scrolledByWheel = true decrementPageIndex(listviewPage) } else if (toPage > 0) { flipPageDelay.start() if (!searchEdit.focus) { // reset keyboard focus when using mouse to flip page, but keep searchEdit focus baseLayer.focus = true } + listviewPage.scrolledByWheel = true incrementPageIndex(listviewPage) } } @@ -375,6 +377,7 @@ InputEventItem { } property int previousIndex: -1 + property bool scrolledByWheel: false model: itemPageModel delegate: FocusScope { @@ -431,7 +434,11 @@ InputEventItem { listviewPage.previousIndex = listviewPage.currentIndex return } - if (listviewPage.currentIndex + 1 === listviewPage.previousIndex || (listviewPage.previousIndex === 0 && listviewPage.currentIndex === listviewPage.count - 1)) { + // 如果是通过滚轮翻页,始终将焦点设置到第一个应用 + if (listviewPage.scrolledByWheel) { + gridViewContainer.setPreviousPageSwitch(false) + listviewPage.scrolledByWheel = false + } else if (listviewPage.currentIndex + 1 === listviewPage.previousIndex || (listviewPage.previousIndex === 0 && listviewPage.currentIndex === listviewPage.count - 1)) { gridViewContainer.setPreviousPageSwitch(true) } else { gridViewContainer.setPreviousPageSwitch(false)