summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/declarative/flow-diagram.qml
blob: 228d18566ed846922332a2bc91e5dc4c7fb17230 (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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick

Rectangle {
    color: "lightblue"
    width: 300; height: 200

//! [flow item]
    Flow {
        anchors.fill: parent
        anchors.margins: 4
        spacing: 10

        Repeater {
            id: repeater
            model: {
                var strings = ["Text", "items", "flowing", "inside", "a",
                               "Flow", "item"];
                strings;
            }

            Rectangle {
                color: "white"
                width: textItem.width + 4
                height: textItem.height + 4
                Text {
                    id: textItem
                    anchors.horizontalCenter: parent.horizontalCenter
                    text: repeater.model[index]
                    font.pixelSize: 40
                }
            }
        }
    }
//! [flow item]
}