def mouseMoveEvent(self, event: QtGui.QMouseEvent): if (event.buttons() & QtGui.Qt.MiddleButton and (not(event.modifiers() & QtGui.Qt.ShiftModifier))) or event.buttons() & QtCore.Qt.LeftButton: self.stopViewAnimation() self.m_yRot = self.normalizeAngle(self.m_yLastRot - (event.pos().x() - self.m_lastPos.x()) * 0.5) self.m_xRot = self.m_xLastRot + (event.pos().y() - self.m_lastPos.y()) * 0.5 if self.m_xRot < -90: self.m_xRot = -90 if self.m_xRot > 90: self.m_xRot = 90 self.updateView() self.rotationChanged.emit() if (event.buttons() & QtCore.Qt.MiddleButton and event.modifiers() & QtGui.Qt.ShiftModifier) or event.buttons() & QtCore.Qt.RightButton: self.m_xPan = self.m_xLastPan - (event.pos().x() - self.m_lastPos.x()) * 1 / (float)(self.width()) self.m_yPan = self.m_yLastPan + (event.pos().y() - self.m_lastPos.y()) * 1 / (float)(self.height()) self.updateProjection()
def mousePressEvent(self, event: QtGui.QMouseEvent) -> None: # cprint("mouse press detected", self._text) # if self has no PC or ctrl is pressed : if self.pcs.is_empty() or event.modifiers() == Qt.ControlModifier: # pb create PC ( anchored end = self, loose end = pouse pos) self.parent().createPC(self) self.hasPcGrabbed = True elif not self.pcs.is_empty(): # elif self has a pc, disconnect it from self pc = self.pcs.last() self.pcs.remove(pc) self.parent().movePC(pc, self) self.hasPcGrabbed = True
def mousePressEvent(self, event: QMouseEvent) -> None: if event.button() == Qt.LeftButton: # TODO handle click on label, etc offset = self.xy_to_offset(event.x(), event.y()) if offset is not None: ctrl = event.modifiers( ) & Qt.ControlModifier == Qt.ControlModifier shift = event.modifiers( ) & Qt.ShiftModifier == Qt.ShiftModifier if ctrl: # Go to pointer self.signal_go_to_pointer_at_offset.emit(offset) return if shift: # Move selection instead of cursor self.signal_selection_updated.emit(offset) self.is_dragging_to_select = True return self.signal_cursor_changed.emit(offset) self.is_dragging_to_select = True