mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
homescreens/halcyon: implement keyboard arrow navigation
This commit is contained in:
parent
8c31f51ee6
commit
a414563c02
4 changed files with 58 additions and 8 deletions
|
|
@ -75,6 +75,7 @@ MobileShell.GridView {
|
|||
contentItem: Clock {}
|
||||
}
|
||||
|
||||
Keys.onReturnPressed: currentItem.appDelegate.launch()
|
||||
model: DelegateModel {
|
||||
id: visualModel
|
||||
model: Halcyon.PinnedModel
|
||||
|
|
@ -82,6 +83,7 @@ MobileShell.GridView {
|
|||
delegate: Item {
|
||||
id: delegateRoot
|
||||
property int visualIndex: DelegateModel.itemsIndex
|
||||
property alias appDelegate: appDelegate
|
||||
|
||||
width: root.cellWidth
|
||||
height: root.cellHeight
|
||||
|
|
|
|||
|
|
@ -18,6 +18,12 @@ Item {
|
|||
id: root
|
||||
layer.enabled: true
|
||||
|
||||
onFocusChanged: {
|
||||
if (focus) {
|
||||
favoritesGrid.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
|
||||
required property bool interactive
|
||||
required property var searchWidget
|
||||
|
||||
|
|
@ -49,6 +55,10 @@ Item {
|
|||
openFolderAnim.restart()
|
||||
}
|
||||
|
||||
function resetHighlight() {
|
||||
favoritesGrid.currentIndex = -1;
|
||||
}
|
||||
|
||||
FavoritesGrid {
|
||||
id: favoritesGrid
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,16 @@ MobileShell.GridView {
|
|||
cacheBuffer: cellHeight * 20 // 10 rows above and below
|
||||
reuseItems: true
|
||||
|
||||
Controls.ScrollBar.vertical: Controls.ScrollBar {
|
||||
policy: Controls.ScrollBar.AlwaysOn
|
||||
}
|
||||
|
||||
onFocusChanged: {
|
||||
if (focus) {
|
||||
forceActiveFocus();
|
||||
}
|
||||
}
|
||||
|
||||
// ensure items aren't visible out of bounds
|
||||
layer.enabled: true
|
||||
|
||||
|
|
@ -69,6 +79,7 @@ MobileShell.GridView {
|
|||
font.weight: Font.Bold
|
||||
}
|
||||
|
||||
Keys.onReturnPressed: currentItem.launchApp()
|
||||
delegate: GridAppDelegate {
|
||||
id: delegate
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ Item {
|
|||
|
||||
function triggerHomescreen() {
|
||||
swipeView.setCurrentIndex(0);
|
||||
swipeView.focusChild();
|
||||
favoritesView.closeFolder();
|
||||
favoritesView.goToBeginning();
|
||||
gridAppList.goToBeginning();
|
||||
|
|
@ -42,6 +43,16 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: MobileShellState.HomeScreenControls
|
||||
|
||||
function onHomeScreenVisibleChanged(){
|
||||
if (MobileShellState.HomeScreenControls.homeScreenVisible) {
|
||||
swipeView.focusChild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QQC2.SwipeView {
|
||||
id: swipeView
|
||||
opacity: 1 - searchWidget.openFactor
|
||||
|
|
@ -53,12 +64,27 @@ Item {
|
|||
anchors.leftMargin: root.leftMargin
|
||||
anchors.rightMargin: root.rightMargin
|
||||
|
||||
function focusChild() {
|
||||
currentItem.childFocus = true;
|
||||
}
|
||||
|
||||
onCurrentIndexChanged: focusChild()
|
||||
|
||||
Item {
|
||||
height: swipeView.height
|
||||
width: swipeView.width
|
||||
|
||||
|
||||
property alias childFocus: favoritesView.focus
|
||||
|
||||
// open wallpaper menu when held on click
|
||||
TapHandler {
|
||||
onPressedChanged: {
|
||||
if (pressed) {
|
||||
favoritesView.resetHighlight();
|
||||
}
|
||||
}
|
||||
|
||||
onLongPressed: root.openConfigure()
|
||||
}
|
||||
|
||||
|
|
@ -71,16 +97,17 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
QQC2.ScrollView {
|
||||
Item {
|
||||
width: swipeView.width
|
||||
height: swipeView.height
|
||||
|
||||
// disable horizontal scrollbar
|
||||
QQC2.ScrollBar.horizontal: QQC2.ScrollBar { policy: QQC2.ScrollBar.AlwaysOff }
|
||||
property alias childFocus: gridAppList.focus
|
||||
|
||||
GridAppList {
|
||||
id: gridAppList
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
property int horizontalMargin: Math.round(swipeView.width * 0.05)
|
||||
interactive: root.interactive
|
||||
leftMargin: horizontalMargin
|
||||
|
|
|
|||
Loading…
Reference in a new issue