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: 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: 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): """ 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: 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: 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, 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: 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) -> 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()
def wheelEvent(self, event: QtGui.QWheelEvent): # limit wheelevents to max N events in T seconds to avoid hanging GUI because of zooming in and out non-stop PlotArea.wheelEventsCounter = PlotArea.wheelEventsCounter + 1 # print(PlotArea.wheelEventsCounter) if PlotArea.wheelEventsCounter > 3: qInfo('Zooming speed limited to optimize performance.') return super().wheelEvent(event) newRange = self.main_vb.viewRange()[0] if self.main_window.selectedView is not None: maxX = self.main_window.selectedView.panel.get_max_duration() else: return if newRange[-1] > maxX: newRange[-1] = maxX if newRange[0] < 0: newRange[0] = 0 if newRange[0] == 0: self.main_vb.setXRange(newRange[0], newRange[1], padding=0) else: self.main_vb.setXRange(newRange[0], newRange[1]) event.accept()
def wheelEvent(self, event: QtGui.QWheelEvent): file_list = self.window.file_list if len(file_list.selectedItems()): index = file_list.row(file_list.selectedItems()[0]) else: index = -1 if event.pixelDelta().y() > 0: index -= 1 else: index += 1 if index >= file_list.count() or index == -2: index = file_list.count() - 1 elif index < 0: index = 0 file_list.setCurrentItem(file_list.item(index))
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, ev: QWheelEvent): # GraphicsLayoutWidget forcibly ignores if an event was accepted, and changes its state to ignored. # This causes parents to have no knowledge of if its children accepted the event or not. # To prevent that behavior, we only process the event if it wasn't accepted. if not ev.isAccepted(): QGraphicsView.wheelEvent(self, ev)
def wheelEvent(self, event: QtGui.QWheelEvent): super().wheelEvent(event) event.accept()
def wheelEvent(self, e: QWheelEvent): print("myMouseWheel in Item...") self.__m_lastMouseWheel = self.__cloneMouseWheelEvent(e) self.__m_lastMouseWheel.ignore() e.accept() self.update()
def wheelEvent(self, event: QtGui.QWheelEvent): event.ignore()