PDA

View Full Version : Get mouse position on click?



N3wb
21st August 2010, 02:58
I am drawing an image in my QMainWindow and I need to get the position of the mouse when it's clicked, so that I can tell where on the image the user clicked. Is there an easy way to do this?

Thanks a lot for your help :)

tbscope
21st August 2010, 06:13
Via the mouse press event.
http://doc.qt.nokia.com/4.6/qmouseevent.html

Lykurg
21st August 2010, 23:33
If you have a mouse event use that, otherwise you can also see QCursor::pos().