summaryrefslogtreecommitdiffstats
path: root/examples/declarative/listmodel-threaded/timedisplay.qml
blob: 80ac9faa57485a49eb1ba0c0802d6777a16327ac (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
// ![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]