View Full Version : Zoom out with QwtPlotZoomer

28th August 2015, 00:20

I've implemented a Zoomer for a plot and it is working fine, except for the zoom out, that keeps inverting the x-axis when it reaches the zoom base. I mean, I click the mouse right bottom and it zooms out till the zoom base. Then, the next click inverts the x axis: it goes from [0 to 10000] to [10000 to 0]. When I click the right button again, it inverts the x-axis again, going back to [0-10000]

_zoomer = new QwtPlotZoomer(QwtPlot::xBottom, QwtPlot::yLeft, _canvas);
_zoomer->setTrackerMode( QwtPicker::AlwaysOff );
_zoomer->setRubberBand( QwtPicker::RectRubberBand );
_zoomer->setRubberBandPen( QColor( Qt::green ) );
_zoomer->setTrackerMode( QwtPicker::ActiveOnly );
_zoomer->setTrackerPen( QColor( Qt::white ) );
_zoomer->setMousePattern(QwtEventPattern::MouseSelect1,Qt:: LeftButton); //zoom in
_zoomer->setMousePattern( QwtEventPattern::MouseSelect3,Qt::RightButton ); //zoom out by 1
_zoomer->setMousePattern( QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlModifier ); // Ctrl+RightButton: zoom out to full size

Any ideas?