aboutsummaryrefslogtreecommitdiffstats
path: root/qt-qml/tests/manual/qml-syntax/object.qml
blob: 8446915ff2b08b83030aa2572d35768af7637c72 (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
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only

import QtQuick as MyModule

Window {
    width: 640
    height : 480

     // single line
    Rectangle { width: 100; height: 100 }

    // multiple lines
    Rectangle {
        width: 100
        height: 100
    }

    Rectangle
    {
        width: 100
        height: 100
    }

    // nesting
    Rectangle {
        width: 100
        height: 100

        Text {
            width: 100
            height: 100
        }
    }

    // object as prop. value
    Rectangle {
        width: 100
        height: 100
        gradient: Gradient {
            GradientStop { position: 0.0; color: "yellow" }
            GradientStop { position: 1.0; color: "green" }
        }
    }

    // object within namespace
    MyModule.Text {
        text: "Hello from my custom text item!"
    }
}