diff --git a/qml/AppUI/AppPageSearch.qml b/qml/AppUI/AppPageSearch.qml index dfb1067d0696d6b15d58174187a8eef53cd8ecd0..41b814317f0c02f212ecb1dc86fd9e2ec3fe1bc4 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 ad5185ae37964014ef7d30e8ec0455b07090b475..a00c2da81d740d0f5848d58f07b3e8c93fdda35b 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 34edc2535765a449f338f4898cd0d6e2b9bf4714..6312d7a9bbaa6cd43678189c28dc12283eea14d4 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 4afaa5ef5e4347ba4cfe88182ff8f7f60bf451db..48efad0af0082821218cc14432bfca31eeab3224 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()