aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qquicklistmodel/data/workerremovelist.qml
blob: bdb5e024d8a08b22aedffe03a306d088a02ea5c6 (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
import QtQuick 2.0

Item {
  id: item
  property variant model
  property bool done: false

  WorkerScript {
    id: worker
    source: "workerremovelist.js"
    onMessage: {
      item.done = true
    }
  }

  function addList() {
    model.append({ 'data': [ { 'subData': 1 } ] });

    var element = model.get(0);
  }

  function removeListViaWorker() {
    done = false
    var msg = { 'action': 'removeList', 'model': model }
    worker.sendMessage(msg);
  }

  function doSync() {
    done = false
    var msg = { 'action': 'dosync', 'model': model }
    worker.sendMessage(msg);
  }
}