##// END OF EJS Templates
Made Qml Oscilloscope example little more sensible...
Miikka Heikkinen -
r2832:faab188cb2e7
parent child
Show More
@@ -21,6 +21,7 import QtQuick.Layouts 1.0
21 21
22 22 ColumnLayout {
23 23 property alias openGLButton: openGLButton
24 property alias antialiasButton: antialiasButton
24 25 spacing: 8
25 26 Layout.fillHeight: true
26 27 signal animationsEnabled(bool enabled)
@@ -40,13 +41,13 ColumnLayout {
40 41 id: openGLButton
41 42 text: "OpenGL: "
42 43 items: ["false", "true"]
43 currentSelection: 0
44 currentSelection: 1
44 45 onSelectionChanged: openGlChanged(currentSelection == 1);
45 46 }
46 47
47 48 MultiButton {
48 49 text: "Graph: "
49 items: ["line", "spline", "scatter"]
50 items: ["line", "scatter"]
50 51 currentSelection: 0
51 52 onSelectionChanged: seriesTypeChanged(items[currentSelection]);
52 53 }
@@ -81,15 +82,10 ColumnLayout {
81 82 }
82 83
83 84 MultiButton {
84 text: "Animations: "
85 items: ["OFF", "ON"]
86 currentSelection: 0
87 onSelectionChanged: animationsEnabled(currentSelection == 1);
88 }
89
90 MultiButton {
85 id: antialiasButton
91 86 text: "Antialias: "
92 87 items: ["OFF", "ON"]
88 enabled: false
93 89 currentSelection: 0
94 90 onSelectionChanged: antialiasingEnabled(currentSelection == 1);
95 91 }
@@ -24,7 +24,7 ChartView {
24 24 id: chartView
25 25 animationOptions: ChartView.NoAnimation
26 26 theme: ChartView.ChartThemeDark
27 property bool openGL: false
27 property bool openGL: true
28 28 onOpenGLChanged: {
29 29 series("signal 1").useOpenGL = openGL;
30 30 series("signal 2").useOpenGL = openGL;
@@ -92,19 +92,16 ChartView {
92 92 var series2 = chartView.createSeries(ChartView.SeriesTypeLine, "signal 2",
93 93 axisX, axisY2);
94 94 series2.useOpenGL = chartView.openGL
95 } else if (type == "spline") {
96 chartView.createSeries(ChartView.SeriesTypeSpline, "signal 1", axisX, axisY1);
97 chartView.createSeries(ChartView.SeriesTypeSpline, "signal 2", axisX, axisY2);
98 95 } else {
99 96 var series1 = chartView.createSeries(ChartView.SeriesTypeScatter, "signal 1",
100 97 axisX, axisY1);
101 series1.markerSize = 3;
98 series1.markerSize = 2;
102 99 series1.borderColor = "transparent";
103 100 series1.useOpenGL = chartView.openGL
104 101
105 102 var series2 = chartView.createSeries(ChartView.SeriesTypeScatter, "signal 2",
106 103 axisX, axisY2);
107 series2.markerSize = 3;
104 series2.markerSize = 2;
108 105 series2.borderColor = "transparent";
109 106 series2.useOpenGL = chartView.openGL
110 107 }
@@ -41,20 +41,14 Rectangle {
41 41 dataSource.generateData(1, signalCount, sampleCount);
42 42 scopeView.axisX().max = sampleCount;
43 43 }
44 onAnimationsEnabled: scopeView.setAnimations(enabled);
45 onSeriesTypeChanged: {
46 scopeView.changeSeriesType(type);
47 if (type === "spline") {
48 controlPanel.openGLButton.currentSelection = 0;
49 controlPanel.openGLButton.enabled = false;
50 scopeView.openGL = false;
51 } else {
52 controlPanel.openGLButton.enabled = true;
53 }
54 }
44 onSeriesTypeChanged: scopeView.changeSeriesType(type);
55 45 onRefreshRateChanged: scopeView.changeRefreshRate(rate);
56 46 onAntialiasingEnabled: scopeView.antialiasing = enabled;
57 onOpenGlChanged: scopeView.openGL = enabled;
47 onOpenGlChanged: {
48 scopeView.openGL = enabled;
49 antialiasButton.enabled = !enabled;
50 antialiasButton.currentSelection = 0;
51 }
58 52 }
59 53
60 54 //![2]
@@ -18,7 +18,7
18 18
19 19 /*!
20 20 \example qmloscilloscope
21 \title QML Oscilloscope
21 \title Qml Oscilloscope
22 22 \ingroup qtcharts_examples
23 23
24 24 \image examples_qmloscilloscope.png
General Comments 0
You need to be logged in to leave comments. Login now