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