void Plot::removeCurve(int index) { QwtPlotItem *c = d_curves[index]; if (!c) return; if (c->rtti() == QwtPlotItem::Rtti_PlotSpectrogram) { Spectrogram *sp = (Spectrogram *)c; QwtScaleWidget *colorAxis = axisWidget(sp->colorScaleAxis()); if (colorAxis) colorAxis->setColorBarEnabled(false); } c->detach(); QwtPlotItem* p = d_curves.take (index); // RNT: Making curve_key unique prevents clashes elsewhere //--curve_key; // MG: This is a rather crude but effective way of delaying the // deletion of the curve objects. This is necessary because in // a tight loop a curve may not have been completely removed // but the object has been deleted. Detacher *detacher = new Detacher(p); detacher->deleteLater(); }
void Plot::removeCurve(int index) { QwtPlotItem *c = d_curves[index]; if (!c) return; if (c->rtti() == QwtPlotItem::Rtti_PlotSpectrogram) { Spectrogram *sp = (Spectrogram *)c; QwtScaleWidget *colorAxis = axisWidget(sp->colorScaleAxis()); if (colorAxis) colorAxis->setColorBarEnabled(false); } c->detach(); d_curves.remove (index); }