The program has unexpectedly finished
-
I add a button for clear series from my chart. So after series deleted, i can add new points on series.
I have
void Widget::on_clearChart_clicked() { chart->removeAllSeries(); }
But when i clicked button, and then, clicked my items on table widget for adding series, the program has unexpectedly finished.
-
@suslucoder said in The program has unexpectedly finished:
the program has unexpectedly finished
First thing to do in such situation is to use debugger. So, please do so and see what exactly happens and where your app crashes.
Is "chart" a valid pointer? -
@suslucoder said in The program has unexpectedly finished:
I did debug, it gives me the sıgnsev error
And how does the stack trace look like? Post it here.
-
@suslucoder I did it like that it works without any problem but what is the difference between remove all series and remove them one by one
chart->removeSeries(seri[0]); chart->removeSeries(seri[1]); chart->removeSeries(seri[2]); chart->removeSeries(seri[3]); chart->removeSeries(seri[4]); chart->removeSeries(seri[5]); chart->removeSeries(seri[6]); chart->removeSeries(seri[7]);
-
@suslucoder said in The program has unexpectedly finished:
what is the difference between remove all series and remove them one by one
void QChart::removeAllSeries()
Removes and deletes all series objects that have been added to the chart.
(https://doc.qt.io/qt-5/qchart.html#removeAllSeries)
While
void QChart::removeSeries(QAbstractSeries *series)
Removes the series series from the chart. The chart releases the ownership of the specified series object.
(https://doc.qt.io/qt-5/qchart.html#removeSeries)
I guess you are trying to double-delete the series pointers.