From 6be045f9b47056d5fc6dab9d0d0e9be56759f2f2 Mon Sep 17 00:00:00 2001 From: youdiansaodongxi Date: Tue, 9 Jul 2024 16:36:17 +0800 Subject: [PATCH] =?UTF-8?q?fix(qml):=20=E6=B7=BB=E5=8A=A0=E5=85=A8?= =?UTF-8?q?=E5=B1=8F=E7=95=8C=E9=9D=A2=E6=8C=89=E4=B8=8B=E6=95=B0=E5=AD=97?= =?UTF-8?q?=E6=88=96=E5=AD=97=E6=AF=8D=E8=B7=B3=E8=BD=AC=E5=88=B0=E6=90=9C?= =?UTF-8?q?=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qml/AppUI/FullScreenAppList.qml | 2 +- qml/AppUI/FullScreenUI.qml | 8 ++++++++ qml/AppUI/Sidebar.qml | 2 ++ qml/main.qml | 4 ++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/qml/AppUI/FullScreenAppList.qml b/qml/AppUI/FullScreenAppList.qml index 33d89cb..a3d8937 100644 --- a/qml/AppUI/FullScreenAppList.qml +++ b/qml/AppUI/FullScreenAppList.qml @@ -96,7 +96,7 @@ ListView { text.text: model.name icon.source: model.icon - isRecentInstalled: model.recentInstall + isRecentInstalled: model.recentInstall === undefined ? false : model.recentInstall onClicked: (event) => { if (event.button === Qt.LeftButton) { diff --git a/qml/AppUI/FullScreenUI.qml b/qml/AppUI/FullScreenUI.qml index c1cf4c9..cf2b8c5 100644 --- a/qml/AppUI/FullScreenUI.qml +++ b/qml/AppUI/FullScreenUI.qml @@ -27,6 +27,14 @@ FocusScope { } } + function keyPressed(event) { + if ((0x2f < event.key && event.key < 0x3a)||(0x40 < event.key && event.key < 0x5b)) { + focus = true; + searchInputBar.text = event.text; + searchInputBar.textInputFocus(); + } + } + Item { anchors.fill: parent diff --git a/qml/AppUI/Sidebar.qml b/qml/AppUI/Sidebar.qml index 2a5aacb..a8aa0b3 100644 --- a/qml/AppUI/Sidebar.qml +++ b/qml/AppUI/Sidebar.qml @@ -63,8 +63,10 @@ Item { Keys.onPressed: { if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) { if (mainWindow.isFullScreen) { + root.currentSearchText = searchInputBar.text; mainWindow.exitFullScreen(); } else { + root.currentSearchText = appPage.search.searchInputBar.text; mainWindow.isFullScreen = true; } } diff --git a/qml/main.qml b/qml/main.qml index dfc063e..c6a599c 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -175,6 +175,10 @@ Item { active = mainWindow.isFullScreen ? true : false; opacity = mainWindow.isFullScreen ? 1 : 0; } + + Keys.onPressed: { + item.keyPressed(event); + } } Component {