mathtrainingstuff/main.qml
2018-12-15 19:44:11 +01:00

106 lines
2.4 KiB
QML

import QtQuick 2.9
import QtQuick.Window 2.3
import QtQuick.Controls 2.4
import "./calender"
import "./calculator"
Window {
visible: true
width: 640
height: 480
title: qsTr("Training")
Item {
id: game
anchors.fill: parent
state: "starting"
states: [
State {
name: "starting"
PropertyChanges {
target: mainStack
currPage: startPageComp
}
},
State {
name: "calender"
PropertyChanges {
target: mainStack
currPage: calenderPageComp
}
},
State {
name: "calculator"
PropertyChanges {
target: mainStack
currPage: calculatorPageComp
}
}
]
StackView {
id: mainStack
property var currPage
anchors.fill: parent
onCurrPageChanged: {
mainStack.replace(currPage)
}
onCurrentItemChanged: {
mainStack.currentItem.pageOpened()
}
Component {
id: startPageComp
StartPage {
}
}
Component {
id: calenderPageComp
Calender {
}
}
Component {
id: calculatorPageComp
Calculator {
}
}
replaceExit: Transition {
NumberAnimation {
from: 1
to: 0
property: "opacity"
duration: 200
easing.type: Easing.InOutQuad
}
}
replaceEnter: Transition {
NumberAnimation {
from: 0
to: 1
property: "opacity"
duration: 200
easing.type: Easing.InOutQuad
}
}
}
function start() {
game.state = "starting"
}
function calender() {
game.state = "calender"
}
function calculator() {
game.state = "calculator"
}
}
}