aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml/usingmodel/view.qml
blob: c5aa7e0fc6edf7d8e7acf0e318eeff96da0771c6 (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
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick
import PersonModel

ListView {
    width: 100
    height: 100
    anchors.fill: parent
    model: MyModel
    delegate: Component {
        Rectangle {
            height: 25
            width: 100
            Text {
                function displayText() {
                    var result = ""
                    if (typeof display !== "undefined")
                        result = display + ": "
                    result += modelData
                    return result
                }

                text: displayText()
            }
        }
    }
}