Important: Please read the Qt Code of Conduct -

QMouseEvent::localPos() on Retina display

  • I use Qt 5.12 on Macos in a Python application via PySide2.

    My users must be able to define points on a picture.

    On Retina, and likely other high dpi displays, the QMouseEvent::localPos() returns the position as float type, but the digits after the decimal point are all zero. This means that I can not distinguish neighboring mouse locations.

    I can see how the mouse moves on the screen, but I get the same numerical values for neighboring mouse locations from QMouseEvent::localPos().

    How can I find the accurate mouse position?

Log in to reply