Skip to content

Commit

Permalink
fix: abnormal view of applistview
Browse files Browse the repository at this point in the history
 * Cause highlight move forcely position highlight item at the top,
 We revert to ApplyRange.
 * Every time focus in, we set the currentIndex to 0, and every time
 focus out, we clear currentItem.

Log: fix abnormal view of applistview
  • Loading branch information
asterwyx authored and deepin-bot[bot] committed Jan 10, 2024
1 parent 5c1f505 commit 331c269
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion qml/AppListView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Item {
if (character === transliterated1st) {
// we use the highlight move to scroll to item
listView.highlightMoveDuration = 0
listView.highlightRangeMode = ListView.StrictlyEnforceRange
listView.highlightRangeMode = ListView.ApplyRange
listView.currentIndex = i
postScrollDeferTimer.restart()
break
Expand Down Expand Up @@ -94,8 +94,11 @@ Item {
if (activeFocus) {
// When focus in, we always scroll to the highlight
listView.highlightMoveDuration = 0
listView.currentIndex = 0
listView.highlightRangeMode = ListView.StrictlyEnforceRange
postScrollDeferTimer.restart()
} else {
listView.currentIndex = -1
}
}

Expand Down
3 changes: 3 additions & 0 deletions qml/GridViewContainer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ FocusScope {
onActiveFocusChanged: {
if (activeFocus) {
gridView.highlightMoveDuration = 0
gridView.currentIndex = 0
gridView.highlightRangeMode = GridView.StrictlyEnforceRange
postScrollDeferTimer.restart()
} else {
gridView.currentIndex = -1
}
}
cellHeight: item.cellSize
Expand Down

0 comments on commit 331c269

Please sign in to comment.