aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlformat/data/Example1.formatted.qml
blob: 4b65b9add663e0850a305ae5022fdd05abac771a (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/* This file is licensed under the not a license license
	1. You may not comply
	2. Goodbye
*/

import A.B.B.A
import A.LLOHA
// Importing this is very important
import QtQuick 5.15
// Muddling the waters!
import QtQuick.Models 3.14 as muddle
import That
import This // THIS IS VERY IMPORTANT!
import X.Y
import X.Z
import Y
// Importing that is important too
import Z

// This comment is related to Item
Item {
    // Orphan comment
    // Another orphan
    // More orphans

    // This to id
    // Also id. (line 2)
    // This is the third id
    // fourth id comment
    id: foo

    // This to enum
    enum Foo {
        A = 3, // This is A
        B, // This is B
        C = 4, // This is C
        D // This is D
    }

    property bool some_bool: false
    property variant some_array_literal: [30, 20, Math["PI"], [4, 3, 2], "foo", 0.3]
    property bool something_computed: function(x) {
        // This is an orphan inside something_computed
        // Are these getting duplicated?
        // Another orphan inside something_computed

        const PI = 3, DAYS_PER_YEAR = 365.25;
        var x = 3 + 2;
        x["bla"] = 50;
        // This one to var few!
        var few = new WhatEver();
        x += Math.sin(3);
        x--;
        --x;
        x++;
        ++x;
        for (var x = 0; x < 100; x++) {
            x++;
            console.log("Foo");
        }
        for (var x in [3, 2, 1]) {
            y++;
            console.log("Bar");
        }
        while (true)
            console.log("Wee");

        with (foo) {
            bar;
            x += 5;
        } // This is related to with!
        x3:
        do {
            console.log("Hello");
        } while (3 == 0);
        try {
            dangerous();
        } catch (e) {
            console.log(e);
        } finally {
            dangerous();
        }
        switch (x) {
        case 0:
            x = 1;
            break;
        case 1:
            x = 5;
            break;
        case 4:
            x = 100;
            break;
        }
        if (x == 50) 
            console.log("true");
        else if (x == 50) 
            console.log("other thing");
        else 
            console.log("false");

        if (x == 50) {
            console.log("true");
        } else if (x == 50) {
            console.log("other thing");
            x--;
        } else {
            console.log("false");
        }
        return "foobar";
    }()
    default property bool some_default_bool: 500 % 5 !== 0 // some_default_bool
    // some_read_only_bool
    readonly property bool some_read_only_bool: Math.sin(3) && (aFunc()[30] + 5) | 2 != 0

    signal say(string name, bool caps)

    // This one to aFunc()
    function aFunc() {
        var x = 3;
        return x;
    }

    x: 3 // Very cool
    Component.onCompleted: console.log("Foo!")
    myFavouriteThings: [
        // This is an orphan

        // This is a cool text
        Text {
        },
        // This is a cool rectangle
        Rectangle {
        }
    ]
    Text {
        required property string batman

        signal boo(int count, int times, real duration)

        text: "Bla"
    }

    // This comment is related to the property animation
    PropertyAnimation on x {
        id: foo
        x: 3
        y: x + 3
    }

}