QwtPlotMagnifier zooming around the mouse pointer
Hello,
I have a qwtPlot with 8 QwtPlotCurve, each one has a QwtPlotMagnifier to perform the zoom in/out on my y axes. I would like to change the behaviour and zoom in and out around my mouse position.
It is working fine now, but when I zoom in it can happen that my curve goes out of the screen and the user needs to scroll to bring it back, and then I wanted to zoom around the mouse position to avoid this kind of behaviour.
Is there any way with QwtPlotMagnifier to do that? I didn't find anything in documentation that make possible to consider mouse position.
I hope someone can help me.
Thanks in advance.
Best Regards.
Re: QwtPlotMagnifier zooming around the mouse pointer
Such a mode is not implemented, but isn't very hard to implement. You could derive from QwtPlotMagnifier overloading the following 2 methods:
widgetWheelEvent to store the mouse position
rescale, where you implement zooming around the mouse poistion
Starting with the code from QwtPlotMagnifier ::rescale should help.
Uwe
Re: QwtPlotMagnifier zooming around the mouse pointer
Hello Uwe,
Thanks a lot. I found a different way of doing. I install an event filter in my axis and I handle the wheel event.
It works fine for a normal zooming in and out, but I didn't find the right calculation to have it around the mouse pointer.
I have the mouse position and everything I need but I didn't figure out yet how to calculate to have the zoom around the pointer.
Can you help me on that? Do you have an example?
Thanks in advance.
Best Regards.
Re: QwtPlotMagnifier zooming around the mouse pointer
Using the maps from QwtPlot::canvasMap() you can translate between widget ( canvas ) and plot coordinates.
Uwe
Using the maps from QwtPlot::canvasMap() you can translate between widget ( canvas ) and plot coordinates.
Uwe