How to get coordinates of mouse click on the widget?
-
Here is an "example":http://doc.qt.nokia.com/4.7/widgets-scribble.html using mousepressevent.
-
Kxyu: I've also been looking at the documentation for mousePressEvent in the QWidget documentation, but it doesn't mention anything about mouse coorinates. Just saying that "it’s too easy" doesn't really help, it just declares the other person an idiot.
Eddy: Thanks for the link, but it seems broken. Do you think you could update it or post a new one?
Edit: Found the answer:
@
// Extract the coordinates from the QMouseEvent object
int x = event->x();
int y = event->y();
@