C
Qt Cluster: Rendering and Recovery from Main UI Failure
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
// This file is part of the Qt Safe Renderer module
import QtQuick
import "../functions.js" as Functions
import ClusterDemo
Item {
id: root
property alias speedValue: speedgauge.speedValue
property alias maxValue: speedgauge.maxValue
property bool updateGeometry: false
property bool showWire: false
Image {
id: bg
anchors.centerIn: parent
source: "image://etc/Gauge_Speed.png"
GaugeFiller {
id: speedgauge
property real outerRadius: Math.min(width, height) * 0.5
property real speedValue: 0
value: startupAnimationStopped ? ValueSource.kph : speedValue
anchors.fill: parent
radius: 177
fillWidth: 10
updateGeometry: root.updateGeometry
doNotFill: root.showWire
Behavior on value {
enabled: startupAnimationStopped
PropertyAnimation { duration: 500 }
}
}
GaugeFiller {
id: fuel
anchors.fill: parent
radius: 177
fillWidth: 10
value: ValueSource.fuelLevel
numVertices: 16
minAngle: 323.7
maxAngle: 287.7
maxValue: 100
color: "#464749"
updateGeometry: root.updateGeometry
doNotFill: root.showWire
Behavior on value {
enabled: startupAnimationStopped
PropertyAnimation { duration: 100 }
}
}
}
Text {
id: topText
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.verticalCenter
font.pixelSize: Functions.toPixels(0.3, speedgauge.outerRadius)
color: "white"
text: speedgauge.value.toFixed()
}
Text {
id: kmText
text: "km/h"
color: "white"
font.pixelSize: Functions.toPixels(0.09, speedgauge.outerRadius)
anchors.top: topText.bottom
anchors.horizontalCenter: parent.horizontalCenter
}
Image {
id: tyreLight
anchors.right: parkingLight.left
anchors.bottom: parkingLight.bottom
anchors.bottomMargin: 18
source: ValueSource.flatTire ? "image://etc/Icon_TyreMalfunction_ON.png"
: "image://etc/Icon_TyreMalfunction_OFF.png"
}
Image {
id: parkingLight
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: kmText.bottom
anchors.topMargin: 20
source: ValueSource.parkingBrake ? "image://etc/Icon_ParkingBrake_ON.png"
: "image://etc/Icon_ParkingBrake_OFF.png"
}
Image {
id: fuelLight
anchors.left: parkingLight.right
anchors.bottom: parkingLight.bottom
anchors.bottomMargin: 18
source: (ValueSource.fuelLevel <= 15) ? "image://etc/Icon_Fuel_ON.png"
: "image://etc/Icon_Fuel_OFF.png"
}
}