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 "../.."

Item {
    id: fpsmeterNeedle

    property real fpsmeterNeedleRotation: fpsValue * fpsDegreesPerValue
    property real fpsValue: Math.min(fpscounter.fpsNow, 60) // Limit to 60, as that's where the gauge ends
    property real maxValueAngle: 314
    property real minValueAngle: 45
    property real maximumValue: 60
    property real fpsDegreesPerValue: Math.abs((maxValueAngle - minValueAngle) / maximumValue)

    anchors.right: parent.right
    anchors.top: parent.top
    anchors.rightMargin: 887
    anchors.topMargin: 125
    width: 161
    height: 10
    rotation: fpsmeterNeedleRotation - 45

    Image {
        anchors.left: parent.left
        anchors.verticalCenterOffset: 0
        anchors.leftMargin: 0
        anchors.verticalCenter: parent.verticalCenter
        source: "image://etc/gaugeNeedleSmall.png"
    }

    FpsCounter {
        id: fpscounter
        rotation: fpsVisible ? -fpsmeterNeedle.rotation : 0
        anchors.top: parent.top
        anchors.topMargin: 50
        anchors.horizontalCenter: parent.horizontalCenter
        fpsVisible: false // Setting this to true prints fps on screen
        running: startupAnimationsFinished
    }
    Behavior on fpsValue {
        enabled: startupAnimationsFinished
        PropertyAnimation { duration: fpscounter.fpsInterval }
    }
}