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 {
|
Component {
|
||||||
id: diveDelegate
|
id: diveDelegate
|
||||||
Kirigami.AbstractListItem {
|
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
|
leftPadding: 0
|
||||||
topPadding: 0
|
topPadding: 0
|
||||||
id: innerListItem
|
id: innerListItem
|
||||||
|
@ -50,8 +52,8 @@ Kirigami.ScrollablePage {
|
||||||
supportsMouseEvents: true
|
supportsMouseEvents: true
|
||||||
checked: diveListView.currentIndex === model.index
|
checked: diveListView.currentIndex === model.index
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: dive.tripNrDives == 0 ? diveListEntry.height + Kirigami.Units.smallSpacing : 0
|
height: diveOutsideTrip ? diveListEntry.height + Kirigami.Units.smallSpacing : 0
|
||||||
visible: dive.tripNrDives == 0
|
visible: diveOutsideTrip
|
||||||
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
|
||||||
|
@ -59,7 +61,7 @@ Kirigami.ScrollablePage {
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
name: "isHidden";
|
name: "isHidden";
|
||||||
when: dive.tripMeta !== activeTrip && dive.tripNrDives != 0
|
when: dive.tripMeta !== activeTrip && ! diveOutsideTrip
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: innerListItem
|
target: innerListItem
|
||||||
height: 0
|
height: 0
|
||||||
|
@ -68,7 +70,7 @@ Kirigami.ScrollablePage {
|
||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: "isVisible";
|
name: "isVisible";
|
||||||
when: dive.tripMeta === activeTrip || dive.tripNrDives == 0
|
when: dive.tripMeta === activeTrip || diveOutsideTrip
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: innerListItem
|
target: innerListItem
|
||||||
height: diveListEntry.height + Kirigami.Units.smallSpacing
|
height: diveListEntry.height + Kirigami.Units.smallSpacing
|
||||||
|
|
Loading…
Add table
Reference in a new issue