aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/doc/snippets/qml/repeaters/repeater.qml
blob: cdb1f6f50a3d5823083f84df050bd779c2ef811b (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
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

//! [import]
import QtQuick 2.0
//! [import]

Row {

//! [simple]
Row {
    Repeater {
        model: 3
        Rectangle {
            width: 100; height: 40
            border.width: 1
            color: "yellow"
        }
    }
}
//! [simple]

//! [index]
Column {
    Repeater {
        model: 10
        Text { text: "I'm item " + index }
    }
}
//! [index]

//! [modeldata]
Column {
    Repeater {
        model: ["apples", "oranges", "pears"]
        Text { text: "Data: " + modelData }
    }
}
//! [modeldata]

//! [layout]
Row {
    Rectangle { width: 10; height: 20; color: "red" }
    Repeater {
        model: 10
        Rectangle { width: 20; height: 20; radius: 10; color: "green" }
    }
    Rectangle { width: 10; height: 20; color: "blue" }
}
//! [layout]

}