summaryrefslogtreecommitdiffstats
path: root/basicsuite/qt5-cinematicdemo/content/FpsItem.qml
diff options
context:
space:
mode:
Diffstat (limited to 'basicsuite/qt5-cinematicdemo/content/FpsItem.qml')
-rw-r--r--basicsuite/qt5-cinematicdemo/content/FpsItem.qml42
1 files changed, 42 insertions, 0 deletions
diff --git a/basicsuite/qt5-cinematicdemo/content/FpsItem.qml b/basicsuite/qt5-cinematicdemo/content/FpsItem.qml
new file mode 100644
index 0000000..fb66d56
--- /dev/null
+++ b/basicsuite/qt5-cinematicdemo/content/FpsItem.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int frameCounter: 0
+ property int fps: 0;
+
+ width: 160
+ height: 48
+
+ Image {
+ id: spinnerImage
+ source: "images/spinner.png"
+ NumberAnimation on rotation {
+ from:0
+ to: 360
+ duration: 800
+ loops: Animation.Infinite
+ }
+ onRotationChanged: frameCounter++;
+ }
+
+ Text {
+ anchors.right: parent.right
+ anchors.verticalCenter: spinnerImage.verticalCenter
+ color: "#ffffff"
+ style: Text.Outline
+ styleColor: "#606060"
+ font.pixelSize: 28
+ text: root.fps + " fps"
+ }
+
+ Timer {
+ interval: 2000
+ repeat: true
+ running: true
+ onTriggered: {
+ fps = frameCounter/2;
+ frameCounter = 0;
+ }
+ }
+}