2022-12-23 11:32:21 +08:00
|
|
|
|
import QtQuick 2.12
|
2024-01-09 10:08:53 +08:00
|
|
|
|
import QtQuick.Layouts 1.12
|
2023-02-09 16:07:51 +08:00
|
|
|
|
import org.ukui.menu.core 1.0
|
2024-01-04 11:13:41 +08:00
|
|
|
|
import org.ukui.quick.platform 1.0 as Platform
|
2023-11-28 16:58:37 +08:00
|
|
|
|
import org.ukui.quick.items 1.0 as UkuiItems
|
|
|
|
|
|
2023-04-26 17:04:22 +08:00
|
|
|
|
FocusScope {
|
2023-05-15 17:28:48 +08:00
|
|
|
|
id: normalUI
|
2024-01-09 10:08:53 +08:00
|
|
|
|
|
2024-02-23 18:19:22 +08:00
|
|
|
|
Component.onCompleted: {
|
|
|
|
|
forceFocus();
|
|
|
|
|
mainWindow.visibleChanged.connect(forceFocus);
|
|
|
|
|
}
|
|
|
|
|
Component.onDestruction: {
|
|
|
|
|
mainWindow.visibleChanged.disconnect(forceFocus);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function forceFocus() {
|
|
|
|
|
normalUI.focus = true;
|
2024-07-01 10:59:40 +08:00
|
|
|
|
if (mainWindow.visible) {
|
|
|
|
|
appPage.search.changeToSearch("");
|
|
|
|
|
}
|
2023-04-26 17:04:22 +08:00
|
|
|
|
}
|
|
|
|
|
function keyPressed(event) {
|
|
|
|
|
// 任意字符键焦点切换到搜索(0-9 a-z)
|
2023-05-23 11:54:17 +08:00
|
|
|
|
if ((0x2f < event.key && event.key < 0x3a)||(0x40 < event.key && event.key < 0x5b)) {
|
2023-04-26 17:04:22 +08:00
|
|
|
|
focus = true;
|
2023-11-29 16:13:50 +08:00
|
|
|
|
appPage.search.changeToSearch(event.text);
|
2023-05-24 13:46:29 +08:00
|
|
|
|
// 任意方向键切换至应用列表
|
2023-05-23 11:54:17 +08:00
|
|
|
|
} else if ((0x01000011 < event.key)&&(event.key < 0x01000016)) {
|
2023-04-26 17:04:22 +08:00
|
|
|
|
focus = true;
|
|
|
|
|
appPage.content.focus = true;
|
2023-05-23 11:54:17 +08:00
|
|
|
|
appPage.content.resetFocus();
|
2023-04-26 17:04:22 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-09 10:08:53 +08:00
|
|
|
|
RowLayout {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
spacing: 0
|
|
|
|
|
z: 10
|
|
|
|
|
|
2022-12-23 11:32:21 +08:00
|
|
|
|
AppPage {
|
2023-04-26 17:04:22 +08:00
|
|
|
|
id: appPage
|
2024-01-09 10:08:53 +08:00
|
|
|
|
Layout.preferredWidth: 312
|
|
|
|
|
Layout.fillHeight: true
|
2023-11-28 16:58:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UkuiItems.StyleBackground {
|
2024-01-09 10:08:53 +08:00
|
|
|
|
Layout.preferredWidth: 1
|
|
|
|
|
Layout.fillHeight: true
|
2023-11-28 16:58:37 +08:00
|
|
|
|
|
2024-01-04 11:13:41 +08:00
|
|
|
|
paletteRole: Platform.Theme.ButtonText
|
2023-11-28 16:58:37 +08:00
|
|
|
|
useStyleTransparency: false
|
|
|
|
|
alpha: 0.05
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WidgetPage {
|
2024-01-09 10:08:53 +08:00
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
2022-12-23 11:32:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-11-28 16:58:37 +08:00
|
|
|
|
UkuiItems.StyleBackground {
|
2024-01-09 10:08:53 +08:00
|
|
|
|
Layout.preferredWidth: 1
|
|
|
|
|
Layout.fillHeight: true
|
2023-11-28 16:58:37 +08:00
|
|
|
|
|
2024-01-04 11:13:41 +08:00
|
|
|
|
paletteRole: Platform.Theme.ButtonText
|
2023-11-28 16:58:37 +08:00
|
|
|
|
useStyleTransparency: false
|
|
|
|
|
alpha: 0.05
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-23 11:32:21 +08:00
|
|
|
|
Sidebar {
|
2024-01-09 10:08:53 +08:00
|
|
|
|
Layout.preferredWidth: 60
|
|
|
|
|
Layout.fillHeight: true
|
2022-12-26 15:21:43 +08:00
|
|
|
|
}
|
2022-12-23 11:32:21 +08:00
|
|
|
|
}
|
|
|
|
|
}
|