PDA

View Full Version : Problem with the QwtPlotMagnifier



seguprasad
23rd November 2007, 11:37
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

Uwe
24th November 2007, 09:54
Please post the code, how you intialize your magnifier ?

Uwe

seguprasad
26th November 2007, 06:50
Thanks for your response.

i just created a pointer to QwtPlotMagnifier,
QwtPlotMagnifier * m_ptrzoomIn = new QwtPlotMagnifier(plot()->canvas());
m_ptrzoomIn->setMouseButton(Qt::RightButton,Qt::ControlModifier );

i am able to zoomIn and zoomout but if i release the right button it is coming to the original position.

Uwe
26th November 2007, 09:10
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

seguprasad
27th November 2007, 06:50
I am handling that in MousePressEvent.If i click Ctrl+Right button then i am calling the above code.

Uwe
27th November 2007, 08:41
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

seguprasad
5th December 2007, 10:30
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,

Uwe
5th December 2007, 20:17
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

seguprasad
6th December 2007, 12:11
Thank you for your reply,

Now it is working fine.

Thanks and Regards,