PDA

View Full Version : Is there a way to zoom out on QwtPlot using reverse mouse drag ?



maxpyne
18th October 2013, 12:39
I have attached a QwtPlotZoomer to a QwtPlot and using default mousepatterns in order to zoom in. (mouse drag from upper left to lower right corners to draw a rect).
Is there a way to use reverse mouse drag (drawing rect from lower right to upper left corners) in order to zoom out ?

Thank a lot in advance.

maxpyne
22nd October 2013, 08:38
I would really appreciate any idea on this problem ! Thanks !

Uwe
22nd October 2013, 09:33
QwtPlotZoomer implements a zoom stack, so that you can zoom back to the previous rectangles using key combinations. But of course you can't select rectangles with a rubberband, that are not on the screen.

What about using QwtPlotMagnifier - it can be used together with QwtPlotPanner and QwtPlotZoomer.

Uwe

maxpyne
9th October 2014, 17:56
Few weeks back I found a work around. I could not produce desired behavior using QwtPlotMagnifier / QwtPlotPanner. So, finally I derived MyZoomer from QwtPlotZoomer and overloaded widgetMousePressEvent(QMouseEvent* e) and widgetMouseReleaseEvent(QMouseEvent* e) and used QwtPlotZoomer::zoom(QRectF) to define the zoom-out behavior. When user drags a rectangle, I determine the direction of the rectangle and then based on that either zoom-in or zoom-out.