Hello,
I'm writing an application that uses Qwt 5.2.1 and uses QwtPlot in a QGraphicsView widget. I have a QwtPlotCurve and 1 or two QwtPlotMarker as horizontal lines. I'm trying to add vertical markers as an array of QwtPlotMarker. The first time I add them it works OK:
1..jpg
When I select new points for the markers, I would like remove the old ones but they remain on the plot:
2..jpg
here is the code:
//////// Draw Vertical Markers
void ThresholdDataPlot:rawXMarkers(QList<double> *l)
{
double y;
MarkersX = l;
nXMarkers = MarkersX->count();
VMarks = new QwtPlotMarker *[nXMarkers];
QPen p(Qt::blue);
for(int i = 0; i < nXMarkers; i++)
{
VMarks[i] = new QwtPlotMarker();
VMarks[i]->setLinePen(p);
VMarks[i]->setLineStyle(QwtPlotMarker::VLine);
y = MarkersX->at(i);
VMarks[i]->setXValue(y);
VMarks[i]->attach(this);
}
replot();
}
void ThresholdDataPlot::CleanXMarkers()
{
if(VMarks == NULL) return;
for(int i = 0; i < nXMarkers; i++)
{
VMarks[i]->hide();
VMarks[i]->detach();
delete VMarks[i];
}
delete [] VMarks;
VMarks = NULL;
replot();
}
Any ideas?
Thanks,
Muz
Bookmarks