def mouseMoveEvent(self, ev): diff = ev.pos() - self.mousePos1 if self.selectedGrabber is not None and ev.buttons() == QtCore.Qt.LeftButton: self.moveGrabber(-diff.x(), diff.y()) self.mousePos1 = ev.pos() # Ensure mousePos is set here else: GLViewWidget.mouseMoveEvent(self, ev) super(GLViewWidget, self).mouseMoveEvent(ev)
def mouseMoveEvent(self, event): """ The Qt event handler when the mouse is dragged. If a slice plane is selected the slice plane is dragged otherwise the scene is rotated. :param QMouseEvent event: the qt mouse event """ if self._slice_planes.has_selection(): x, y = event.x(), event.y() m = self.viewMatrix() dx = x - self._mouse_pos[0] dy = y - self._mouse_pos[1] vec = QVector4D(dx, -dy, 0, 0) * m dx, dy, dz = vec.x(), vec.y(), vec.z() self._mouse_pos = x, y self._slice_planes.drag(dx, dy, dz) self.slice_changed.emit() else: return GLViewWidget.mouseMoveEvent(self, event)