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: consumtionMeter
    property real consumptionValue: 2.0 + ValueSource.rpm / 444.45

    property real minValueAngle: 378
    property real maxValueAngle: 291
    property real minimumValue: 0
    property real maximumValue: 20

    GaugeFiller {
        id: consumptionFiller
        value: consumtionMeter.consumptionValue
        anchors.fill: parent
        visible: false
        numVertices: 32
        radius: 155
        fillWidth: 20
        color: ValueSource.rpm < 4000 ? "#0098c3" : "#a31e21"
        opacity: 0.3
        minAngle: consumtionMeter.minValueAngle
        maxAngle: consumtionMeter.maxValueAngle
        minValue: consumtionMeter.minimumValue
        maxValue: consumtionMeter.maximumValue
        Behavior on value {
            enabled: !ValueSource.runningInDesigner && !ValueSource.automaticDemoMode && startupAnimationsFinished
            PropertyAnimation { duration: 250 }
        }
    }

    Item {
        width: 322
        height: 7
        rotation: consumptionFiller.angle - 72
        anchors.centerIn: parent

        Image {
            //opacity: 0.75
            anchors.left: parent.left
            anchors.verticalCenter: parent.verticalCenter
            source: "image://etc/gaugeNeedleBig.png"
                //ValueSource.rpm < 4000 ? "image://etc/SpeedometerNeedleGreen.png" : "image://etc/SpeedometerNeedle.png"
        }
    }
}