mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
QML UI: make dive list fold dive trips
This makes it MUCH easier to deal with a lot of dives. Instead of needing a more complicated model we simply use the meta data that allows us to create the dive trip sections to hide (make invisible + height 0) all dives that aren't in the selected trip. I'll admit that this was much easier than I expected it to be. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1b0c3d8df5
commit
83c72e7a79
1 changed files with 10 additions and 0 deletions
|
@ -14,12 +14,15 @@ 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
|
||||||
|
property string activeTrip
|
||||||
Component {
|
Component {
|
||||||
id: diveDelegate
|
id: diveDelegate
|
||||||
MobileComponents.ListItem {
|
MobileComponents.ListItem {
|
||||||
enabled: true
|
enabled: true
|
||||||
checked: diveListView.currentIndex === model.index
|
checked: diveListView.currentIndex === model.index
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
height: dive.tripMeta == activeTrip ? diveDelegateItem.height : 0
|
||||||
|
visible: dive.tripMeta == activeTrip ? true : false
|
||||||
|
|
||||||
property real detailsOpacity : 0
|
property real detailsOpacity : 0
|
||||||
property int horizontalPadding: MobileComponents.Units.gridUnit / 2 - MobileComponents.Units.smallSpacing + 1
|
property int horizontalPadding: MobileComponents.Units.gridUnit / 2 - MobileComponents.Units.smallSpacing + 1
|
||||||
|
@ -34,6 +37,7 @@ MobileComponents.Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
id: diveDelegateItem
|
||||||
width: parent.width - MobileComponents.Units.gridUnit
|
width: parent.width - MobileComponents.Units.gridUnit
|
||||||
height: childrenRect.height - MobileComponents.Units.smallSpacing
|
height: childrenRect.height - MobileComponents.Units.smallSpacing
|
||||||
|
|
||||||
|
@ -135,6 +139,12 @@ MobileComponents.Page {
|
||||||
}
|
}
|
||||||
color: textColor
|
color: textColor
|
||||||
level: 2
|
level: 2
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: sectionText
|
||||||
|
onClicked: {
|
||||||
|
activeTrip = section
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
height: Math.max(2, MobileComponents.Units.gridUnit / 12) // we want a thicker line
|
height: Math.max(2, MobileComponents.Units.gridUnit / 12) // we want a thicker line
|
||||||
|
|
Loading…
Add table
Reference in a new issue