Problem with the QwtPlotMagnifier
Hi All,
I am using QwtPlotMagnifier class to implement zoomIn and zoomOut functionalities for the plot.I am handling the Zooming functionality when the "Control" button and the two mouse buttons are pressed.I am able to ZoomIn the plot but once the mouse buttons are released the plot is coming to the original position.
Can you help me to solve this problem
Re: Problem with the QwtPlotMagnifier
Please post the code, how you intialize your magnifier ?
Uwe
Re: Problem with the QwtPlotMagnifier
Thanks for your response.
i just created a pointer to QwtPlotMagnifier,
QwtPlotMagnifier * m_ptrzoomIn = new QwtPlotMagnifier(plot()->canvas());
m_ptrzoomIn->setMouseButton(Qt::RightButton,Qt::ControlModifie r);
i am able to zoomIn and zoomout but if i release the right button it is coming to the original position.
Re: Problem with the QwtPlotMagnifier
I added your code to the simple example and everything works like expected. Do you have other navigation objects ( f.e. a zoomer, where CTRL + Right means to zoom out ) attached to your plot ?
Uwe
Re: Problem with the QwtPlotMagnifier
I am handling that in MousePressEvent.If i click Ctrl+Right button then i am calling the above code.
Re: Problem with the QwtPlotMagnifier
All navigation objects ( panner, zoomer, magnifier ) filter the events of the plot canvas. You simply create/attach them in the setup of your plot widget and don't do any additional handling of the mouse/key/wheel events. Please move your code to the constructor of your plot widget.
If you create/attach a magnifier inside the mouse press handler of your own event filter the magnifier will miss the press event, and starts with mouse release event ( beside you have activated mouse tracking manually). Looking at the code I would expect, that the magnifier does nothing.
Obviously there is something else in your code that conflicts. Please remove all your own mouse handling code and try again.
Uwe
Re: Problem with the QwtPlotMagnifier
It is working fine when i am disabling the zoomer i.e.,QwtPlotZoomer.If i disable the zoomer class it is working fine.But i need to handle both.How can i rectify this problem
Thanks,
Re: Problem with the QwtPlotMagnifier
Quote:
Originally Posted by
seguprasad
It is working fine when i am disabling the zoomer ...
Didn't I ask explicitely for other navigation objects ?
Anyway, the default configuration of the zoomer uses the left button to zoom in and the right mouse button to zoom out. You have to find a different combination, that doesn't conflict with your left+right button idea. The spectrogram example shows how to change the buttons.
But note, that you will see often (always ?) a left or right mouse button click before you get the left+right click, simply because it's difficult to press both buttons synchronously.
Uwe
Re: Problem with the QwtPlotMagnifier
Thank you for your reply,
Now it is working fine.
Thanks and Regards,