summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2018-04-16 09:40:11 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-04-16 09:40:14 -0700
commit2529529ff94f9150d491b015a589e5c282bc8492 (patch)
tree542147916e67c08c454b34b85e8d5d90ea0c4167
parentf8742a48b2ac9ad8835ff4cb27ca44eba1d761f0 (diff)
downloadsubsurface-2529529ff94f9150d491b015a589e5c282bc8492.tar.gz
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>
-rw-r--r--mobile-widgets/qml/DiveList.qml10
1 files changed, 6 insertions, 4 deletions
diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml
index 43b95c4f3..d9a171872 100644
--- a/mobile-widgets/qml/DiveList.qml
+++ b/mobile-widgets/qml/DiveList.qml
@@ -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