def wheelEvent(self, ev: QtGui.QWheelEvent): if not self.pixmap(): return mods = ev.modifiers() delta = ev.angleDelta() up = delta.y() > 0 if int(mods) == QtCore.Qt.ControlModifier: scale = self.scale * 1.1 if up else self.scale * 0.9 self.zoomChanged.emit(scale) else: curIdx = self.sliceIndex() v = curIdx - 1 if up else curIdx + 1 self._slider.setValue(v)
def __cloneMouseWheelEvent(self, e: QWheelEvent): pos = e.pos() globalPos = e.globalPos() pixelDelta = e.pixelDelta() angleDelta = e.angleDelta() buttons = e.buttons() modifiers = e.modifiers() phase = e.phase() inverted = e.inverted() clone = QWheelEvent(pos, globalPos, pixelDelta, angleDelta, buttons, modifiers, phase, inverted) clone.ignore() clone.accepted = False return clone
def wheelEvent(self, event: QtGui.QWheelEvent) -> None: cpt = QPoint_to_point(event.pos()) if not event.modifiers(): step = event.angleDelta().y() / 120.0 self.zoom(step, cpt) else: if self.interactionDelegate: step = event.angleDelta().y() / 120.0 if step < 0: step = - step code = EventID.Mouse_WheelDown else: code = EventID.Mouse_WheelUp w_pt = self.viewState.tfV2W(cpt) tool_event = ToolActionEvent(code, cpt, w_pt, step) self.interactionDelegate.tool_event(tool_event) self.update()