From 84a04fb05f2ce9975f37f28bdf22127f2fba29ed Mon Sep 17 00:00:00 2001 From: ayt Date: Wed, 11 Mar 2026 20:12:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(qml):=E8=A7=A3=E5=86=B3X=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E4=B8=8B=EF=BC=8C=E6=AD=A3=E5=B8=B8=E6=A8=A1=E5=BC=8F=E5=92=8C?= =?UTF-8?q?=E5=85=A8=E5=B1=8F=E6=A8=A1=E5=BC=8F=E5=88=87=E6=8D=A2=E6=97=B6?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在解决标题中存在的问题的同时,此PR同时解决了X环境下开始菜单存在的如下问题,1.开始菜单隐藏后再打开时,搜索框内容不清空的问题,2.全屏模式和正常模式切换时,搜索框内容不保留的问题,3.通过enter键进入全屏模式后,焦点不保留在扩展按钮上的问题 Task: #598261 From: kylin Severity: Low Changelog-Other: 消除模式切换时存在报错的问题 Changelog-Break: 开始菜单全屏模式和正常模式切换时的UI页面 Change-Id: Ic8839900e4db866b488867ab08853e28bbf87a10 --- qml/AppUI/AppPageSearch.qml | 5 +++++ qml/AppUI/FullScreenUI.qml | 13 +++++++++++-- qml/AppUI/NormalUI.qml | 1 + src/windows/menu-main-window.cpp | 1 + 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/qml/AppUI/AppPageSearch.qml b/qml/AppUI/AppPageSearch.qml index dfb1067d..41b81431 100644 --- a/qml/AppUI/AppPageSearch.qml +++ b/qml/AppUI/AppPageSearch.qml @@ -54,8 +54,13 @@ Item { } Component.onCompleted: { + menuStateChanged(); mainWindow.fullScreenChanged.connect(menuStateChanged); } + + Component.onDestruction: { + mainWindow.fullScreenChanged.disconnect(menuStateChanged); + } } function changeToSearch(key) { diff --git a/qml/AppUI/FullScreenUI.qml b/qml/AppUI/FullScreenUI.qml index ad5185ae..a00c2da8 100644 --- a/qml/AppUI/FullScreenUI.qml +++ b/qml/AppUI/FullScreenUI.qml @@ -16,11 +16,13 @@ FocusScope { Component.onCompleted: { resetToDefaultState(); + menuStateChanged(); mainWindow.windowVisibleChanged.connect(resetToDefaultState); mainWindow.fullScreenChanged.connect(menuStateChanged); } Component.onDestruction: { mainWindow.windowVisibleChanged.disconnect(resetToDefaultState); + mainWindow.fullScreenChanged.disconnect(menuStateChanged); } function resetToDefaultState() { @@ -191,8 +193,14 @@ FocusScope { } Component.onCompleted: { + menuStateChanged(); mainWindow.fullScreenChanged.connect(menuStateChanged); } + + Component.onDestruction: { + mainWindow.fullScreenChanged.disconnect(menuStateChanged); + } + } } @@ -229,7 +237,7 @@ FocusScope { onClicked: { if (mainWindow.isFullScreen) { root.currentSearchText = searchInputBar.text; - mainWindow.isFullScreen = false; + mainWindow.exitFullScreen(); } else { root.currentSearchText = appPage.search.searchInputBar.text; mainWindow.isFullScreen = true; @@ -241,7 +249,7 @@ FocusScope { root.focusOnFoldButton = true; if (mainWindow.isFullScreen) { root.currentSearchText = searchInputBar.text; - mainWindow.isFullScreen = false; + mainWindow.exitFullScreen(); } else { root.currentSearchText = appPage.search.searchInputBar.text; mainWindow.isFullScreen = true; @@ -341,6 +349,7 @@ FocusScope { } onCurrentIndexChanged: { + if (model.length === 0) return; let label = model[currentIndex].label; if (fullScreenAppList.headerItem.widgets.includes(label)) { fullScreenAppList.currentLabelIndex = -1; diff --git a/qml/AppUI/NormalUI.qml b/qml/AppUI/NormalUI.qml index 34edc253..6312d7a9 100644 --- a/qml/AppUI/NormalUI.qml +++ b/qml/AppUI/NormalUI.qml @@ -14,6 +14,7 @@ FocusScope { } Component.onDestruction: { mainWindow.windowVisibleChanged.disconnect(resetToDefaultState); + mainWindow.fullScreenChanged.disconnect(menuStateChanged); } function resetToDefaultState() { diff --git a/src/windows/menu-main-window.cpp b/src/windows/menu-main-window.cpp index 4afaa5ef..48efad0a 100644 --- a/src/windows/menu-main-window.cpp +++ b/src/windows/menu-main-window.cpp @@ -608,6 +608,7 @@ void UkuiMenu::MenuWindowXcb::activeMenuWindow(bool active) } setVisible(active); + Q_EMIT windowVisibleChanged(); } void UkuiMenu::MenuWindowXcb::exitFullScreen() -- Gitee