So, my code is like this there:
qDebug()<< "Lower bound before detach: " << this->axisScaleDiv(0).lowerBound() << " Upper bound before detach: " << this->axisScaleDiv(0).upperBound();
curves[signalID]->detach();
this->updateAxes();
qDebug()<< "Lower bound after detach: " << this->axisScaleDiv(0).lowerBound() << " Upper bound after detach: " << this->axisScaleDiv(0).upperBound();
qDebug()<< "Lower bound before detach: " << this->axisScaleDiv(0).lowerBound() << " Upper bound before detach: " << this->axisScaleDiv(0).upperBound();
curves[signalID]->detach();
this->updateAxes();
qDebug()<< "Lower bound after detach: " << this->axisScaleDiv(0).lowerBound() << " Upper bound after detach: " << this->axisScaleDiv(0).upperBound();
To copy to clipboard, switch view to plain text mode
Lower bound before detach: -50 Upper bound before detach: 300
Lower bound after detach: -50 Upper bound after detach: 300
curves is a vector of plot curve pointers, as I can have very large number of these.
And here is algorithm causing that bug:
1. I use my own zoomer class inheriting QwtPlotZoomer, but there is nothing else than overriding mouse event, which actually does nothing at all (pushes event to default).
2. I order my plot to show me two curves like this:
plots.jpg
3. I use zoomer to zoom plot (zoomer is supposed to update it's zoomBase from lower and upper bounds of QwtPlot->axisScaleDiv every time new curve is added and axes are updated, and it does that).
4. I click RMB to get back to previous state.
5. Now I want to hide one of the curves again so I click my checkbox meaning, that I want this curve to detach. And it detaches, but scale is not recalculated:
Plot2.jpg
I thought at first, that zoomer is causing it with having old zoomerBase. But even if I set base manually to 0,0,1,1 before detaching nothing changes. Base has no meaning at all because I don't click RMB on plot.
Bug(?) does not appear when I don't use zoomer (it rescales correctly). I can attach and detach any curve and left scale will always rescale itself. If I attach new curve to current plot after going back to zoomBase - it will still recalculate scales (if scale of new curve is bigger than others). It appears ONLY when I detach curve after returning to zoom base. If I click any checkbox again after "bug" appears program will start to behave like zoomer was never used until I do everything above again.
Also if I detach curve while zoomed - return to base works incorrectly (I have to manually return to base before detaching, scale is still wrong, but at least visible as it should be)
Bookmarks