mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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:
parent
1cf1fa9cac
commit
6a3e761d8f
3 changed files with 17 additions and 0 deletions
|
@ -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 {
|
||||
|
|
|
@ -48,4 +48,12 @@ Rectangle {
|
|||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: topPart
|
||||
onClicked: {
|
||||
if (stackView.depth == 1 && showingDiveList) {
|
||||
scrollToTop()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,10 @@ MobileComponents.ApplicationWindow {
|
|||
detailsWindow.endEditMode()
|
||||
}
|
||||
|
||||
function scrollToTop() {
|
||||
diveList.scrollToTop()
|
||||
}
|
||||
|
||||
globalDrawer: MobileComponents.GlobalDrawer {
|
||||
title: "Subsurface"
|
||||
titleIcon: "qrc:/qml/subsurface-mobile-icon.png"
|
||||
|
|
Loading…
Reference in a new issue