1 | NO CONTENT: new file 100644, binary diff hidden |
|
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 | import QtQuick 1.0 |
|
21 | import QtQuick 1.0 | |
22 | import QtCommercial.Chart 1.0 |
|
22 | import QtCommercial.Chart 1.0 | |
23 |
|
23 | |||
|
24 | //![1] | |||
24 | ChartView { |
|
25 | ChartView { | |
25 | id: chartView |
|
26 | id: chartView | |
26 | animationOptions: ChartView.NoAnimation |
|
27 | animationOptions: ChartView.NoAnimation | |
27 |
|
28 | |||
28 | ValueAxis { |
|
29 | ValueAxis { | |
29 | id: axisY |
|
30 | id: axisY1 | |
30 | min: -1 |
|
31 | min: -1 | |
31 |
max: |
|
32 | max: 4 | |
|
33 | } | |||
|
34 | ||||
|
35 | ValueAxis { | |||
|
36 | id: axisY2 | |||
|
37 | min: -10 | |||
|
38 | max: 5 | |||
32 | } |
|
39 | } | |
33 |
|
40 | |||
34 | ValueAxis { |
|
41 | ValueAxis { | |
@@ -41,15 +48,18 ChartView { | |||||
41 | id: lineSeries1 |
|
48 | id: lineSeries1 | |
42 | name: "signal 1" |
|
49 | name: "signal 1" | |
43 | axisX: axisX |
|
50 | axisX: axisX | |
44 | axisY: axisY |
|
51 | axisY: axisY1 | |
45 | } |
|
52 | } | |
46 | LineSeries { |
|
53 | LineSeries { | |
47 | id: lineSeries2 |
|
54 | id: lineSeries2 | |
48 | name: "signal 2" |
|
55 | name: "signal 2" | |
49 | axisX: axisX |
|
56 | axisX: axisX | |
50 | axisY: axisY |
|
57 | axisY: axisY2 | |
51 | } |
|
58 | } | |
|
59 | // ... | |||
|
60 | //![1] | |||
52 |
|
61 | |||
|
62 | //![2] | |||
53 | Timer { |
|
63 | Timer { | |
54 | id: refreshTimer |
|
64 | id: refreshTimer | |
55 | interval: 1 / 60 * 1000 // 60 Hz |
|
65 | interval: 1 / 60 * 1000 // 60 Hz | |
@@ -60,6 +70,7 ChartView { | |||||
60 | dataSource.update(chartView.series(1)); |
|
70 | dataSource.update(chartView.series(1)); | |
61 | } |
|
71 | } | |
62 | } |
|
72 | } | |
|
73 | //![2] | |||
63 |
|
74 | |||
64 | function changeSeriesType(type) { |
|
75 | function changeSeriesType(type) { | |
65 | chartView.series(1).destroy(); |
|
76 | chartView.series(1).destroy(); |
@@ -20,6 +20,7 | |||||
20 |
|
20 | |||
21 | import QtQuick 1.0 |
|
21 | import QtQuick 1.0 | |
22 |
|
22 | |||
|
23 | //![1] | |||
23 | Rectangle { |
|
24 | Rectangle { | |
24 | id: main |
|
25 | id: main | |
25 | width: 400 |
|
26 | width: 400 | |
@@ -32,6 +33,8 Rectangle { | |||||
32 | anchors.bottom: parent.bottom |
|
33 | anchors.bottom: parent.bottom | |
33 | anchors.left: parent.left |
|
34 | anchors.left: parent.left | |
34 | anchors.leftMargin: 10 |
|
35 | anchors.leftMargin: 10 | |
|
36 | // ... | |||
|
37 | //![1] | |||
35 |
|
38 | |||
36 | onSignalSourceChanged: { |
|
39 | onSignalSourceChanged: { | |
37 | if (source == "sin") |
|
40 | if (source == "sin") | |
@@ -45,6 +48,7 Rectangle { | |||||
45 | onRefreshRateChanged: scopeView.changeRefreshRate(rate); |
|
48 | onRefreshRateChanged: scopeView.changeRefreshRate(rate); | |
46 | } |
|
49 | } | |
47 |
|
50 | |||
|
51 | //![2] | |||
48 | ScopeView { |
|
52 | ScopeView { | |
49 | id: scopeView |
|
53 | id: scopeView | |
50 | anchors.top: parent.top |
|
54 | anchors.top: parent.top | |
@@ -53,4 +57,5 Rectangle { | |||||
53 | anchors.left: controlPanel.right |
|
57 | anchors.left: controlPanel.right | |
54 | height: main.height |
|
58 | height: main.height | |
55 | } |
|
59 | } | |
|
60 | //![2] | |||
56 | } |
|
61 | } |
@@ -21,6 +21,7 | |||||
21 | <li><a href="demos-qmlweather.html">Qml Weather</a></li> |
|
21 | <li><a href="demos-qmlweather.html">Qml Weather</a></li> | |
22 | <li><a href="demos-qmlf1legends.html">Qml F1 Legends</a></li> |
|
22 | <li><a href="demos-qmlf1legends.html">Qml F1 Legends</a></li> | |
23 | <li><a href="demos-qmlcustommodel.html">Qml Custom Model</a></li> |
|
23 | <li><a href="demos-qmlcustommodel.html">Qml Custom Model</a></li> | |
|
24 | <li><a href="demos-qmloscilloscope.html">Qml Oscilloscope</a></li> | |||
24 | </ul> |
|
25 | </ul> | |
25 | </td> |
|
26 | </td> | |
26 | </tr> |
|
27 | </tr> |
General Comments 0
You need to be logged in to leave comments.
Login now