homescreens/Halcyon: trigger children using signals instead of focus property

This commit is contained in:
Yari Polla 2023-03-13 11:44:56 +01:00
parent 4fc8582da5
commit c3882691bc
3 changed files with 16 additions and 15 deletions

View file

@ -18,12 +18,6 @@ Item {
id: root id: root
layer.enabled: true layer.enabled: true
onFocusChanged: {
if (focus) {
favoritesGrid.forceActiveFocus();
}
}
required property bool interactive required property bool interactive
required property var searchWidget required property var searchWidget
@ -41,6 +35,14 @@ Item {
signal openConfigureRequested() signal openConfigureRequested()
Connections {
target: parent
function onFocusRequested() {
favoritesGrid.forceActiveFocus();
}
}
function goToBeginning() { function goToBeginning() {
goToBeginningAnim.restart(); goToBeginningAnim.restart();
} }

View file

@ -22,12 +22,12 @@ MobileShell.GridView {
cacheBuffer: cellHeight * 20 // 10 rows above and below cacheBuffer: cellHeight * 20 // 10 rows above and below
reuseItems: true reuseItems: true
Controls.ScrollBar.vertical: Controls.ScrollBar { Controls.ScrollBar.vertical: Controls.ScrollBar {}
policy: Controls.ScrollBar.AlwaysOn
}
onFocusChanged: { Connections {
if (focus) { target: parent
function onFocusRequested() {
forceActiveFocus(); forceActiveFocus();
} }
} }

View file

@ -65,7 +65,7 @@ Item {
anchors.rightMargin: root.rightMargin anchors.rightMargin: root.rightMargin
function focusChild() { function focusChild() {
currentItem.childFocus = true; currentItem.focusRequested();
} }
onCurrentIndexChanged: focusChild() onCurrentIndexChanged: focusChild()
@ -74,8 +74,7 @@ Item {
height: swipeView.height height: swipeView.height
width: swipeView.width width: swipeView.width
signal focusRequested()
property alias childFocus: favoritesView.focus
// open wallpaper menu when held on click // open wallpaper menu when held on click
TapHandler { TapHandler {
@ -101,7 +100,7 @@ Item {
width: swipeView.width width: swipeView.width
height: swipeView.height height: swipeView.height
property alias childFocus: gridAppList.focus signal focusRequested()
GridAppList { GridAppList {
id: gridAppList id: gridAppList