Qt specifies below code in https://doc.qt.io/qt-5/qtquick-performance.html. accumulatedValue variable is accessed as "root.accumulatedValue" and just "accumulatedValue". Just curious to understand What is the correct way to access parent variables in such situations.
// good.qml
import QtQuick 2.3
Item {
id: root
width: 200
height: 200
property int accumulatedValue: 0
Text {
anchors.fill: parent
text: root.accumulatedValue.toString()
onTextChanged: console.log("text binding re-evaluated")
}
Component.onCompleted: {
var someData = [ 1, 2, 3, 4, 5, 20 ];
var temp = accumulatedValue;
for (var i = 0; i < someData.length; ++i) {
temp = temp + someData[i];
}
accumulatedValue = temp;
}
}