How to clear QwtPlot curves before replotting?

SamuelNLP picture SamuelNLP · Mar 13, 2013 · Viewed 8.8k times · Source

In the earlier versions of Qwt we add QwtPlot::clear() but now, I can't find it.

Any ideas? I have a real time plot, so when replotting, the info before xmin is not really important and with time it crashes as the replot is replotting all the information before xmin.

Answer

bruno picture bruno · Mar 13, 2013

The method Qwtplot::clear() has been deprecated. Use QwtPlotDict::detachItems instead.

void QwtPlotDict::detachItems(int rtti = QwtPlotItem::Rtti_PlotItem, 
                              bool autoDelete = true 
                             )

Parameters:

rtti: In case of QwtPlotItem::Rtti_PlotItem detach all items otherwise only those items of the type rtti. autoDelete: If true, delete all detached items