def wheelEvent(self, event: QWheelEvent) -> None: super(_ScriptBrowser, self).wheelEvent(event) if QApplication.keyboardModifiers() != Qt.ControlModifier: return if event.angleDelta().y() > 0: self.zoomIn(1) else: self.zoomOut(1)
def wheelEvent(self, event: QWheelEvent) -> None: dy = event.angleDelta().y() sign = dy / abs(dy) if abs(dy) > 1e-12 else 0.0 smoothness = max(self.viewer.smoothness, 0.1) # Arbitrary number, but dependent on viewer's smoothness rate = 0.4 / smoothness movement_rate = rate / (1.0 + max(0.0, min(sign, rate))) off_center = self.viewer.off_center[2] shift = -sign * movement_rate * max(-sign, off_center) / smoothness self.viewer.translate(x=0, y=0, z=shift)
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 wheelEvent(self, event: QtGui.QWheelEvent): max = self.data.shape[0] theta = event.angleDelta().y() if theta > 0 and self.index < max - 1: self.index += 1 elif theta < 0 and self.index > 0: self.index -= 1 #QUA MOSTRO L'IMMAGINE i-esima -> AGGIUNGERE CHECK DI FINE E INIZIO self.slice = self.index self.update_image()
def wheelEvent(self, event: QWheelEvent): ''' Wheelevent Parameters ---------- event : QWheelEvent ''' event.accept() direction = event.angleDelta().y() horizontal_bar = self.horizontalScrollBar() delta = (20 if direction < 0 else -20) horizontal_bar.setValue(self.horizontalScrollBar().value() + delta)
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()
def wheelEvent(self, event: QWheelEvent) -> None: scale = 1.25 maxZoom = 2 minZoom = 0.5 transform: QTransform = self.transform() zoom = transform.m11() # zoom in and out with the mouse setting origin if (event.angleDelta().y() > 0) and (zoom < maxZoom): self.scale(scale, scale) pos: QPointF = self.mapToScene(event.pos()) self.translate(-(scale - 1) * pos.x(), -(scale - 1) * pos.y()) elif (event.angleDelta().y() < 0) and (zoom > minZoom): self.scale(1 / scale, 1 / scale) pos: QPointF = self.mapToScene(event.pos()) self.translate(-(1 / scale - 1) * pos.x(), -(1 / scale - 1) * pos.y()) event.accept()
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: QWheelEvent): """ wheelEvent Parameters ---------- event : QWheelEvent """ delta = event.angleDelta() if delta.y() == 0: event.ignore() return d = delta.y() / abs(delta.y()) if d > 0.0: self.scale_up() else: self.scale_down()
def wheelEvent(self, event: QWheelEvent): """ wheelEvent Parameters ---------- event : QWheelEvent """ if QApplication.keyboardModifiers() == Qt.ControlModifier: delta = event.angleDelta() if delta.y() == 0: event.ignore() return d = delta.y() / abs(delta.y()) if d > 0.0: self.scale_up() else: self.scale_down() else: super().wheelEvent(event)
def wheelEvent(self, event: QWheelEvent) -> None: """Switch function by mouse wheel. + Set zoom bar value. + Set select mode. """ p = event.angleDelta() if QApplication.keyboardModifiers() == Qt.ShiftModifier: value = p.y() elif p.x() != 0: value = p.x() elif p.y() != 0: value = self.prefer.scale_factor_option * (1 if p.y() > 0 else -1) value += self.zoom_value() self.set_zoom_bar(value) return else: return tags = ("Points", "Links") mode = (self.selection_mode() + (-1 if value > 0 else 1)) % len(tags) self.selection_mode_wheel(mode) QToolTip.showText(event.globalPos(), f"Selection mode: {tags[mode]}", self) event.accept()