1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
Rectangle {
width: 200; height: 200
CustomObject { id: theObject }
function doSomethingDirect() {
theObject.prop1 = 0;
for (var i = 0; i < 1000; ++i)
theObject.prop1 += theObject.prop2;
theObject.prop3 = theObject.prop1;
}
function doSomethingLocalObj() {
theObject.prop1 = 0;
var incrementObj = theObject;
for (var i = 0; i < 1000; ++i)
incrementObj.prop1 += incrementObj.prop2;
incrementObj.prop3 = incrementObj.prop1;
}
function doSomethingLocal() {
theObject.prop1 = 0;
var increment = theObject.prop2;
for (var i = 0; i < 1000; ++i)
theObject.prop1 += increment;
theObject.prop3 = theObject.prop1;
}
}
|