summaryrefslogtreecommitdiffstats
path: root/examples/declarative/listmodel-threaded/timedisplay.qml
blob: e8d8fe2b2a82512d28a8c4a57bd543240d4bcbbd (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.6

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]