1、显示每秒传输的帧数和6秒平均传输的帧数,并显示
import QtQuick 2.15
Item {
id:root
property int frameCounter:0 //帧的数量
property int frameCounterAvg:0//帧的平均值
property int counter:0//数量
property int fps:0//每秒传输的帧数
property int fpsAvg:0//平均fps
Image{
id:spinnerImage
anchors.verticalCenter: parent.verticalCenter//水平中心
visible: true
source:""
NumberAnimation on rotation{
from:0
to:360
duration:800
loops:Animation.Infinite //一直循环
}
onRotationChanged: {
frameCounter++
}
}
Text{
anchors.verticalCenter: root.verticalCenter
color:"#c0c0c0"
text:"$ " + root.fpsAvg + " | " + root.fps + " fps"
}
Timer{
interval: 2000
repeat: true
running: true
onTriggered: {
root.fps = frameCoun