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 ClusterDemo Item { id: tachometer property real tachometerNeedleRotation: 0.0 property string rpm: actualRPM.toFixed().toString() property bool animationStoped: ValueSource.runningInDesigner ? true : startupAnimationsFinished property real actualRPM: animationStoped ? ValueSource.rpm : -tachometerNeedleRotation property real minValueAngle: 55 property real maxValueAngle: 255 property real minimumRPM: 0 property real maximumRPM: 8000 Item { anchors.right: parent.right anchors.rightMargin: 20 width: 480 height: 480 GaugeFiller { id: rpmFiller value: tachometer.actualRPM anchors.right: parent.right anchors.top: parent.top anchors.topMargin: 246 anchors.rightMargin: 253 visible: false numVertices: 64 radius: 155 fillWidth: 5 color: tachometer.actualRPM < 4000 ? "green" : "#EF2973" opacity: 0.6 minAngle: tachometer.minValueAngle maxAngle: tachometer.maxValueAngle minValue: tachometer.minimumRPM maxValue: tachometer.maximumRPM } } Item { id: tachometerNeedle width: 312 height: 7 rotation: rpmFiller.angle - 35 x: 854 y: 242 Image { opacity: 0.75 width: 98 height: 7 anchors.left: parent.left anchors.leftMargin: 2 anchors.verticalCenter: parent.verticalCenter source: tachometer.actualRPM < 4000 ? "image://etc/SpeedometerNeedleGreen.png" : "image://etc/SpeedometerNeedle.png" } } Text { id: textEco anchors.top: tachometerNeedle.top anchors.topMargin: -7 anchors.horizontalCenter: tachometerNeedle.horizontalCenter text: tachometer.actualRPM > 4000 ? "POWER" : "ECO" font.pixelSize: 18 color: tachometer.actualRPM <= 4000 ? "white" : "red" } }