diff options
Diffstat (limited to 'mobile-widgets/qml/DiveList.qml')
-rw-r--r-- | mobile-widgets/qml/DiveList.qml | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml index b724bdf3c..dbadda062 100644 --- a/mobile-widgets/qml/DiveList.qml +++ b/mobile-widgets/qml/DiveList.qml @@ -364,4 +364,16 @@ Kirigami.ScrollablePage { event.accepted = true } } + + function setCurrentDiveListIndex(idx, noScroll) { + diveListView.currentIndex = idx + // updating the index of the ListView triggers a non-linear scroll + // animation that can be very slow. the fix is to stop this animation + // by setting contentY to itself and then using positionViewAtIndex(). + // the downside is that the view jumps to the index immediately. + if (noScroll) { + diveListView.contentY = diveListView.contentY + diveListView.positionViewAtIndex(idx, ListView.Center) + } + } } |