mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 04:33:24 +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 textColor: subsurfaceTheme.textColor
|
||||||
property color secondaryTextColor: subsurfaceTheme.secondaryTextColor
|
property color secondaryTextColor: subsurfaceTheme.secondaryTextColor
|
||||||
property int horizontalPadding: Kirigami.Units.gridUnit / 2 - Kirigami.Units.smallSpacing + 1
|
property int horizontalPadding: Kirigami.Units.gridUnit / 2 - Kirigami.Units.smallSpacing + 1
|
||||||
|
property string activeTrip
|
||||||
|
|
||||||
supportsRefreshing: true
|
supportsRefreshing: true
|
||||||
onRefreshingChanged: {
|
onRefreshingChanged: {
|
||||||
|
@ -48,7 +49,8 @@ Kirigami.ScrollablePage {
|
||||||
supportsMouseEvents: true
|
supportsMouseEvents: true
|
||||||
checked: diveListView.currentIndex === model.index
|
checked: diveListView.currentIndex === model.index
|
||||||
width: parent.width
|
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
|
backgroundColor: checked ? subsurfaceTheme.primaryColor : subsurfaceTheme.backgroundColor
|
||||||
activeBackgroundColor: subsurfaceTheme.primaryColor
|
activeBackgroundColor: subsurfaceTheme.primaryColor
|
||||||
textColor: checked ? subsurfaceTheme.primaryTextColor : subsurfaceTheme.textColor
|
textColor: checked ? subsurfaceTheme.primaryTextColor : subsurfaceTheme.textColor
|
||||||
|
@ -186,7 +188,7 @@ Kirigami.ScrollablePage {
|
||||||
id: tripHeading
|
id: tripHeading
|
||||||
Item {
|
Item {
|
||||||
width: page.width
|
width: page.width
|
||||||
height: childrenRect.height - Kirigami.Units.smallSpacing
|
height: childrenRect.height
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: headingBackground
|
id: headingBackground
|
||||||
height: section == "" ? 0 : sectionText.height + Kirigami.Units.gridUnit
|
height: section == "" ? 0 : sectionText.height + Kirigami.Units.gridUnit
|
||||||
|
@ -222,7 +224,12 @@ Kirigami.ScrollablePage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: headingBackground
|
||||||
|
onClicked: {
|
||||||
|
activeTrip = section
|
||||||
|
}
|
||||||
|
}
|
||||||
Controls.Label {
|
Controls.Label {
|
||||||
id: sectionText
|
id: sectionText
|
||||||
text: {
|
text: {
|
||||||
|
@ -250,6 +257,12 @@ Kirigami.ScrollablePage {
|
||||||
}
|
}
|
||||||
color: subsurfaceTheme.lightPrimaryTextColor
|
color: subsurfaceTheme.lightPrimaryTextColor
|
||||||
}
|
}
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: sectionText
|
||||||
|
onClicked: {
|
||||||
|
activeTrip = section
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
height: Math.max(2, Kirigami.Units.gridUnit / 12) // we want a thicker line
|
height: Math.max(2, Kirigami.Units.gridUnit / 12) // we want a thicker line
|
||||||
|
|
Loading…
Add table
Reference in a new issue