def mousePressEvent(self, ev: QtGui.QMouseEvent) -> None: # if mouse on handle : grab and move it # else : move handle to the correct pos # print("cursor on bar :", self.barRect.contains(ev.pos())) if self.barRect.contains(ev.pos()): pos = self.getMousePositionInSteps(ev.pos()) self.setValue(pos)
def mousePressEvent(self, event: QMouseEvent): # pylint: disable=invalid-name """Mouse event handler; begins a crop action""" self.mouse_down = True self.mouse_pos = self.mapToScene(event.pos()).toPoint() if self.crop_btn.isChecked() or self.annotation: self.crop_rect.setTopLeft(self.mapToScene(event.pos()).toPoint()) self.scene().addItem(self.g_rect) if self.annotation: self.g_rect.setPen(QPen(Qt.magenta, 1, Qt.SolidLine)) self.g_rect.setBrush(QBrush(Qt.magenta, Qt.Dense4Pattern)) elif self.hasMouseTracking() and self.g_rect.isUnderMouse: self.adjustment = self.edge(event.pos)[1] else: QGraphicsView.mousePressEvent(self, event)
def mouseReleaseEvent(self, event: QtGui.QMouseEvent): if event.button() == QtCore.Qt.MouseButton.MiddleButton: index = self.indexAt(event.pos()) model = index.model() if model: self.middle_clicked.emit(index) return super().mouseReleaseEvent(event)
def mouseReleaseEvent(self, me: QtGui.QMouseEvent) -> None: if distance(me.pos(), self.center) < self.radius: if not self.doubleClick: # print("mouse event type = ", me.flags == QtCore.Qt.MouseEventCreatedDoubleClick) super(Knob, self).mouseReleaseEvent(me) else: self.doubleClick = False else: pass
def mouseMoveEvent(self, event: QtGui.QMouseEvent) -> None: # print("mouse move detected", self._text) if event.buttons() == Qt.LeftButton and self.hasPcGrabbed: # send mouse position to pb # set pc loos end to mouse pos self.parent().moveLastPC(self.mapToParent(event.pos())) else: # set pc to hevered if the mouse in on the pp self.setPcToHoveredIfCursorOnPp(event)
def mouseReleaseEvent(self, event: QMouseEvent): # pylint: disable=invalid-name """Completes the crop rectangle.""" self.mouse_down = False if self.crop_btn.isChecked() | self.annotation: self.crop_rect.setBottomRight( self.mapToScene(event.pos()).toPoint()) self.g_rect.setRect(self.crop_rect) self.setMouseTracking(True) self.crop_btn.setChecked(False) self.annotation = False self.unsetCursor()
def mouseMoveEvent(self, event: QMouseEvent): # pylint: disable=invalid-name """Expand crop rectangle""" if self.crop_btn.isChecked() | self.annotation and self.mouse_down: self.crop_rect.setBottomRight( self.mapToScene(event.pos()).toPoint()) self.g_rect.setRect(self.crop_rect) if self.hasMouseTracking(): self.setCursor((Qt.ArrowCursor, self.edge( event.pos)[0])[self.is_under_mouse(self.g_rect.rect())]) if self.mouse_down: self.move_rect(event.pos)
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): self.m_lastPos = event.pos() self.m_xLastRot = self.m_xRot self.m_yLastRot = self.m_yRot self.m_xLastPan = self.m_xPan self.m_yLastPan = self.m_yPan
def mousePressEvent(self, e: QtGui.QMouseEvent) -> None: if (distance(self.center, e.pos()) < self.radius) or self.textRect.contains(e.pos()): self.setChecked(True)
def mouseMoveEvent(self, event: QMouseEvent) -> None: self.hoverIndexRow = self.indexAt(event.pos()).row() return super().mouseMoveEvent(event)
def mousePressEvent(self, me: QtGui.QMouseEvent) -> None: if distance(me.pos(), self.center) < self.radius: super(Knob, self).mousePressEvent(me) else: pass
def mouseReleaseEvent(self, event: QtGui.QMouseEvent) -> None: if self.hasPcGrabbed: # cprint("mouse release detected", self._text) # send mouse release to pb self.hasPcGrabbed = False self.parent().findReleasePp(self.mapToParent(event.pos()))
def mouseMoveEvent(event: QMouseEvent) -> None: self.files.hoverIndexRow = self.files.indexAt(event.pos()).row() _mouseMoveEvent(event)