aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlinstantiator/data/activeModelChangeInteraction.qml
blob: 2797566ad29f0c929a4725d72bdab9eb803ab874 (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
import QtQuick 2.15
import QtQml.Models 2.15

Item {
    id: root
    property int instanceCount: 0
    property alias active: instantiator.active

    ListModel {
        id: listmodel

        dynamicRoles: true
    }

    Component.onCompleted: {
        listmodel.insert(listmodel.count, {name: "one"})
        listmodel.insert(listmodel.count, {name: "two"})
        listmodel.insert(listmodel.count, {name: "three"})
    }

    Instantiator {
        id: instantiator

        active: false

        model: listmodel

        delegate: Text {
            width: 100
            height: 20

            text: name

            Component.onCompleted: ++root.instanceCount
        }

    }
}