From c34b7857fcc03d2ede0d40063b49a36e1ad7d9dd Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 6 Mar 2020 12:48:47 +0100 Subject: mobile/divelist: implement model that shows all dives in trip-order MobileSwipeModel is probably not an ideal name, but all I could come up with. One of the main complications here is that our list is reversed with respect to the source model. We should change that one day. Probably by moving the sorting down to the core-model. Since looking up the source row is somewhat expensive, the lookup is cached for a single entry because accesses come in bursts for a single dive. This should be a good compromise and avoids keeping track of a full row-to-dive array. Signed-off-by: Berthold Stoeger Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/DiveDetails.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml index 541d1d0c0..86ca5ea63 100644 --- a/mobile-widgets/qml/DiveDetails.qml +++ b/mobile-widgets/qml/DiveDetails.qml @@ -230,7 +230,7 @@ Kirigami.Page { } function showDiveIndex(id) { - currentIndex = diveModel.getIdxForId(id); + currentIndex = swipeModel.getIdxForId(id); diveDetailsListView.positionViewAtIndex(currentIndex, ListView.End); } @@ -307,7 +307,7 @@ Kirigami.Page { ListView { id: diveDetailsListView anchors.fill: parent - model: diveModel + model: swipeModel currentIndex: -1 boundsBehavior: Flickable.StopAtBounds maximumFlickVelocity: parent.width * 5 @@ -335,7 +335,7 @@ Kirigami.Page { } ScrollIndicator.horizontal: ScrollIndicator { } Connections { - target: diveModel + target: swipeModel onCurrentDiveChanged: { currentIndex = index.row diveDetailsListView.positionViewAtIndex(currentIndex, ListView.End) -- cgit v1.2.3-70-g09d2