aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview2/data/innerRequired.qml
blob: c0862cec0dd6a2b00977869d7f0d862f456211fc (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
import QtQuick

Item {
    ListModel {
        id: myModel
        ListElement { type: "Dog"; age: 8; noise: "meow" }
        ListElement { type: "Cat"; age: 5; noise: "woof" }
    }

    component SomeDelegate: Item {
        required property int age
        property string text
    }

    component AnotherDelegate: Item {
        property int age
        property string text

        SomeDelegate {
            age: 0
            text: ""
        }
    }

    ListView {
        id: listView
        model: myModel
        width: 100
        height: 100
        delegate: AnotherDelegate {
            age: model.age
            text: model.noise
        }
    }
}