mathtrainingstuff/main.qml

107 lines
2.4 KiB
QML
Raw Normal View History

2018-11-22 12:39:09 +01:00
import QtQuick 2.9
import QtQuick.Window 2.3
import QtQuick.Controls 2.4
2018-12-15 19:44:11 +01:00
import "./calender"
import "./calculator"
2018-11-22 12:39:09 +01:00
Window {
visible: true
width: 640
height: 480
title: qsTr("Training")
Item {
id: game
anchors.fill: parent
2018-11-26 19:33:59 +01:00
state: "starting"
2018-11-22 12:39:09 +01:00
states: [
State {
2018-11-26 19:33:59 +01:00
name: "starting"
2018-11-22 12:39:09 +01:00
PropertyChanges {
target: mainStack
currPage: startPageComp
}
},
State {
name: "calender"
PropertyChanges {
target: mainStack
currPage: calenderPageComp
2018-11-22 12:39:09 +01:00
}
},
State {
name: "calculator"
2018-11-22 12:39:09 +01:00
PropertyChanges {
target: mainStack
currPage: calculatorPageComp
2018-11-22 12:39:09 +01:00
}
}
]
StackView {
id: mainStack
property var currPage
anchors.fill: parent
onCurrPageChanged: {
mainStack.replace(currPage)
}
onCurrentItemChanged: {
mainStack.currentItem.pageOpened()
}
Component {
id: startPageComp
StartPage {
}
}
Component {
id: calenderPageComp
2018-12-15 19:44:11 +01:00
Calender {
2018-11-22 12:39:09 +01:00
}
}
Component {
id: calculatorPageComp
Calculator {
2018-11-22 12:39:09 +01:00
}
}
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"
}
2018-11-22 12:39:09 +01:00
}
}