diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-03-06 12:48:47 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-03-10 09:25:57 -0700 |
commit | c34b7857fcc03d2ede0d40063b49a36e1ad7d9dd (patch) | |
tree | 4c6b30a3ecf8de4ff098ed5a9080645be29d814d /mobile-widgets/qml/DiveDetails.qml | |
parent | 71b378aa82296c76c504c8f6b7f765601c7ae821 (diff) | |
download | subsurface-c34b7857fcc03d2ede0d40063b49a36e1ad7d9dd.tar.gz |
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 <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qml/DiveDetails.qml')
-rw-r--r-- | mobile-widgets/qml/DiveDetails.qml | 6 |
1 files changed, 3 insertions, 3 deletions
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) |