Merge pull request #1875 from pijyoi/fix_pyqt6_mouse_event

bug: PyQt6 does not have localPos()
This commit is contained in:
Ogi Moore 2021-07-02 13:26:19 -07:00 committed by GitHub
commit 02909999dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -430,10 +430,11 @@ class GLViewWidget(QtWidgets.QOpenGLWidget):
return xDist / self.width()
def mousePressEvent(self, ev):
self.mousePos = ev.localPos()
lpos = ev.position() if hasattr(ev, 'position') else ev.localPos()
self.mousePos = lpos
def mouseMoveEvent(self, ev):
lpos = ev.localPos()
lpos = ev.position() if hasattr(ev, 'position') else ev.localPos()
diff = lpos - self.mousePos
self.mousePos = lpos