Unsolved waveform code getting crashed.
-
Hi
I have used line series to create waveform. I am using two line series one after.
code:
import QtQuick 2.12 import QtQuick.Window 2.12 import QtCharts 2.0 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") property var i: 0 property var j: 0 property var k: 0 property var line1 property var line2 property var points:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,17,17.5,17.8,18,18,18.1,18.15,18,17.5,17,16.5,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1] ChartView { id:myChart title: "Line" anchors.fill: parent antialiasing: true ValueAxis { id: xAxis min: 0 max: 100; } ValueAxis { id: yAxis min: 0 max: 50 } Component.onCompleted: { line1= myChart.createSeries(ChartView.SeriesTypeLine,"series1",xAxis,yAxis) line2= myChart.createSeries(ChartView.SeriesTypeLine,"series2",xAxis,yAxis) } } Timer { interval: 50; running: true; repeat: true onTriggered: { i = i + 1 if(i > 100) { i = 0 k = 0 if(j===0){j = 1;/*myChart.removeSeries(line2);*//*line2 = myChart.createSeries(ChartView.SeriesTypeLine,"series2",xAxis,yAxis);*/} else { j = 0;/*myChart.removeSeries(line1);*//*line1 = myChart.createSeries(ChartView.SeriesTypeLine,"series1",xAxis,yAxis);*/} } if(j===1) { if(k === points.length){k=0} line1.remove(0) line2.append(i,points[k]) k++; } else{ if(k === points.length){k=0} line2.remove(0) line1.append(i,points[k]) k++; } } } }
It runs for some time and gets crashed probably due to append() api.
How can I solve this? -
Do you run the app in Qt creator with debugger?
If not, this would be definitely the next step to try.Also you can use https://doc.qt.io/qt-5/qtquick-debugging.html . The output shall be shown in the Application output pane of creator.
Which OS are you on?
Is the application also compiled for that OS? -
Hi @koahnig
Thanks for help!!
Problem is solvedThis problem was due to remove(0).