-
Notifications
You must be signed in to change notification settings - Fork 1
/
getrandomticket.qml
169 lines (140 loc) · 2.97 KB
/
getrandomticket.qml
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
import QtQuick 1.0
Rectangle {
Component {
id: winner
Item {
property variant text: "";
height: 40
width: main.width/3
Text {
text: parent.text;
font.pixelSize: 40
id: txt
horizontalAlignment: Text.AlignHCenter
width: parent.width
}
MouseArea {
anchors.fill: parent
onClicked: {
txt.font.strikeout = !txt.font.strikeout;
mouse.accepted = true;
}
}
}
}
width: 1024
height: 768
color: "white"
id: main
Text {
text: "Gewinner:"
font.family: "Lato"
font.pixelSize: 60
font.weight: Font.Normal
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 30
}
Image {
source: "piandmore-small.png"
anchors.left: parent.left
anchors.leftMargin: 20
anchors.bottom: parent.bottom
anchors.bottomMargin: 230
width: 150
fillMode: Image.PreserveAspectFit
smooth: true
}
Text {
text: "#pam10"
anchors.baseline: parent.bottom
anchors.baselineOffset: -234
anchors.right: parent.right
anchors.rightMargin: 30
font.family: "Lato"
font.weight: Font.Normal
font.pixelSize: 60
}
PropertyAnimation {
id: animateWinnerOn
//objectName: "animateWinnerOn"
target: currentWinner
properties: "anchors.bottomMargin"
from: -220
to: -15
duration: 300
easing.type: Easing.InCubic
onRunningChanged: {
if (! running) {
winner.createObject(winners, {text: currentWinner.number});
}
}
}
PropertyAnimation {
id: animateWinnerOff
//objectName: "animateWinnerOff"
target: currentWinner
properties: "anchors.bottomMargin"
to: -220
from: -15
duration: 300
easing.type: Easing.OutCubic
onRunningChanged: {
if (! running) {
showNextWinner();
}
}
}
function showNextWinner() {
handler.shuffle();
var w = "" + latestWinnerName;
currentWinner.text = w;
currentWinner.number = latestWinnerTicket
animateWinnerOn.start();
}
Rectangle {
id: currentWinner
width: parent.width-20
height: 210
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: -height
border.width: 5
border.color: "black"
radius: 10
color: "#0d0";
property variant text: ""
property variant number: ""
Text {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.parent.bottom
text: "#" + parent.number + ": " + parent.text
font.pixelSize: 150
width: parent.width
horizontalAlignment: Text.AlignHCenter
}
}
MouseArea {
property variant firstStart: true
anchors.fill: parent
onClicked: {
//handler.test();
//winners.children[0].children[0].text = test;
if (firstStart) {
firstStart = false;
showNextWinner();
} else {
animateWinnerOff.start()
}
}
}
Grid {
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 120
id: winners
spacing: 10
columns: 3
width: parent.width-20
}
}