blob: ed2fdae697de8eba95b122db777abb984924b212 (
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
78
79
80
81
82
|
import Qt 4.6
Rectangle {
id: root
width: 800; height: 480
property int coffee_count: 0
property int coffee_total: 12
function add_one() {
if (coffee_count < coffee_total) {
root.coffee_count += 1,
counter_toGo.state = "add_count",
counter_cupsDown.state = "add_count",
cup.state = "less_one",
tray.add_cup(coffee_count)
}
}
function remove_one() {
if (coffee_count > 0) {
root.coffee_count -= 1,
counter_toGo.state = "remove_count",
counter_cupsDown.state = "remove_count",
tray.remove_cup(coffee_count)
}
}
Image {
source: "images/bg.png"
}
Taskbar {
anchors.top: root.top
}
Counter_toGo {
id: counter_toGo
x: 130; y: 120;
}
Counter_cupsDown {
id: counter_cupsDown
x: 260; y: 86;
}
Text {
id: toGo;
y: 120; x: 345;
text: "to go"; font.pixelSize: 100; font.letterSpacing: 90; color: "#FFF"
}
Text {
id: cupsDown
y: 86; x: 390;
text: "cups down"; font.pixelSize: 50; font.letterSpacing: 90; color: "#999"
}
Tray {
id: tray
x: 335; y: 280;
}
Tray_model{
id: traymodel
}
Cup {
id: cup
x: 175; y: 0;
}
Add {
id: add_btn
x: -7; y: 200
onAddClicked: add_one()
}
Remove {
id: remove_btn
x: 619; y: 200
onRemoveClicked: remove_one()
}
}
|