From 6a4cae4e249d8a8546fffb65ad2f6ca1d4047145 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Thu, 2 Mar 2023 13:22:57 +0100 Subject: [PATCH] Add display fps in debug mode --- ScreenPlayWallpaper/qml/Wallpaper.qml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/ScreenPlayWallpaper/qml/Wallpaper.qml b/ScreenPlayWallpaper/qml/Wallpaper.qml index cb39d6c3..8572d2f0 100644 --- a/ScreenPlayWallpaper/qml/Wallpaper.qml +++ b/ScreenPlayWallpaper/qml/Wallpaper.qml @@ -282,13 +282,24 @@ Rectangle { ] } + + FrameAnimation { + id: frameAnimation + property real fps: smoothFrameTime > 0 ? (1.0 / smoothFrameTime) : 0 + readonly property string ft: (1000 * smoothFrameTime).toFixed(1) + readonly property real maxFPS: 24.0 + readonly property real maxPeriod: 1.0 / maxFPS + readonly property int skipFrames: fps / maxFPS + running: Wallpaper.debugMode + } + Pane { id: debug visible: Wallpaper.debugMode enabled: Wallpaper.debugMode - width: parent.width * 0.3 - height: parent.height * 0.3 + width: parent.width * 0.6 + height: parent.height * 0.5 anchors.centerIn: parent Column { @@ -296,6 +307,14 @@ Rectangle { anchors.margins: 20 spacing: 10 + Text { + visible: Wallpaper.debugMode + enabled: Wallpaper.debugMode + font.pointSize: 14 + text: "fps: " + frameAnimation.fps.toFixed(0) + " - Frame time:"+ frameAnimation.ft + " ms" + } + + Text { text: "appID " + Wallpaper.appID font.pointSize: 14