blob: 66fdf8722bf205c2084bb23c2bcfe3e30c4a2481 (
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
import Qt 4.6
Rectangle {
id: page
width: 800
height: 800
color: "black"
Script { source: "dynamic.js" }
property bool extendStars: false
Item { id: targetItem; x: 100; y: 100; }
Item { id: targetItem2; x: 0; y: 300; }
Rectangle {
id: rect
width: 100
height: 100
color: "green"
MouseRegion {
anchors.fill: parent
onClicked: { a = createWithComponent(); }
}
}
Rectangle {
id: rect2
width: 100
height: 100
y: 100
color: "red"
MouseRegion {
anchors.fill:parent
onClicked: { destroyDynamicObject(); }
}
}
Rectangle {
id: rect3
width: 100
height: 100
y: 200
color: "blue"
MouseRegion {
anchors.fill: parent
onClicked: {
if (fourthBox == null) {
a = createQml(targetItem2);
if (a != null) {
a.parent = targetItem2;//BUG: this should happen automatically
fourthBox = a;
print(a.toStr());
extendStars = true;
}
} else {
fourthBox.state = 'dying';
fourthBox.destroy(500);
fourthBox = null;
extendStars = false;
}
}
}
}
Particles {
x: 0
y: 0
count: 20
lifeSpan: 500
width: 100
height: if (extendStars) { 400; } else { 300; }
source: "star.png"
}
}
|