From 25aa80846b84c0b3cd3e0b0256a046e1e92fb1db Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 7 Jan 2016 16:01:24 -0200 Subject: Move Dive class from qthelper.h/cpp to it's own file and rename it to DiveObjectHelper, since it should be an QObject based class to make it easier on the QML, grantlee and widgets side to display the dive's internal data. each Q_PROPERTY defined in the DiveObjectHelper.h file can be acessed directly via it's name. So, if you are on a model that returns a dive, acess it's name by dive.name Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-mobile/qml/DiveList.qml | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) (limited to 'qt-mobile/qml') diff --git a/qt-mobile/qml/DiveList.qml b/qt-mobile/qml/DiveList.qml index 6d8f4924c..1a49db29b 100644 --- a/qt-mobile/qml/DiveList.qml +++ b/qt-mobile/qml/DiveList.qml @@ -14,7 +14,6 @@ MobileComponents.Page { Component { id: diveDelegate MobileComponents.ListItem { - id: dive enabled: true checked: diveListView.currentIndex == model.index width: parent.width @@ -27,22 +26,22 @@ MobileComponents.Page { onClicked: { diveListView.currentIndex = model.index detailsWindow.width = parent.width - detailsWindow.location = location - detailsWindow.gps = gps - detailsWindow.dive_id = id - detailsWindow.diveNumber = diveNumber - detailsWindow.duration = duration - detailsWindow.depth = depth - detailsWindow.rating = rating - detailsWindow.buddy = buddy - detailsWindow.suit = suit - detailsWindow.airtemp = airtemp - detailsWindow.watertemp = watertemp - detailsWindow.divemaster = divemaster - detailsWindow.notes = notes - detailsWindow.number = diveNumber - detailsWindow.date = date - detailsWindow.weight = weight + detailsWindow.location = dive.location + detailsWindow.gps = dive.gps + detailsWindow.dive_id = dive.id + detailsWindow.diveNumber = dive.number + detailsWindow.duration = dive.duration + detailsWindow.depth = dive.depth + detailsWindow.rating = dive.rating + detailsWindow.buddy = dive.buddy + detailsWindow.suit = dive.suit + detailsWindow.airtemp = dive.airTemp + detailsWindow.watertemp = dive.waterTemp + detailsWindow.divemaster = dive.divemaster + detailsWindow.notes = dive.notes + detailsWindow.number = dive.number + detailsWindow.date = dive.date + // detailsWindow.weight = dive.weights stackView.push(detailsWindow) } @@ -52,7 +51,7 @@ MobileComponents.Page { MobileComponents.Label { id: locationText - text: location + text: dive.location font.weight: Font.Light elide: Text.ElideRight maximumLineCount: 1 // needed for elide to work at all @@ -65,7 +64,7 @@ MobileComponents.Page { } MobileComponents.Label { id: dateLabel - text: date + text: dive.date opacity: 0.6 font.pointSize: subsurfaceTheme.smallPointSize anchors { @@ -87,7 +86,7 @@ MobileComponents.Page { font.pointSize: subsurfaceTheme.smallPointSize } MobileComponents.Label { - text: depth + text: dive.depth width: Math.max(MobileComponents.Units.gridUnit * 3, paintedWidth) // helps vertical alignment throughout listview font.pointSize: subsurfaceTheme.smallPointSize } @@ -97,13 +96,13 @@ MobileComponents.Page { font.pointSize: subsurfaceTheme.smallPointSize } MobileComponents.Label { - text: duration + text: dive.duration font.pointSize: subsurfaceTheme.smallPointSize } } MobileComponents.Label { id: numberText - text: "#" + diveNumber + text: "#" + dive.location color: MobileComponents.Theme.textColor font.pointSize: subsurfaceTheme.smallPointSize opacity: 0.6 -- cgit v1.2.3-70-g09d2