PDA

View Full Version : QwtScaleEngine::Inverted has no effect (Qwt 6.1.2)



totem
26th January 2015, 10:48
Hi

I recently upgraded Qwt to 6.1.2 (from 6.1.0).
For one of my QwtPlot-derived class, I tweak the 'yLeft' axis scale engine to be QwtScaleEngine::Inverted. It used to work, but not anymore (i.e. the axis is not inverted).

I tracked down
QwtScaleEngine::Inverted usage in Qwt source code. The flag is tested in
QwtLinearScaleEngine::autoScale(), but unfortunately the method is not called, eventhough I call setAxisAutoScale(yLeft, true) in constructor. I'm not sure why the method is not called. QwtPlot::setAxisScale() seems to disable AutoScale, but is not called until I use magnifier or zoomer for the first time.

Any idea ?

Is QwtScaleEngine::Inverted flag broken ?
Is it possible to have an QwtScaleEngine::Inverted axis with zoomer/magnifier/panner tools ?

Uwe
27th January 2015, 06:30
Is QwtScaleEngine::Inverted flag broken ?
Did a quick check with the simpleplot example: no problems there.


Is it possible to have an QwtScaleEngine::Inverted axis with zoomer/magnifier/panner tools ?
Sure all of them preserve the direction of the scale.

When not using the autoscaler: setAxisScale( yLeft, 0, 10 ) is inverse to setAxisScale( yLeft, 10, 0 ) !

Uwe

totem
28th January 2015, 14:27
I found what caused the problem

When data change, I want my view to fit contents. So I have a MyPlot::resetZoom() method, which used to be like this :


void MyPlot::resetZoom(const QRectF & rect)
{
p_zoomer->zoom(rect);
p_zoomer->setZoomBase(rect);
p_zoomer->zoom(0);
}

and is called like this :


resetZoom(some_curve->boundingRect());

But I never quite understood the zoomer behaviour, and what to call to setup zoom level properly.
I just changed my code to not use a QwtPlotZoomer anymore (but still a magnifier), and modified resetZoom() method :


void MyPlot::resetZoom()
{
setAxisAutoScale(xAxis(), true);
setAxisAutoScale(yAxis(), true);
replot();
}

And it's ok now.

Some day I'll try to better understand all this stuff