mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Using keybind from settings
This commit is contained in:
@@ -241,67 +241,40 @@ RowLayout {
|
||||
onTextChanged: root.searchText = text
|
||||
fontSize: Style.fontSizeS
|
||||
|
||||
Keys.onUpPressed: {
|
||||
if (listView.currentIndex > 0) {
|
||||
listView.currentIndex--;
|
||||
listView.positionViewAtIndex(listView.currentIndex, ListView.Contain);
|
||||
|
||||
if (root.selectOnNavigation) {
|
||||
selectHighlighted()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Keys.onDownPressed: {
|
||||
if (listView.currentIndex < listView.count - 1) {
|
||||
listView.currentIndex++;
|
||||
listView.positionViewAtIndex(listView.currentIndex, ListView.Contain);
|
||||
|
||||
if (root.selectOnNavigation) {
|
||||
selectHighlighted()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Keys.onReturnPressed: {
|
||||
selectHighlighted()
|
||||
combo.popup.close();
|
||||
}
|
||||
Keys.onEnterPressed: {
|
||||
selectHighlighted()
|
||||
combo.popup.close();
|
||||
}
|
||||
|
||||
Keys.onEscapePressed: combo.popup.close()
|
||||
|
||||
Keys.onPressed: (event) => {
|
||||
switch (event.key) {
|
||||
case Qt.Key_Home:
|
||||
listView.currentIndex = 0;
|
||||
listView.positionViewAtIndex(0, ListView.Beginning);
|
||||
event.accepted = true;
|
||||
break;
|
||||
case Qt.Key_End:
|
||||
listView.currentIndex = listView.count - 1;
|
||||
listView.positionViewAtIndex(listView.count - 1, ListView.End);
|
||||
event.accepted = true;
|
||||
break;
|
||||
case Qt.Key_PageUp:
|
||||
listView.currentIndex = Math.max(0, listView.currentIndex - pageStep());
|
||||
listView.positionViewAtIndex(listView.currentIndex, ListView.Contain);
|
||||
event.accepted = true;
|
||||
break;
|
||||
case Qt.Key_PageDown:
|
||||
listView.currentIndex = Math.min(listView.count - 1, listView.currentIndex + pageStep());
|
||||
listView.positionViewAtIndex(listView.currentIndex, ListView.Contain);
|
||||
event.accepted = true;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
if (Keybinds.checkKey(event, 'enter', Settings)) {
|
||||
selectHighlighted()
|
||||
combo.popup.close();
|
||||
event.accepted = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (root.selectOnNavigation) {
|
||||
selectHighlighted()
|
||||
if (Keybinds.checkKey(event, 'escape', Settings)) {
|
||||
combo.popup.close()
|
||||
event.accepted = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Keybinds.checkKey(event, 'up', Settings)) {
|
||||
if (listView.currentIndex > 0) {
|
||||
listView.currentIndex--;
|
||||
listView.positionViewAtIndex(listView.currentIndex, ListView.Contain);
|
||||
if (root.selectOnNavigation)
|
||||
selectHighlighted();
|
||||
}
|
||||
event.accepted = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Keybinds.checkKey(event, 'down', Settings)) {
|
||||
if (listView.currentIndex < listView.count - 1) {
|
||||
listView.currentIndex++;
|
||||
listView.positionViewAtIndex(listView.currentIndex, ListView.Contain);
|
||||
if (root.selectOnNavigation)
|
||||
selectHighlighted();
|
||||
}
|
||||
event.accepted = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user