[PyKDE] Custom mousePressEvent

Peter Clark peter-clark at bethel.edu
Sat Oct 30 13:44:45 BST 2004

    I'm trying to implement an image map, so that when an image is clicked on, 
the location of the mouse (relative to the image) is returned. That is, 
clicking in the upper lefthand corner of the image should return 0,0. When 
the mousePressEvent is with the dialog window, I don't have any problems 
catching the mouse events. However, what happens is that e.pos() returns the 
mouse position relative to the whole window, so instead of 0,0, I get 14,127. 
But when I try to move the mousePressEvent function off to the mapWidget 
class, it doesn't catch any events.
    Attached is a small example of what I'm trying to do; if anyone has 
suggestions, I would appreciate them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.py
Type: application/x-python
Size: 969 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20041030/23b7539f/test.bin

More information about the PyQt mailing list