From faab188cb2e7188ae47ea0ece4b451d503fbe5cf 2015-09-30 07:45:08 From: Miikka Heikkinen Date: 2015-09-30 07:45:08 Subject: [PATCH] Made Qml Oscilloscope example little more sensible Removed spline and animations as the point of the example is to demonstrate high refresh rate use case. Also now default to useOpenGL. Change-Id: Iaf43bd8789893a9ed9bc409038e7d22d1bd7185d Reviewed-by: Titta Heikkala --- diff --git a/examples/charts/qmloscilloscope/qml/qmloscilloscope/ControlPanel.qml b/examples/charts/qmloscilloscope/qml/qmloscilloscope/ControlPanel.qml index ddde632..4f84b39 100644 --- a/examples/charts/qmloscilloscope/qml/qmloscilloscope/ControlPanel.qml +++ b/examples/charts/qmloscilloscope/qml/qmloscilloscope/ControlPanel.qml @@ -21,6 +21,7 @@ import QtQuick.Layouts 1.0 ColumnLayout { property alias openGLButton: openGLButton + property alias antialiasButton: antialiasButton spacing: 8 Layout.fillHeight: true signal animationsEnabled(bool enabled) @@ -40,13 +41,13 @@ ColumnLayout { id: openGLButton text: "OpenGL: " items: ["false", "true"] - currentSelection: 0 + currentSelection: 1 onSelectionChanged: openGlChanged(currentSelection == 1); } MultiButton { text: "Graph: " - items: ["line", "spline", "scatter"] + items: ["line", "scatter"] currentSelection: 0 onSelectionChanged: seriesTypeChanged(items[currentSelection]); } @@ -81,15 +82,10 @@ ColumnLayout { } MultiButton { - text: "Animations: " - items: ["OFF", "ON"] - currentSelection: 0 - onSelectionChanged: animationsEnabled(currentSelection == 1); - } - - MultiButton { + id: antialiasButton text: "Antialias: " items: ["OFF", "ON"] + enabled: false currentSelection: 0 onSelectionChanged: antialiasingEnabled(currentSelection == 1); } diff --git a/examples/charts/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml b/examples/charts/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml index 443e515..ad432b2 100644 --- a/examples/charts/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml +++ b/examples/charts/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml @@ -24,7 +24,7 @@ ChartView { id: chartView animationOptions: ChartView.NoAnimation theme: ChartView.ChartThemeDark - property bool openGL: false + property bool openGL: true onOpenGLChanged: { series("signal 1").useOpenGL = openGL; series("signal 2").useOpenGL = openGL; @@ -92,19 +92,16 @@ ChartView { var series2 = chartView.createSeries(ChartView.SeriesTypeLine, "signal 2", axisX, axisY2); series2.useOpenGL = chartView.openGL - } else if (type == "spline") { - chartView.createSeries(ChartView.SeriesTypeSpline, "signal 1", axisX, axisY1); - chartView.createSeries(ChartView.SeriesTypeSpline, "signal 2", axisX, axisY2); } else { var series1 = chartView.createSeries(ChartView.SeriesTypeScatter, "signal 1", axisX, axisY1); - series1.markerSize = 3; + series1.markerSize = 2; series1.borderColor = "transparent"; series1.useOpenGL = chartView.openGL var series2 = chartView.createSeries(ChartView.SeriesTypeScatter, "signal 2", axisX, axisY2); - series2.markerSize = 3; + series2.markerSize = 2; series2.borderColor = "transparent"; series2.useOpenGL = chartView.openGL } diff --git a/examples/charts/qmloscilloscope/qml/qmloscilloscope/main.qml b/examples/charts/qmloscilloscope/qml/qmloscilloscope/main.qml index 5340177..219b89f 100644 --- a/examples/charts/qmloscilloscope/qml/qmloscilloscope/main.qml +++ b/examples/charts/qmloscilloscope/qml/qmloscilloscope/main.qml @@ -41,20 +41,14 @@ Rectangle { dataSource.generateData(1, signalCount, sampleCount); scopeView.axisX().max = sampleCount; } - onAnimationsEnabled: scopeView.setAnimations(enabled); - onSeriesTypeChanged: { - scopeView.changeSeriesType(type); - if (type === "spline") { - controlPanel.openGLButton.currentSelection = 0; - controlPanel.openGLButton.enabled = false; - scopeView.openGL = false; - } else { - controlPanel.openGLButton.enabled = true; - } - } + onSeriesTypeChanged: scopeView.changeSeriesType(type); onRefreshRateChanged: scopeView.changeRefreshRate(rate); onAntialiasingEnabled: scopeView.antialiasing = enabled; - onOpenGlChanged: scopeView.openGL = enabled; + onOpenGlChanged: { + scopeView.openGL = enabled; + antialiasButton.enabled = !enabled; + antialiasButton.currentSelection = 0; + } } //![2] diff --git a/src/charts/doc/src/examples-qmloscilloscope.qdoc b/src/charts/doc/src/examples-qmloscilloscope.qdoc index 5292d46..4c5abfd 100644 --- a/src/charts/doc/src/examples-qmloscilloscope.qdoc +++ b/src/charts/doc/src/examples-qmloscilloscope.qdoc @@ -18,7 +18,7 @@ /*! \example qmloscilloscope - \title QML Oscilloscope + \title Qml Oscilloscope \ingroup qtcharts_examples \image examples_qmloscilloscope.png