diff --git a/qml/AppListView.qml b/qml/AppListView.qml index 8df13a63..44d77d87 100644 --- a/qml/AppListView.qml +++ b/qml/AppListView.qml @@ -24,7 +24,7 @@ Item { // the scroll might stopped before the highlight item scroll to the expected place. // Thus we use a timer to set back these values with a delay. listView.highlightMoveDuration = 150 - listView.highlightRangeMode = GridView.NoHighlightRange + listView.highlightRangeMode = ListView.NoHighlightRange } } @@ -34,7 +34,7 @@ Item { if (character === transliterated1st) { // we use the highlight move to scroll to item listView.highlightMoveDuration = 0 - listView.highlightRangeMode = GridView.ApplyRange + listView.highlightRangeMode = ListView.StrictlyEnforceRange listView.currentIndex = i postScrollDeferTimer.restart() break @@ -86,6 +86,14 @@ Item { // displayMarginBeginning: -45 clip: true focus: true + onActiveFocusChanged: { + if (activeFocus) { + // When focus in, we always scroll to the highlight + listView.highlightMoveDuration = 0 + listView.highlightRangeMode = ListView.StrictlyEnforceRange + postScrollDeferTimer.restart() + } + } section.property: CategorizedSortProxyModel.sortRoleName // "transliterated" // "category" section.criteria: section.property === "transliterated" ? ViewSection.FirstCharacter : ViewSection.FullString diff --git a/qml/GridViewContainer.qml b/qml/GridViewContainer.qml index 2cf802d3..55ddb6d4 100644 --- a/qml/GridViewContainer.qml +++ b/qml/GridViewContainer.qml @@ -52,16 +52,31 @@ FocusScope { height: rows == 0 ? parent.height : (item.cellSize * root.rows) color: "transparent" + Timer { + id: postScrollDeferTimer + interval: 150 + onTriggered: { + gridView.highlightMoveDuration = 150 + gridView.highlightRangeMode = GridView.NoHighlightRange + } + } + GridView { id: gridView anchors.fill: parent clip: true highlightFollowsCurrentItem: true keyNavigationEnabled: true - highlightMoveDuration: 0 + highlightMoveDuration: 150 activeFocusOnTab: focus ? root.activeGridViewFocusOnTab : false focus: count > 0 - + onActiveFocusChanged: { + if (activeFocus) { + gridView.highlightMoveDuration = 0 + gridView.highlightRangeMode = GridView.StrictlyEnforceRange + postScrollDeferTimer.restart() + } + } cellHeight: item.cellSize cellWidth: item.cellSize