mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +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 credentialStatus: manager.credentialStatus
|
||||||
property int numDives: diveListView.count
|
property int numDives: diveListView.count
|
||||||
property color textColor: subsurfaceTheme.diveListTextColor
|
property color textColor: subsurfaceTheme.diveListTextColor
|
||||||
|
|
||||||
|
function scrollToTop() {
|
||||||
|
diveListView.positionViewAtBeginning()
|
||||||
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: diveDelegate
|
id: diveDelegate
|
||||||
MobileComponents.ListItem {
|
MobileComponents.ListItem {
|
||||||
|
|
|
@ -48,4 +48,12 @@ Rectangle {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: topPart
|
||||||
|
onClicked: {
|
||||||
|
if (stackView.depth == 1 && showingDiveList) {
|
||||||
|
scrollToTop()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,10 @@ MobileComponents.ApplicationWindow {
|
||||||
detailsWindow.endEditMode()
|
detailsWindow.endEditMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function scrollToTop() {
|
||||||
|
diveList.scrollToTop()
|
||||||
|
}
|
||||||
|
|
||||||
globalDrawer: MobileComponents.GlobalDrawer {
|
globalDrawer: MobileComponents.GlobalDrawer {
|
||||||
title: "Subsurface"
|
title: "Subsurface"
|
||||||
titleIcon: "qrc:/qml/subsurface-mobile-icon.png"
|
titleIcon: "qrc:/qml/subsurface-mobile-icon.png"
|
||||||
|
|
Loading…
Add table
Reference in a new issue