From 605d08557396d9e1524c3d2aedf0817b4ac32ce1 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 2 Mar 2016 09:02:00 -0800 Subject: QML UI: resolve confusion about dive list model ordering Oops, I forgot to take the sort model on top of the model into account. Now everything should stay consistent - ListView order when accessed from QML, but internal order when accessing the underlying array. Signed-off-by: Dirk Hohndel --- qt-mobile/qml/DiveDetailsEdit.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'qt-mobile/qml/DiveDetailsEdit.qml') diff --git a/qt-mobile/qml/DiveDetailsEdit.qml b/qt-mobile/qml/DiveDetailsEdit.qml index 38dd5dad9..cd8417e8f 100644 --- a/qt-mobile/qml/DiveDetailsEdit.qml +++ b/qt-mobile/qml/DiveDetailsEdit.qml @@ -38,7 +38,8 @@ Item { // apply the changes to the dive detail view - since the edit could have changed the order // first make sure that we are looking at the correct dive - our model allows us to look // up the index based on the unique dive_id - diveDetailsListView.currentIndex = diveModel.getIdxForId(dive_id) + var newIdx = diveModel.getIdxForId(dive_id) + diveDetailsListView.currentIndex = newIdx diveDetailsListView.currentItem.modelData.date = detailsEdit.dateText diveDetailsListView.currentItem.modelData.location = detailsEdit.locationText diveDetailsListView.currentItem.modelData.duration = detailsEdit.durationText @@ -52,7 +53,7 @@ Item { diveDetailsPage.state = "view" Qt.inputMethod.hide() // now make sure we directly show the saved dive (this may be a new dive, or it may have moved) - showDiveIndex(manager.getIndex(dive_id)) + showDiveIndex(newIdx) } height: editArea.height -- cgit v1.2.3-70-g09d2