Timeline: avoid rebuilding of text nodes

Using an array of strings as model has the unfortunate effect that all
text nodes resulting from it are rebuilt whenever anything in the
array changes. Using a number as model only triggers a rebuild of
everything when the number changes.

Change-Id: I8a762e78eb75b282f46641a6cba6eff43c8ebfd5
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2015-08-31 13:43:38 +02:00
parent e8e45ca102
commit ce092d3f30

View File

@@ -144,17 +144,20 @@ Item {
columns: 2
Repeater {
model: [
id: details
property var contents: [
qsTr("Start") + ":",
detailedPrintTime(startTime),
showDuration ? (qsTr("End") + ":") : "",
showDuration ? detailedPrintTime(endTime) : "",
showDuration ? (qsTr("Duration") + ":") : "",
showDuration ? detailedPrintTime(duration) : ""
(qsTr("End") + ":"),
detailedPrintTime(endTime),
(qsTr("Duration") + ":"),
detailedPrintTime(duration)
]
model: showDuration ? 6 : 2
Detail {
isLabel: index % 2 === 0
text: modelData
text: details.contents[index]
}
}
}