From 1b5d9a30adc0c9ca4f7929c375db008830586516 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 3 Apr 2014 15:05:27 +0300 Subject: Introduce fps measurement via properties MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTRD-2134 Change-Id: I181ee6c784b998886c2292b7548e16ce75d86458 Reviewed-by: Tomi Korpipää --- .../qmloscilloscope/qml/qmloscilloscope/main.qml | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'examples/datavisualization/qmloscilloscope') diff --git a/examples/datavisualization/qmloscilloscope/qml/qmloscilloscope/main.qml b/examples/datavisualization/qmloscilloscope/qml/qmloscilloscope/main.qml index 5f5bfe1a..1373d4f9 100644 --- a/examples/datavisualization/qmloscilloscope/qml/qmloscilloscope/main.qml +++ b/examples/datavisualization/qmloscilloscope/qml/qmloscilloscope/main.qml @@ -65,6 +65,14 @@ Item { axisX.segmentCount: 4 axisY.segmentCount: 4 axisZ.segmentCount: 4 + measureFps: true + + onCurrentFpsChanged: { + if (fps > 10) + fpsText.text = "FPS: " + Math.round(surfaceGraph.currentFps) + else + fpsText.text = "FPS: " + Math.round(surfaceGraph.currentFps * 10.0) / 10.0 + } //! [0] Surface3DSeries { @@ -202,6 +210,25 @@ Item { } } + Rectangle { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.minimumWidth: fpsText.implicitWidth + 10 + Layout.maximumWidth: fpsText.implicitWidth + 10 + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + + border.color: "gray" + border.width: 1 + radius: 4 + + Text { + id: fpsText + anchors.fill: parent + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + } + } + Rectangle { Layout.fillHeight: true Layout.fillWidth: true -- cgit v1.2.3