This repository has been archived on 2022-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
dasschmalter/main.qml

185 lines
5.8 KiB
QML
Raw Normal View History

2019-02-23 10:33:02 +01:00
import QtQuick 2.9
import QtQuick.Window 2.2
import QtQuick.Controls 2.4
Window {
visible: true
width: 640
height: 480
2019-02-23 14:55:38 +01:00
title: qsTr("Das Schmalter")
2019-02-23 10:33:02 +01:00
Page {
id: app
2019-02-23 14:55:38 +01:00
state: "off"
2019-02-23 10:33:02 +01:00
anchors.fill: parent
2019-02-23 14:55:38 +01:00
2019-02-23 10:33:02 +01:00
Button {
id: onOffBt
2019-02-23 14:55:38 +01:00
width: 400
height: width
anchors.centerIn: parent
2019-02-23 10:33:02 +01:00
2019-02-23 14:55:38 +01:00
background: Item {
id: lamp
Image {
id: lampOn0
source: "on0.png"
anchors.fill: parent
scale: 0
}
Image {
id: lampOn1
source: "on1.png"
anchors.fill: parent
scale: 0
2019-02-23 15:52:11 +01:00
Behavior on scale {
SequentialAnimation {
PauseAnimation {
duration: 200
}
NumberAnimation {
duration: 200
properties: "scale"
from: app.state === "on" ? 0:1
to: app.state === "on" ? 1:0
target: lampOn1
}
}
}
2019-02-23 14:55:38 +01:00
}
Image {
id: lampOn2
source: "on2.png"
anchors.fill: parent
scale: 0
2019-02-23 15:52:11 +01:00
Behavior on scale {
SequentialAnimation {
PauseAnimation {
duration: 400
}
NumberAnimation {
duration: 200
properties: "scale"
from: app.state === "on" ? 0:1
to: app.state === "on" ? 1:0
target: lampOn2
}
}
}
2019-02-23 14:55:38 +01:00
}
Image {
id: lampOn3
source: "on3.png"
anchors.fill: parent
scale: 0
2019-02-23 15:52:11 +01:00
Behavior on scale {
SequentialAnimation {
PauseAnimation {
duration: 600
}
NumberAnimation {
duration: 200
properties: "scale"
from: app.state === "on" ? 0:1
to: app.state === "on" ? 1:0
target: lampOn3
}
}
}
2019-02-23 14:55:38 +01:00
}
Image {
id: lampOn4
source: "on4.png"
anchors.fill: parent
scale: 0
2019-02-23 15:52:11 +01:00
Behavior on scale {
SequentialAnimation {
PauseAnimation {
duration: 800
}
NumberAnimation {
duration: 200
properties: "scale"
from: app.state === "on" ? 0:1
to: app.state === "on" ? 1:0
target: lampOn4
}
}
}
2019-02-23 14:55:38 +01:00
}
Image {
id: lampOn5
2019-02-23 15:52:11 +01:00
source: "on5.png"
2019-02-23 14:55:38 +01:00
anchors.fill: parent
scale: 0
2019-02-23 15:52:11 +01:00
Behavior on scale {
SequentialAnimation {
PauseAnimation {
duration: 1000
}
NumberAnimation {
duration: 200
properties: "scale"
from: app.state === "on" ? 0:1
to: app.state === "on" ? 1:0
target: lampOn5
}
}
}
2019-02-23 14:55:38 +01:00
}
Image {
id: lampOff
source: "off.png"
anchors.fill: parent
scale: 1
}
}
onClicked: {
if (app.state === "on") {
app.state = "off"
} else {
app.state = "on"
}
2019-02-23 10:33:02 +01:00
}
}
2019-02-23 15:52:11 +01:00
2019-02-23 14:55:38 +01:00
states: [
State {
name: "on"
PropertyChanges {
2019-02-23 15:52:11 +01:00
target: lampOn0
scale: 1
}
PropertyChanges {
target: lampOn1
scale: 1
}
PropertyChanges {
target: lampOn2
scale: 1
}
PropertyChanges {
target: lampOn3
scale: 1
}
PropertyChanges {
target: lampOn4
scale: 1
}
PropertyChanges {
target: lampOn5
2019-02-23 14:55:38 +01:00
scale: 1
}
PropertyChanges {
target: lampOff
scale: 0
}
},
State {
name: "off"
}
]
2019-02-23 10:33:02 +01:00
}
}