fix(qml): 添加全屏界面按下数字或字母跳转到搜索

This commit is contained in:
youdiansaodongxi 2024-07-09 16:36:17 +08:00
parent a560651197
commit a16415125b
4 changed files with 15 additions and 1 deletions

View File

@ -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) {

View File

@ -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

View File

@ -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;
}
}

View File

@ -175,6 +175,10 @@ Item {
active = mainWindow.isFullScreen ? true : false;
opacity = mainWindow.isFullScreen ? 1 : 0;
}
Keys.onPressed: {
item.keyPressed(event);
}
}
Component {