summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qml/DiveList.qml
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2018-04-14 17:37:44 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-04-14 17:39:40 -0700
commit4923aecc9d35a2419512520d6c38f12ce71733e6 (patch)
tree4e76171b56c084518f6915a0c9a86154542b1d4c /mobile-widgets/qml/DiveList.qml
parent0ceb7e01d89544e1f3e4e5fbff6581684111da12 (diff)
downloadsubsurface-4923aecc9d35a2419512520d6c38f12ce71733e6.tar.gz
QML UI: bring back folding trips
In older versions of Kirigami this caused all kinds of problems so we eventually gave up on it in commit 13c49276d1d4 (Revert "QML UI: make dive list fold dive trips"). Now this seems to work much better, so let's bring back trip folding! Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qml/DiveList.qml')
-rw-r--r--mobile-widgets/qml/DiveList.qml19
1 files changed, 16 insertions, 3 deletions
diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml
index dbadda062..5ba0d0ea1 100644
--- a/mobile-widgets/qml/DiveList.qml
+++ b/mobile-widgets/qml/DiveList.qml
@@ -20,6 +20,7 @@ Kirigami.ScrollablePage {
property color textColor: subsurfaceTheme.textColor
property color secondaryTextColor: subsurfaceTheme.secondaryTextColor
property int horizontalPadding: Kirigami.Units.gridUnit / 2 - Kirigami.Units.smallSpacing + 1
+ property string activeTrip
supportsRefreshing: true
onRefreshingChanged: {
@@ -48,7 +49,8 @@ Kirigami.ScrollablePage {
supportsMouseEvents: true
checked: diveListView.currentIndex === model.index
width: parent.width
- height: diveListEntry.height + Kirigami.Units.smallSpacing
+ height: dive.tripMeta === activeTrip ? diveListEntry.height + Kirigami.Units.smallSpacing : 0
+ visible: dive.tripMeta === activeTrip
backgroundColor: checked ? subsurfaceTheme.primaryColor : subsurfaceTheme.backgroundColor
activeBackgroundColor: subsurfaceTheme.primaryColor
textColor: checked ? subsurfaceTheme.primaryTextColor : subsurfaceTheme.textColor
@@ -186,7 +188,7 @@ Kirigami.ScrollablePage {
id: tripHeading
Item {
width: page.width
- height: childrenRect.height - Kirigami.Units.smallSpacing
+ height: childrenRect.height
Rectangle {
id: headingBackground
height: section == "" ? 0 : sectionText.height + Kirigami.Units.gridUnit
@@ -222,7 +224,12 @@ Kirigami.ScrollablePage {
}
}
}
-
+ MouseArea {
+ anchors.fill: headingBackground
+ onClicked: {
+ activeTrip = section
+ }
+ }
Controls.Label {
id: sectionText
text: {
@@ -250,6 +257,12 @@ Kirigami.ScrollablePage {
}
color: subsurfaceTheme.lightPrimaryTextColor
}
+ MouseArea {
+ anchors.fill: sectionText
+ onClicked: {
+ activeTrip = section
+ }
+ }
}
Rectangle {
height: Math.max(2, Kirigami.Units.gridUnit / 12) // we want a thicker line