aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/data/getThis.qml
blob: db9854e87295970abe315f30607ef1289a5e1421 (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
// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

import QtQml 2.12

QtObject {
    id: root
    property QtObject self;

    property Timer timer: Timer {
        running: true
        interval: 1
        onTriggered: {
            root.assignThis();
            root.self = null;
            root.assignThis();
        }
    }

    function getThis() {
        return this;
    }

    function assignThis() {
        self = getThis();
    }
}