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: meter
property real meterNeedleRotation: direction * value * degreesPerValue
//property real fuelValue: ValueSource.fuelLevel
property real value: 20
property real maxValueAngle: 170
property real minValueAngle: 10
property real maximumValue: 100
property real degreesPerValue: Math.abs((maxValueAngle - minValueAngle) / maximumValue)
property real rotationOffset: 80
property real direction: 1
Item {
width: parent.width
height: parent.height
rotation: meter.meterNeedleRotation - meter.rotationOffset
Image {
id: needle
anchors.right: parent.horizontalCenter
anchors.rightMargin: -23
anchors.verticalCenterOffset: 0
anchors.verticalCenter: parent.verticalCenter
source: "image://etc/gaugeNeedleSmall.png"
}
}
Behavior on value {
enabled: !ValueSource.automaticDemoMode && startupAnimationsFinished
PropertyAnimation { duration: 250 }
}
}