aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage/data/retainThis.qml
blob: 7a372ee236c62c51e97476d656b59d6e32966af1 (plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
import QmlOtherThis
import QtQml

QtObject {
    property var cppMethod: objA.greet
    property var cppMethod2: objA.sum

    property Greeter a: Greeter { id: objA; objectName: "objA" }
    property Greeter b: Greeter { id: objB; objectName: "objB" }

    function doCall() {
        cppMethod.call(objB)
        cppMethod2(5, 6)
    }

    property var cppMethod3;
    function doRetrieve(g) {
        cppMethod3 = g.greet;
    }

    function doCall2() {
        cppMethod3();
    }

    property Greeter c: Greeter {
        id: objC
        objectName: "objC"

        property var cppMethod: objC.sum

        function doCall() {
            cppMethod(7, 7)
        }
    }

    Component.onCompleted: {
        doCall();
        doCall();

        doRetrieve(objA);
        doCall2();
        doRetrieve(objB);
        doCall2();

        objC.doCall();
        objC.cppMethod = objB.sum;
        objC.doCall();
    }
}