Solved QGLWidget/high-dpi: convert mouse position to GL pixels?
-
I'm using QGLWidget and I'm trying to reconcile the unit used by
QGLWidget.resizeGL(w, h)
(which appear to be "hardware" pixels) and the unit used byQMouseEvent.pos()
(which appear to be "logical" pixel. There seem to be a factor of 2 between them. How can I obtain the right factor for my widget? -
Never mind, I just figured it out:
ratio = self.window().devicePixelRatio()