This commit is contained in:
Max 2018-11-22 13:13:46 +01:00
parent 82192b9c7d
commit 71b1fa5c36

View file

@ -7,6 +7,8 @@ Page {
property var nums: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] property var nums: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
property int currIndex: -1 property int currIndex: -1
property int tickInterval: 1000
property int numCount: 10
signal pageOpened() signal pageOpened()
@ -56,6 +58,7 @@ Page {
anchors { anchors {
top: parent.top top: parent.top
topMargin: parent.height * 0.05 topMargin: parent.height * 0.05
horizontalCenter: parent.horizontalCenter
} }
font.pixelSize: parent.height * 0.15 font.pixelSize: parent.height * 0.15
text: "Calculator" text: "Calculator"
@ -65,7 +68,7 @@ Page {
from: 1 from: 1
to: 100000 to: 100000
stepSize: 1 stepSize: 1
value: 30 value: 1000
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
editable: true editable: true
anchors { anchors {
@ -74,6 +77,9 @@ Page {
leftMargin: parent.width * 0.5 - width * 0.5 leftMargin: parent.width * 0.5 - width * 0.5
topMargin: parent.height * 0.3 - height * 0.5 topMargin: parent.height * 0.3 - height * 0.5
} }
onValueChanged: {
calculator.tickInterval = calculatorTickInterval.value
}
} }
SpinBox { SpinBox {
@ -90,6 +96,9 @@ Page {
leftMargin: parent.width * 0.5 - width * 0.5 leftMargin: parent.width * 0.5 - width * 0.5
topMargin: parent.height * 0.6 - height * 0.5 topMargin: parent.height * 0.6 - height * 0.5
} }
onValueChanged: {
calculator.numCount = calculatorNumCount.value
}
} }
Button { Button {
id: calculatorStartButton id: calculatorStartButton
@ -141,12 +150,12 @@ Page {
Timer { Timer {
id: tick id: tick
interval: calculatorTickInterval.value interval: calculator.tickInterval
repeat: false repeat: false
running: calculator.state === "running" running: calculator.state === "running"
onTriggered: { onTriggered: {
if(calculator.currIndex+1 <= 9){ if(calculator.currIndex+1 <= calculator.numCount-1){
nextNumber() nextNumber()
tick.start() tick.start()
} }