From 4923aecc9d35a2419512520d6c38f12ce71733e6 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 14 Apr 2018 17:37:44 -0700 Subject: 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 --- mobile-widgets/qml/DiveList.qml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'mobile-widgets/qml/DiveList.qml') 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 -- cgit v1.2.3-70-g09d2