61 lines
1.3 KiB
QML
61 lines
1.3 KiB
QML
import QtQuick 2.9
|
|
import QtQuick.Controls 2.4
|
|
import "./"
|
|
|
|
Page {
|
|
id: root
|
|
|
|
Label {
|
|
id: num
|
|
anchors.centerIn: parent
|
|
font.pixelSize: calculator.height * 0.6
|
|
text: calculator.nums[calculator.currIndex]
|
|
}
|
|
|
|
|
|
ProgressBar {
|
|
id: prog
|
|
property int progress: 0
|
|
anchors {
|
|
bottom: parent.bottom
|
|
bottomMargin: parent.height * 0.02
|
|
left: parent.left
|
|
leftMargin: parent.width * 0.01
|
|
right: parent.right
|
|
rightMargin: parent.width * 0.01
|
|
}
|
|
value: progress/100
|
|
NumberAnimation {
|
|
id: progAnim
|
|
target: prog
|
|
property: "progress"
|
|
from: 100
|
|
to: 0
|
|
duration: tick.interval
|
|
easing.type: Easing.Linear
|
|
}
|
|
}
|
|
|
|
Timer {
|
|
id: tick
|
|
interval: calculator.tickInterval
|
|
repeat: false
|
|
running: calculator.state === "running"
|
|
|
|
onTriggered: {
|
|
if(calculator.currIndex+1 <= calculator.numCount-1){
|
|
nextNumber()
|
|
tick.start()
|
|
}
|
|
else {
|
|
|
|
}
|
|
}
|
|
|
|
onRunningChanged: {
|
|
if(running){
|
|
progAnim.start()
|
|
}
|
|
}
|
|
}
|
|
}
|