summaryrefslogtreecommitdiffstats
path: root/examples/declarative/listmodel-threaded/timedisplay.qml
blob: 848192e7f2b3a049cc4cde4b8055c75a10854e7e (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
// ![0]
import Qt 4.7

ListView {
    width: 200
    height: 300

    model: listModel
    delegate: Component {
        Text { text: time }
    }

    ListModel { id: listModel }

    WorkerScript {
        id: worker
        source: "dataloader.js"
        onMessage: {
            console.log("Worker said", messageObject.msg);
        }
    }

    Timer {
        id: timer
        interval: 2000; repeat: true; running: true; triggeredOnStart: true

        onTriggered: {
            var msg = {'action': 'appendCurrentTime', 'model': listModel};
            worker.sendMessage(msg);
        }
    }
}
// ![0]