summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-04-01 18:05:09 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-04-04 12:00:25 -0700
commit66d3eaa9430bab4ee2c8974eb73ea185973c7617 (patch)
tree1a795c4dd74b3723753f8a5fce16a5b9c0246d0a
parentcf9303c862009f30b0a415ef9151d7fc6e14527e (diff)
downloadsubsurface-66d3eaa9430bab4ee2c8974eb73ea185973c7617.tar.gz
mobile/dive-list: performance improvement for invalid dives
Small optimization that reduces the number of accesses to the underlying model. Instead of evaluating the isInvalid member eight times per delegate, we only check it once. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--mobile-widgets/qml/DiveList.qml9
1 files changed, 5 insertions, 4 deletions
diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml
index 25cbccdd4..1e42f6444 100644
--- a/mobile-widgets/qml/DiveList.qml
+++ b/mobile-widgets/qml/DiveList.qml
@@ -37,6 +37,7 @@ Kirigami.ScrollablePage {
property variant myData: model
property var view: ListView.view
property bool selected: !isTrip && current // don't use 'checked' for this as that confuses QML as it tries
+ property bool invalid: isInvalid === true
id: diveOrTripDelegateItem
padding: 0
supportsMouseEvents: true
@@ -182,7 +183,7 @@ Kirigami.ScrollablePage {
id: locationText
text: (undefined !== location && "" != location) ? location : qsTr("<unnamed dive site>")
font.weight: Font.Medium
- font.strikeout: isInvalid !== undefined ? isInvalid : false
+ font.strikeout: invalid
font.pointSize: subsurfaceTheme.smallPointSize
elide: Text.ElideRight
maximumLineCount: 1 // needed for elide to work at all
@@ -207,7 +208,7 @@ Kirigami.ScrollablePage {
text: (undefined !== dateTime) ? dateTime : ""
width: Math.max(locationText.width * 0.45, paintedWidth) // helps vertical alignment throughout listview
font.pointSize: subsurfaceTheme.smallPointSize
- font.strikeout: isInvalid !== undefined ? isInvalid : false
+ font.strikeout: invalid
color: selected ? subsurfaceTheme.darkerPrimaryTextColor : subsurfaceTheme.secondaryTextColor
}
// spacer, just in case
@@ -220,7 +221,7 @@ Kirigami.ScrollablePage {
text: (undefined !== depthDuration) ? depthDuration : ""
width: Math.max(Kirigami.Units.gridUnit * 3, paintedWidth) // helps vertical alignment throughout listview
font.pointSize: subsurfaceTheme.smallPointSize
- font.strikeout: isInvalid !== undefined ? isInvalid : false
+ font.strikeout: invalid
color: selected ? subsurfaceTheme.darkerPrimaryTextColor : subsurfaceTheme.secondaryTextColor
}
}
@@ -228,7 +229,7 @@ Kirigami.ScrollablePage {
id: numberText
text: "#" + number
font.pointSize: subsurfaceTheme.smallPointSize
- font.strikeout: isInvalid !== undefined ? isInvalid : false
+ font.strikeout: invalid
color: selected ? subsurfaceTheme.darkerPrimaryTextColor : subsurfaceTheme.secondaryTextColor
anchors {
right: parent.right