mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
QML UI: make the code easier to read
And maybe this will make it faster as well? Depends on how the binding is implemented, I guess. But at least it's less confusing to read now. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f8742a48b2
commit
2529529ff9
1 changed files with 6 additions and 4 deletions
|
@ -43,6 +43,8 @@ Kirigami.ScrollablePage {
|
|||
Component {
|
||||
id: diveDelegate
|
||||
Kirigami.AbstractListItem {
|
||||
// this looks weird, but it's how we can tell that this dive isn't in a trip
|
||||
property bool diveOutsideTrip: dive.tripNrDives === 0
|
||||
leftPadding: 0
|
||||
topPadding: 0
|
||||
id: innerListItem
|
||||
|
@ -50,8 +52,8 @@ Kirigami.ScrollablePage {
|
|||
supportsMouseEvents: true
|
||||
checked: diveListView.currentIndex === model.index
|
||||
width: parent.width
|
||||
height: dive.tripNrDives == 0 ? diveListEntry.height + Kirigami.Units.smallSpacing : 0
|
||||
visible: dive.tripNrDives == 0
|
||||
height: diveOutsideTrip ? diveListEntry.height + Kirigami.Units.smallSpacing : 0
|
||||
visible: diveOutsideTrip
|
||||
backgroundColor: checked ? subsurfaceTheme.primaryColor : subsurfaceTheme.backgroundColor
|
||||
activeBackgroundColor: subsurfaceTheme.primaryColor
|
||||
textColor: checked ? subsurfaceTheme.primaryTextColor : subsurfaceTheme.textColor
|
||||
|
@ -59,7 +61,7 @@ Kirigami.ScrollablePage {
|
|||
states: [
|
||||
State {
|
||||
name: "isHidden";
|
||||
when: dive.tripMeta !== activeTrip && dive.tripNrDives != 0
|
||||
when: dive.tripMeta !== activeTrip && ! diveOutsideTrip
|
||||
PropertyChanges {
|
||||
target: innerListItem
|
||||
height: 0
|
||||
|
@ -68,7 +70,7 @@ Kirigami.ScrollablePage {
|
|||
},
|
||||
State {
|
||||
name: "isVisible";
|
||||
when: dive.tripMeta === activeTrip || dive.tripNrDives == 0
|
||||
when: dive.tripMeta === activeTrip || diveOutsideTrip
|
||||
PropertyChanges {
|
||||
target: innerListItem
|
||||
height: diveListEntry.height + Kirigami.Units.smallSpacing
|
||||
|
|
Loading…
Add table
Reference in a new issue