diff options
Diffstat (limited to 'doc/src/snippets/declarative/workerscript.qml')
-rw-r--r-- | doc/src/snippets/declarative/workerscript.qml | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/src/snippets/declarative/workerscript.qml b/doc/src/snippets/declarative/workerscript.qml new file mode 100644 index 0000000..838e7e5 --- /dev/null +++ b/doc/src/snippets/declarative/workerscript.qml @@ -0,0 +1,24 @@ +//![0] +import Qt 4.7 + +Rectangle { + width: 300; height: 300 + + Text { + id: myText + text: 'Click anywhere' + } + + WorkerScript { + id: myWorker + source: "script.js" + + onMessage: myText.text = messageObject.reply + } + + MouseArea { + anchors.fill: parent + onClicked: myWorker.sendMessage({ 'x': mouse.x, 'y': mouse.y }) + } +} +//![0] |