aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleFour.js
blob: 569f29f7513090f094a5c38f00959f4fb3159074 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//![0]
// exampleFour.js
.import Qt.example 1.0 as QtExample

function importAvatar() {
    var component = Qt.createComponent("exampleTwo.qml");
    var exampleOneElement = component.createObject(null);
    var avatarExample = exampleOneElement.a;
    var retn = avatarExample.avatar;
    retn.preserve();
    return retn;
}

function releaseAvatar(avatar) {
    avatar.destroy();
}
//![0]