summaryrefslogtreecommitdiffstats
path: root/qt-mobile/main.qml
diff options
context:
space:
mode:
authorGravatar Grace Karanja <gracie.karanja89@gmail.com>2015-06-09 22:20:44 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-20 14:26:56 -0700
commitb7e4b35cde1f1a6be01818eac94732186a1b99ab (patch)
tree4dfa16a09d9e0ec8526d05ce1b4107b8c122d81e /qt-mobile/main.qml
parentbf882416f92fef648f8951a55b4b06dacf56bc3b (diff)
downloadsubsurface-b7e4b35cde1f1a6be01818eac94732186a1b99ab.tar.gz
Add DiveListModel
This model will be used to show the dives in QML. This commit adds the model, and the means to link it to QML. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile/main.qml')
-rw-r--r--qt-mobile/main.qml49
1 files changed, 49 insertions, 0 deletions
diff --git a/qt-mobile/main.qml b/qt-mobile/main.qml
index c6ee4bb09..ab147a2b4 100644
--- a/qt-mobile/main.qml
+++ b/qt-mobile/main.qml
@@ -37,4 +37,53 @@ ApplicationWindow {
}
}
}
+
+ Rectangle {
+ width: parent.width; height: parent.height
+ anchors.fill: parent
+
+ Component {
+ id: diveDelegate
+ Item {
+ id: wrapper
+ width: parent.width; height: 55
+ Column {
+ Text { text: '#:' + diveNumber + "(" + location + ")" }
+ Text { text: date }
+ Text { text: duration + " " + depth }
+ }
+ MouseArea { anchors.fill: parent; onClicked: diveListView.currentIndex = index }
+
+ states: State {
+ name: "Current"
+ when: wrapper.ListView.isCurrentItem
+ PropertyChanges { target: wrapper; x:20 }
+ }
+ transitions: Transition {
+ NumberAnimation { properties: "x"; duration: 200 }
+ }
+ }
+ }
+
+ Component {
+ id: highlightBar
+ Rectangle {
+ width: parent.width; height: 50
+ color: "#FFFF88"
+ y: diveListView.currentItem.y;
+ Behavior on y { SpringAnimation { spring: 2; damping: 0.1 } }
+ }
+ }
+
+ ListView {
+ id: diveListView
+ width: parent.width; height: parent.height
+ anchors.fill: parent
+ model: diveModel
+ delegate: diveDelegate
+ focus: true
+ highlight: highlightBar
+ highlightFollowsCurrentItem: false
+ }
+ }
}