2022-12-23 11:32:21 +08:00
|
|
|
|
import QtQuick 2.12
|
|
|
|
|
import QtQuick.Controls 2.0 as QQC2
|
2023-02-09 16:07:51 +08:00
|
|
|
|
import AppControls2 1.0 as AppControls2
|
|
|
|
|
import org.ukui.menu.core 1.0
|
2022-12-23 11:32:21 +08:00
|
|
|
|
|
2023-04-26 17:04:22 +08:00
|
|
|
|
FocusScope {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
function focusToFalse() {
|
|
|
|
|
focus = false;
|
|
|
|
|
}
|
|
|
|
|
function keyPressed(event) {
|
|
|
|
|
// 任意字符键焦点切换到搜索(0-9 a-z)
|
|
|
|
|
if ((0x2f < event.key && event.key < 0x3a )||(0x40 < event.key && event.key < 0x5b)) {
|
|
|
|
|
focus = true;
|
|
|
|
|
appPage.header.changeToSearch();
|
|
|
|
|
// 任意方向键切换至搜索结果
|
|
|
|
|
} else if ( 0x01000011 < event.key && event.key < 0x01000016) {
|
|
|
|
|
focus = true;
|
|
|
|
|
appPage.content.resetFocus();
|
|
|
|
|
appPage.content.focus = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component.onCompleted: mainWindow.visibleChanged.connect(focusToFalse)
|
|
|
|
|
Component.onDestruction: mainWindow.visibleChanged.disconnect(focusToFalse)
|
2022-12-23 11:32:21 +08:00
|
|
|
|
Row {
|
|
|
|
|
anchors.fill: parent;
|
|
|
|
|
AppPage {
|
2023-04-26 17:04:22 +08:00
|
|
|
|
id: appPage
|
2022-12-23 11:32:21 +08:00
|
|
|
|
width: 300
|
|
|
|
|
height: parent.height;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Sidebar {
|
2023-01-03 11:00:52 +08:00
|
|
|
|
width: parent.width - 300;
|
2022-12-26 15:21:43 +08:00
|
|
|
|
height: parent.height;
|
|
|
|
|
}
|
2022-12-23 11:32:21 +08:00
|
|
|
|
}
|
|
|
|
|
}
|