-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodingQuestion3.qml
More file actions
168 lines (153 loc) · 4.17 KB
/
CodingQuestion3.qml
File metadata and controls
168 lines (153 loc) · 4.17 KB
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
import QtQuick 2.15
import QtQuick.Controls 2.15
import LogicHandler 1.0
ApplicationWindow {
id: mainWindow
visible: true
width: 500
height: 700
title: "quiz"
LogicHandler {
id: logicHandler // This allows referencing this instance in QML
}
Rectangle {
width: 500
height: 700
anchors.centerIn: parent
radius: 20
gradient: Gradient {
GradientStop { position: 0.0; color: "#0d1e35" }
GradientStop { position: 1.0; color: "#2a4b7e" }
}
border.color: "#5dd0f0"
border.width: 3
anchors.verticalCenterOffset: 0
anchors.horizontalCenterOffset: 0
Text {
x: 215
y: 30
text: "Quiz"
font.bold: true
font.pixelSize: 28
color: "white"
}
Text {
x: 58
y: 567
text: "CAUTION! - IF YOU GET THIS WRONG, PENALTIES\nWILL BE GIVEN ACCORDINGLY."
font.pixelSize: 16
font.bold: true
color: "red"
horizontalAlignment: Text.AlignHCenter
}
Button {
y: 631
text: "Close"
anchors.horizontalCenterOffset: -5
width: 100
height: 40
anchors.horizontalCenter: parent.horizontalCenter
onClicked: logicHandler.handleNavigation("StartMenu.qml", mainWindow)
}
TextEdit {
id: textEdit
x: 100
y: 108
width: 292
height: 54
color: "#f5f0f0"
text: qsTr("What is a function prototype in C++?\n")
font.pixelSize: 20
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
TextEdit {
id: textEdit1
x: 94
y: 154
width: 434
height: 65
color: "#f5f0f0"
text: qsTr("a) int 4thValue;\n\n")
font.pixelSize: 20
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignTop
}
TextEdit {
id: textEdit2
x: 94
y: 219
width: 392
height: 63
color: "#f5f0f0"
text: qsTr("b) float my number;\n\n")
font.pixelSize: 20
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignTop
}
TextEdit {
id: textEdit3
x: 94
y: 288
width: 392
height: 63
color: "#f5f0f0"
text: qsTr("c) double _value2;\n")
font.pixelSize: 20
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignTop
}
TextEdit {
id: textEdit4
x: 94
y: 335
width: 392
height: 63
color: "#f5f0f0"
text: qsTr("d) char* class\n\n")
font.pixelSize: 20
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignTop
}
CheckBox {
id: checkBox
x: 33
y: 154
text: qsTr("")
}
CheckBox {
id: checkBox1
x: 33
y: 219
text: qsTr("")
}
CheckBox {
id: checkBox2
x: 33
y: 283
text: qsTr("")
}
CheckBox {
id: checkBox3
x: 33
y: 335
text: qsTr("")
}
Button {
y: 459
width: 165
height: 40
text: "Answer"
anchors.horizontalCenterOffset: -5
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
if (checkBox.checked && !checkBox1.checked && !checkBox2.checked && !checkBox3.checked) {
console.log("Correct answer!");
logicHandler.handleNavigation("Quest.qml", mainWindow);
} else {
console.log("Wrong answer. Try again.");
}
}
}
}
}