C

Qt Quick Ultralite Motorcycle Cluster Demo

/****************************************************************************** ** ** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Ultralite module. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ******************************************************************************/
import QtQuick Row { id: root visible: QulPerf.enabled property int minFPS: 1000 property int maxFPS: 0 property int avgFPSum: 0 property int avgCounter: 0 property int fps: QulPerf.fps readonly property int minFPSlimit: 1 property real repaint: QulPerf.repaint property real repaintAvgSum: 0 spacing: 10 Timer { id: averageFPStimer interval: 250 running: true repeat: true onTriggered: { root.averageCalc() } } function averageCalc() { root.avgFPSum = root.avgFPSum + root.fps root.avgCounter = root.avgCounter + 1 root.repaintAvgSum = root.repaintAvgSum + root.repaint } PerformanceMetricItem { label: "FPS:" value: QulPerf.fps.toFixed(0) } PerformanceMetricItem { label: "FPSmin:" value: (QulPerf.fps < root.minFPS && QulPerf.fps > root.minFPSlimit ? root.minFPS = QulPerf.fps : root.minFPS).toString() } // PerformanceMetricItem { // label: "FPSmax:" // value: (QulPerf.fps > root.maxFPS ? root.maxFPS = QulPerf.fps : root.maxFPS).toString() // } PerformanceMetricItem { label: "FPSavg:" value: (root.avgFPSum / root.avgCounter).toFixed(0) } PerformanceMetricItem { label: "repaint:" value: root.repaint.toFixed(1) } PerformanceMetricItem { label: "repAvg:" value: (root.repaintAvgSum / root.avgCounter).toFixed(1) } }