thegooglecodearchive / guiqwt

Automatically exported from code.google.com/p/guiqwt
Other
0 stars 0 forks source link

Event gives wrong x-coordiante (from google groups) #23

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1.in the minimal example attached I get a wrong x value, the y value is right. 
If I position the mouse in the upper left corner of the plot area, the 
event tells me y=0 what is right, but x>0. I have to move the mouse 
to the left of the y-axis tick markers to get x = 0. 

What is the expected output? What do you see instead?

The correct coordinates.

What version of the product are you using? On what operating system?
Python 2.6.5, guiqwt '2.1.4', windows xp 32 bit

Original issue reported on code.google.com by mail.t...@gmx.de on 4 Oct 2011 at 2:46

Attachments:

GoogleCodeExporter commented 9 years ago
This is normal behavior of Qt events : because the event you get from Qt 
contains the mouse position relative to the parent widget (which include the 
axes: try and click on the axis in your script) and not to the plot canvas.

Attached is a modified version of your script which overload SelectTool
which uses guiqwt event mechanism (which itself plugs into Qwt eventfilter 
allowing it to receive events' positions relative to the canvas and not the 
plot).

Since the selecttool already has a behavior for LeftMouse click the tool in the 
attached example is using shift-click instead.

Original comment by laubryc...@free.fr on 7 Oct 2011 at 12:07

Attachments: