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 {
width: 343
height: 343
id: speedometer
property real speedometerNeedleRotation: 0.0
property bool animationStopped: ValueSource.runningInDesigner ? true : startupAnimationsFinished
property real actualValue: 20
property real minValueAngle: 55
property real maxValueAngle: 305
property real minimumValue: 0
property real maximumValue: 200
property real limitValue: 100
property real angleOffset: 35
GaugeFiller {
anchors.fill: parent
anchors.margins: 12
id: speedFiller
value: speedometer.actualValue
numVertices: 64
radius: parent.width/2 - (anchors.margins + 6)
anchors.centerIn: parent
visible: false
fillWidth: 8
color: speedometer.actualValue < speedometer.limitValue ? "#0098c3" : "#a31e21"
opacity: 0.6
minAngle: speedometer.minValueAngle
maxAngle: speedometer.maxValueAngle
minValue: speedometer.minimumValue
maxValue: speedometer.maximumValue
Behavior on color {
ColorAnimation {
duration: 1000
}
}
}
Item {
id: speedometerNeedle
width: 320
height: 48
rotation: speedFiller.angle - speedometer.angleOffset
anchors.centerIn: parent
Item {
id: item1
width: 208
height: 48
anchors.left: parent.left
anchors.leftMargin: -2
anchors.verticalCenter: parent.verticalCenter
Image {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
anchors.top: parent.top
source: "image://etc/gaugeNeedleBig.png"
Behavior on opacity {
NumberAnimation {
duration: 1000
}
}
}
}
}
}