alperyazir
alperyazir

Reputation: 213

Qwt: How to delete all items(curves, markers, etc...) from plot

I want to delete all items from my plot. I found this:

plot->detachItems( QwtPlotItem::Rtti_PlotCurve ,true);
plot->detachItems( QwtPlotItem::Rtti_PlotMarker,true);

But, it does not delete clearly. Somethings remains background. I tried on a example. And memory leaks occurs. How can clear all plot?

Thanks for advices.

Upvotes: 0

Views: 2203

Answers (1)

HeyYO
HeyYO

Reputation: 2073

You should call QwtPlot::replot() after modifying your plot. Add this line after your code:

plot->replot();

Or you can enable auto replot during initialization, QwtPlot::setAutoReplot(true), that way you don't have to call replot every time you change something. On the other hand, if you frequently update your plot, I would advise agains auto replot due to performance reasons. It's better to call replot() explicitly in such case.

Upvotes: 1

Related Questions