aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/data/methods.qml
blob: 3abd14c9c1c7af1514b3243a262a1efc95ac6a61 (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
50
51
52
53
54
55
56
import QtQuick
import TestTypes

BirthdayParty {
    id: party
    host: Person {
        name: "Bob Jones"
        shoeSize: 12
    }
    guests: [
        Person { name: "Leo Hodges" },
        Person { name: "Jack Smith" },
        Person { name: "Anne Brown" }
    ]

    property var dresses: [0, 0, 0, 0]

    property var foo: party
    property var bar: console

    property var numeric
    property var stringly

    Component.onCompleted: {
        invite("William Green")
        foo.invite("The Foo")
        bar.log("The Bar")
        numeric = 1;
        stringly = "name";
    }

    function storeElement() {
        ++host.shoeSize
        party.dresses[2] = [1, 2, 3]
    }

    function stuff(sn) {
        if (sn.substr(0, 2) === "on" && sn[2] === sn[2].toUpperCase())
            return sn
        return "on" + sn.substr(0, 1).toUpperCase() + sn.substr(1)
    }

    function retrieveVar() {
        return guests[numeric][stringly];
    }

    function retrieveString() : string {
        return guests[numeric][stringly];
    }

    property var n1: stuff("onGurk")
    property var n2: stuff("semmeln")
    property var n3: stuff(12)

    property int enumValue: Item.TopRight
}