diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2016-01-07 16:01:24 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-01-08 08:04:44 -0800 |
commit | 25aa80846b84c0b3cd3e0b0256a046e1e92fb1db (patch) | |
tree | c9934f39f2e039e5877af7ee0d3b0d96c5a1debf /qt-mobile/qml | |
parent | c022f5c4f71f3e7670ed458d714d96fd6e88c55b (diff) | |
download | subsurface-25aa80846b.tar.gz |
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 <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile/qml')
-rw-r--r-- | qt-mobile/qml/DiveList.qml | 43 |
1 files changed, 21 insertions, 22 deletions
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 |