QML UI: scroll to top of dive list when tapping title bar

This helps you get to the latest dive when you are stuck at the bottom
of a dive list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-03-30 20:39:25 -05:00
parent 1cf1fa9cac
commit 6a3e761d8f
3 changed files with 17 additions and 0 deletions

View file

@ -14,6 +14,11 @@ MobileComponents.Page {
property int credentialStatus: manager.credentialStatus
property int numDives: diveListView.count
property color textColor: subsurfaceTheme.diveListTextColor
function scrollToTop() {
diveListView.positionViewAtBeginning()
}
Component {
id: diveDelegate
MobileComponents.ListItem {

View file

@ -48,4 +48,12 @@ Rectangle {
Layout.fillWidth: true
}
}
MouseArea {
anchors.fill: topPart
onClicked: {
if (stackView.depth == 1 && showingDiveList) {
scrollToTop()
}
}
}
}

View file

@ -38,6 +38,10 @@ MobileComponents.ApplicationWindow {
detailsWindow.endEditMode()
}
function scrollToTop() {
diveList.scrollToTop()
}
globalDrawer: MobileComponents.GlobalDrawer {
title: "Subsurface"
titleIcon: "qrc:/qml/subsurface-mobile-icon.png"