简体   繁体   中英

Get mouse position in a QImage

I need to get the coordinates of a QImage of where the mouse is currently hovering. Like in image editing programs, where we can see the coordinates of the pixel the mouse in currently hovering.

Call setMouseTracking(true) , and override mouseMoveEvent . Your mouseMoveEvent function will be called whenever the mouse moves inside the QImage. (You have to create a subclass of QImage to do this.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM