mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-20 06:45:27 +00:00
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 13c49276d1
(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>
This commit is contained in:
parent
0ceb7e01d8
commit
4923aecc9d
1 changed files with 16 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue