aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/data/getThis.qml
blob: 90c51caf4d54315015c840e7c887a59ba8d602a4 (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

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();
    }
}