blob: 3729022ed59bfe1b87eb3a07dbdb3c7e127a85bb (
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
36
37
38
39
40
41
|
import Qt 4.6
Rectangle {
width: 480; height: 320;
WorkerScript {
id: myWorker
source: "workerscript.js"
}
Rectangle {
width: 200; height: 200
anchors.left: parent.left
anchors.leftMargin: 20
color: "red"
MouseRegion {
anchors.fill: parent
onClicked: myWorker.sendMessage( { rectangle: "red", x: mouse.x, y: mouse.y } );
}
}
Rectangle {
width: 200; height: 200
anchors.right: parent.right
anchors.rightMargin: 20
color: "blue"
MouseRegion {
anchors.fill: parent
onClicked: myWorker.sendMessage( { rectangle: "blue", x: mouse.x, y: mouse.y } );
}
}
Text {
text: "Click a Rectangle!"
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 50
}
}
|