mathtrainingstuff/CalculatorEndPage.qml
Max 5e5d8f954a added back button
added colorAnimation on Progressbar in calculator
2018-11-27 20:58:27 +01:00

108 lines
2.7 KiB
QML

import QtQuick 2.11
import QtQuick.Controls 2.4
import "./"
Page {
id: root
signal pageOpened()
TextField {
id: sumInput
placeholderText: "sum"
visible: !endPageVisibility
validator: IntValidator {bottom: -1000000; top: 1000000;}
anchors {
horizontalCenter: parent.horizontalCenter
top: parent.top
topMargin: parent.height * 0.1
}
Keys.onReturnPressed: calculator.checkSum(sumInput.text)
}
RoundButton {
id: checkButton
height: parent.width * 0.2
width: height
text: "check"
font.pixelSize: parent.width * 0.03
visible: !calculator.endPageVisibility
anchors {
horizontalCenter: parent.horizontalCenter
top: parent.top
topMargin: parent.height * 0.3
}
onClicked: {
calculator.checkSum(sumInput.text)
}
}
Label {
id: won
text: calculator.endPageLabelText
font.pixelSize: parent.width * 0.2
visible: calculator.endPageVisibility
anchors {
horizontalCenter: parent.horizontalCenter
top: parent.top
topMargin: parent.height * 0.05
}
}
Label {
id: sum
text: "Sum: " + calculator.sum
font.pixelSize: parent.width * 0.1
visible: calculator.endPageVisibility ? ( won.text==="You Lose!" ? true:false):false
anchors {
horizontalCenter: parent.horizontalCenter
top: parent.top
topMargin: parent.height * 0.4
}
}
Row {
id: buttonRow
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
bottomMargin: parent.height * 0.15
}
height: childrenRect.height
width: childrenRect.width
spacing: parent.width * 0.1
visible: calculator.endPageVisibility ? true:false
RoundButton {
id: homeButton
height: root.width * 0.2
width: height
text: "home"
onClicked: {
game.state = "starting"
calculator.reset()
}
}
RoundButton {
id: startButtons
height: root.width * 0.2
width: height
text: "start"
onClicked: {
calculator.state = "starting"
}
}
RoundButton {
id: restart
height: root.width * 0.2
width: height
text: "restart"
onClicked: {
calculator.start()
}
}
}
}