ApplicationFlow.qml Example File
coffee/ApplicationFlow.qml
import QtQuick 2.4
import Coffee 1.0
ApplicationFlowForm {
id: applicationFlow
state: "initial"
property int animationDuration: 400
choosingCoffee.brewButtonSelection.onClicked: {
applicationFlow.state = "settings"
applicationFlow.choosingCoffee.milkSlider.value = applicationFlow.choosingCoffee.sideBar.currentMilk
applicationFlow.choosingCoffee.sugarSlider.value = 2
}
choosingCoffee.sideBar.onCoffeeSelected: {
applicationFlow.state = "selection"
}
choosingCoffee.backButton.onClicked: {
applicationFlow.state = "selection"
}
choosingCoffee.brewButton.onClicked: {
applicationFlow.state = "empty cup"
}
emptyCup.continueButton.onClicked: {
applicationFlow.state = "brewing"
brewing.coffeeName = choosingCoffee.sideBar.currentCoffee
brewing.start()
}
brewing.onFinished: {
finalAnimation.start()
}
SequentialAnimation {
id: finalAnimation
PropertyAction {
target: applicationFlow
property: "state"
value: "finished"
}
PauseAnimation {
duration: 1000
}
PropertyAction {
target: applicationFlow
property: "state"
value: "start"
}
PauseAnimation {
duration: applicationFlow.animationDuration
}
PauseAnimation {
duration: 400
}
PropertyAction {
target: applicationFlow
property: "state"
value: "initial"
}
}
Behavior on choosingCoffee.x {
PropertyAnimation {
duration: applicationFlow.animationDuration
easing.type: Easing.InOutQuad
}
}
Behavior on emptyCup.x {
PropertyAnimation {
duration: applicationFlow.animationDuration
easing.type: Easing.InOutQuad
}
}
Behavior on brewing.x {
PropertyAnimation {
duration: applicationFlow.animationDuration
easing.type: Easing.InOutQuad
}
}
}