##// END OF EJS Templates
Documented QML oscilloscope
Tero Ahola -
r1825:3f96a0e4b951
parent child
Show More
1 NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,27
1 /*!
2 \example demos/qmloscilloscope
3 \title Oscilloscope
4
5 \image demos_qmloscilloscope.png
6
7 Oscilloscope application demonstrates how to use QtCommercial Charts QML api to implement an
8 application with strict performance requirements. The application uses generated data with
9 configurable characteristics to mimic a simple oscilloscope user interface. To find out the
10 actual screen refresh performance of the application, you can set QML_SHOW_FRAMERATE = 1 to
11 your run environment settings to get the framerate shown in the application output console.
12 I.e. go to Projects - Run - Run environment in Qt Creator and select Add. Then you can
13 experiment with the different configurable options of the demo application to find the
14 configuration that gives you the best performance in your environment.
15
16 The application window is shared by control and scope views:
17 \snippet ../demos/qmloscilloscope/qml/qmloscilloscope/main.qml 1
18 \snippet ../demos/qmloscilloscope/qml/qmloscilloscope/main.qml 2
19
20 ControlView implements the buttons used for configuring. ScopeView uses a ChartView to show
21 a chart with two line series:
22 \snippet ../demos/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml 1
23
24 The data of the line series is updated with a QML timer. In a real life application the
25 updating could triggered with a signal from Qt C++ code.
26 \snippet ../demos/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml 2
27 */
@@ -21,14 +21,21
21 21 import QtQuick 1.0
22 22 import QtCommercial.Chart 1.0
23 23
24 //![1]
24 25 ChartView {
25 26 id: chartView
26 27 animationOptions: ChartView.NoAnimation
27 28
28 29 ValueAxis {
29 id: axisY
30 id: axisY1
30 31 min: -1
31 max: 3
32 max: 4
33 }
34
35 ValueAxis {
36 id: axisY2
37 min: -10
38 max: 5
32 39 }
33 40
34 41 ValueAxis {
@@ -41,15 +48,18 ChartView {
41 48 id: lineSeries1
42 49 name: "signal 1"
43 50 axisX: axisX
44 axisY: axisY
51 axisY: axisY1
45 52 }
46 53 LineSeries {
47 54 id: lineSeries2
48 55 name: "signal 2"
49 56 axisX: axisX
50 axisY: axisY
57 axisY: axisY2
51 58 }
59 // ...
60 //![1]
52 61
62 //![2]
53 63 Timer {
54 64 id: refreshTimer
55 65 interval: 1 / 60 * 1000 // 60 Hz
@@ -60,6 +70,7 ChartView {
60 70 dataSource.update(chartView.series(1));
61 71 }
62 72 }
73 //![2]
63 74
64 75 function changeSeriesType(type) {
65 76 chartView.series(1).destroy();
@@ -20,6 +20,7
20 20
21 21 import QtQuick 1.0
22 22
23 //![1]
23 24 Rectangle {
24 25 id: main
25 26 width: 400
@@ -32,6 +33,8 Rectangle {
32 33 anchors.bottom: parent.bottom
33 34 anchors.left: parent.left
34 35 anchors.leftMargin: 10
36 // ...
37 //![1]
35 38
36 39 onSignalSourceChanged: {
37 40 if (source == "sin")
@@ -45,6 +48,7 Rectangle {
45 48 onRefreshRateChanged: scopeView.changeRefreshRate(rate);
46 49 }
47 50
51 //![2]
48 52 ScopeView {
49 53 id: scopeView
50 54 anchors.top: parent.top
@@ -53,4 +57,5 Rectangle {
53 57 anchors.left: controlPanel.right
54 58 height: main.height
55 59 }
60 //![2]
56 61 }
@@ -21,6 +21,7
21 21 <li><a href="demos-qmlweather.html">Qml Weather</a></li>
22 22 <li><a href="demos-qmlf1legends.html">Qml F1 Legends</a></li>
23 23 <li><a href="demos-qmlcustommodel.html">Qml Custom Model</a></li>
24 <li><a href="demos-qmloscilloscope.html">Qml Oscilloscope</a></li>
24 25 </ul>
25 26 </td>
26 27 </tr>
General Comments 0
You need to be logged in to leave comments. Login now