PDA

View Full Version : remove of all QwtPlotCurves



gyre
20th December 2007, 01:25
Hi I was trying to remove all curves from QwtPLot...I did not succed :( (otherwise I wouldnt write here :D )
I thought this would do that for me:

trendPlot->detachItems(QwtPlotItem::Rtti_PlotCurve, true);
I was wrong...so I tried to reimplement detachItems method...but did not succed :(...
Anyone help pls ?
Thanks

Uwe
20th December 2007, 09:32
Guess you simply forgot to call replot() to make your changes happen. You can also enable the autoReplot flag, but this might lead to too many updates.

Uwe

gyre
20th December 2007, 17:53
Guess you simply forgot to call replot() to make your changes happen. You can also enable the autoReplot flag, but this might lead to too many updates.
Uwe

Thanks a lot man...that replot() thing helped...
Can I ask you another question about that QwtPlotZoomer ?
I have reimplemented it as you advised me to:



connect(zoomToolButton, SIGNAL(toggled(bool)), SLOT(enableZoomMode(bool)));

void MainWindow::enableZoomMode(bool on)
{
dataPanner->setEnabled(on);

dataZoomer[0]->setEnabled(on);
dataZoomer[0]->setZoomBase();

dataZoomer[1]->setEnabled(on);
dataZoomer[1]->setZoomBase();

dataPicker->setEnabled(!on);
}

It works just fine...the only SIMPLE problem I suppose is that now when I do some zooming...and then when I toggle the button to "get out/cancel" the zooming the plot does not return to the original state as it was displayed before zooming...
Have any ideas ?
Thanks

Uwe
21st December 2007, 08:58
void MainWindow::enableZoomMode(bool on)
{
...
if ( on ) {
dataZoomer[0]->setEnabled(on)
dataZoomer[0]->setZoomBase();
}
else {
dataZoomer[0]->zoom(0); // zoom out
dataZoomer[0]->setEnabled(on);
}
...
}

Uwe