Files
volvodisplay/main.qml

63 lines
1.7 KiB
QML
Raw Normal View History

import QtQuick
import QtQuick.Controls
Window {
width: 480
height: 480
visible: true
title: "Volvo Display"
// For a circular display, we might want to hide the window frame
// if running full screen, but for now we keep it standard.
// flags: Qt.FramelessWindowHint
Loader {
id: mainLoader
anchors.fill: parent
sourceComponent: introComponent
onStatusChanged: {
if (status === Loader.Ready) console.log("Loader: Loaded " + source)
if (status === Loader.Error) console.log("Loader: Error loading " + source)
}
Binding {
target: mainLoader.item
property: "currentTemp"
value: backend.leftTemp
when: mainLoader.status === Loader.Ready && mainLoader.source.toString().includes("TemperatureGauge.qml")
}
Binding {
target: mainLoader.item
property: "currentRightTemp"
value: backend.rightTemp
when: mainLoader.status === Loader.Ready && mainLoader.source.toString().includes("TemperatureGauge.qml")
}
}
Component {
id: introComponent
Rectangle {
id: bg
anchors.fill: parent
color: "white"
Text {
anchors.centerIn: parent
text: "Hello Pi"
color: "black"
}
}
}
Timer {
interval: 5000
running: true
repeat: false
onTriggered: {
console.log("Timer triggered. Switching to TemperatureGauge.qml")
mainLoader.source = "TemperatureGauge.qml"
}
}
}