diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-01-28 16:01:29 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-01-28 18:20:15 -0800 |
commit | c52769a90fcb26fadfc56b1584a03ddfa76b24dd (patch) | |
tree | 2083f34a21d0c589fcad4021281af6fe095139e0 /qt-mobile/qml | |
parent | 106bb07cff60057145b6eca38928951bd42dd9a7 (diff) | |
download | subsurface-c52769a90fcb26fadfc56b1584a03ddfa76b24dd.tar.gz |
QML UI: use unique names for the different ListViews
Having both the dive list (the vertical list) and the sequence of dive
details (the horizontally swipe-able list) named the same caused me
endless confusion.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile/qml')
-rw-r--r-- | qt-mobile/qml/DiveDetails.qml | 40 | ||||
-rw-r--r-- | qt-mobile/qml/DiveDetailsEdit.qml | 20 |
2 files changed, 30 insertions, 30 deletions
diff --git a/qt-mobile/qml/DiveDetails.qml b/qt-mobile/qml/DiveDetails.qml index 1808bc5c5..8f6bb4830 100644 --- a/qt-mobile/qml/DiveDetails.qml +++ b/qt-mobile/qml/DiveDetails.qml @@ -8,7 +8,7 @@ import org.kde.plasma.mobilecomponents 0.2 as MobileComponents MobileComponents.Page { id: diveDetailsPage - property alias currentIndex: diveListView.currentIndex + property alias currentIndex: diveDetailsListView.currentIndex state: "view" @@ -34,35 +34,35 @@ MobileComponents.Page { // After saving, the list may be shuffled, so first of all make sure that // the listview's currentIndex is the visible item // This makes sure that we always edit the currently visible item - diveListView.currentIndex = diveListView.indexAt(diveListView.contentX+1, 1); - detailsEdit.dive_id = diveListView.currentItem.modelData.dive.id - detailsEdit.number = diveListView.currentItem.modelData.dive.number - detailsEdit.dateText = diveListView.currentItem.modelData.dive.date + " " + diveListView.currentItem.modelData.dive.time - detailsEdit.locationText = diveListView.currentItem.modelData.dive.location - detailsEdit.durationText = diveListView.currentItem.modelData.dive.duration - detailsEdit.depthText = diveListView.currentItem.modelData.dive.depth - detailsEdit.airtempText = diveListView.currentItem.modelData.dive.airTemp - detailsEdit.watertempText = diveListView.currentItem.modelData.dive.waterTemp - detailsEdit.suitText = diveListView.currentItem.modelData.dive.suit - detailsEdit.buddyText = diveListView.currentItem.modelData.dive.buddy - detailsEdit.divemasterText = diveListView.currentItem.modelData.dive.divemaster - detailsEdit.notesText = diveListView.currentItem.modelData.dive.notes + diveDetailsListView.currentIndex = diveDetailsListView.indexAt(diveDetailsListView.contentX+1, 1); + detailsEdit.dive_id = diveDetailsListView.currentItem.modelData.dive.id + detailsEdit.number = diveDetailsListView.currentItem.modelData.dive.number + detailsEdit.dateText = diveDetailsListView.currentItem.modelData.dive.date + " " + diveDetailsListView.currentItem.modelData.dive.time + detailsEdit.locationText = diveDetailsListView.currentItem.modelData.dive.location + detailsEdit.durationText = diveDetailsListView.currentItem.modelData.dive.duration + detailsEdit.depthText = diveDetailsListView.currentItem.modelData.dive.depth + detailsEdit.airtempText = diveDetailsListView.currentItem.modelData.dive.airTemp + detailsEdit.watertempText = diveDetailsListView.currentItem.modelData.dive.waterTemp + detailsEdit.suitText = diveDetailsListView.currentItem.modelData.dive.suit + detailsEdit.buddyText = diveDetailsListView.currentItem.modelData.dive.buddy + detailsEdit.divemasterText = diveDetailsListView.currentItem.modelData.dive.divemaster + detailsEdit.notesText = diveDetailsListView.currentItem.modelData.dive.notes detailsEdit.forcedWidth = diveDetailsPage.width diveDetailsPage.state = "edit" } } function showDiveIndex(index) { - diveListView.currentIndex = index; - diveListView.positionViewAtIndex(diveListView.currentIndex, ListView.Beginning); + diveDetailsListView.currentIndex = index; + diveDetailsListView.positionViewAtIndex(diveDetailsListView.currentIndex, ListView.Beginning); } - onWidthChanged: diveListView.positionViewAtIndex(diveListView.currentIndex, ListView.Beginning); + onWidthChanged: diveDetailsListView.positionViewAtIndex(diveDetailsListView.currentIndex, ListView.Beginning); ScrollView { id: diveDetailList anchors.fill: parent ListView { - id: diveListView + id: diveDetailsListView anchors.fill: parent model: diveModel currentIndex: -1 @@ -77,8 +77,8 @@ MobileComponents.Page { } delegate: ScrollView { id: internalScrollView - width: diveListView.width - height: diveListView.height + width: diveDetailsListView.width + height: diveDetailsListView.height property var modelData: model Flickable { //contentWidth: parent.width diff --git a/qt-mobile/qml/DiveDetailsEdit.qml b/qt-mobile/qml/DiveDetailsEdit.qml index 14366fec4..ed32e5d50 100644 --- a/qt-mobile/qml/DiveDetailsEdit.qml +++ b/qt-mobile/qml/DiveDetailsEdit.qml @@ -159,16 +159,16 @@ Item { detailsEdit.depthText, detailsEdit.airtempText, detailsEdit.watertempText, detailsEdit.suitText, detailsEdit.buddyText, detailsEdit.divemasterText, detailsEdit.notesText) // apply the changes to the dive detail view - diveListView.currentItem.modelData.date = detailsEdit.dateText - diveListView.currentItem.modelData.location = detailsEdit.locationText - diveListView.currentItem.modelData.duration = detailsEdit.durationText - diveListView.currentItem.modelData.depth = detailsEdit.depthText - diveListView.currentItem.modelData.airtemp = detailsEdit.airtempText - diveListView.currentItem.modelData.watertemp = detailsEdit.watertempText - diveListView.currentItem.modelData.suit = detailsEdit.suitText - diveListView.currentItem.modelData.buddy = detailsEdit.buddyText - diveListView.currentItem.modelData.divemaster = detailsEdit.divemasterText - diveListView.currentItem.modelData.notes = detailsEdit.notesText + diveDetailsListView.currentItem.modelData.date = detailsEdit.dateText + diveDetailsListView.currentItem.modelData.location = detailsEdit.locationText + diveDetailsListView.currentItem.modelData.duration = detailsEdit.durationText + diveDetailsListView.currentItem.modelData.depth = detailsEdit.depthText + diveDetailsListView.currentItem.modelData.airtemp = detailsEdit.airtempText + diveDetailsListView.currentItem.modelData.watertemp = detailsEdit.watertempText + diveDetailsListView.currentItem.modelData.suit = detailsEdit.suitText + diveDetailsListView.currentItem.modelData.buddy = detailsEdit.buddyText + diveDetailsListView.currentItem.modelData.divemaster = detailsEdit.divemasterText + diveDetailsListView.currentItem.modelData.notes = detailsEdit.notesText diveDetailsPage.state = "view" } } |