Python PyQt5.QtGui.QWheelEvent() Examples
The following are 14
code examples of PyQt5.QtGui.QWheelEvent().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtGui
, or try the search function
.
Example #1
Source File: mainwindow.py From track with Apache License 2.0 | 11 votes |
def event(self, e): if not isinstance(e, ( QtCore.QEvent, QtCore.QChildEvent, QtCore.QDynamicPropertyChangeEvent, QtGui.QPaintEvent, QtGui.QHoverEvent, QtGui.QMoveEvent, QtGui.QEnterEvent, QtGui.QResizeEvent, QtGui.QShowEvent, QtGui.QPlatformSurfaceEvent, QtGui.QWindowStateChangeEvent, QtGui.QKeyEvent, QtGui.QWheelEvent, QtGui.QMouseEvent, QtGui.QFocusEvent, QtGui.QHelpEvent, QtGui.QHideEvent, QtGui.QCloseEvent, QtGui.QInputMethodQueryEvent, QtGui.QContextMenuEvent, )): log().warning("unknown event: %r %r", e.type(), e) return super().event(e)
Example #2
Source File: mpvwidget.py From vidcutter with GNU General Public License v3.0 | 5 votes |
def wheelEvent(self, event: QWheelEvent) -> None: self.parent.seekSlider.wheelEvent(event)
Example #3
Source File: videoslider.py From vidcutter with GNU General Public License v3.0 | 5 votes |
def wheelEvent(self, event: QWheelEvent) -> None: if self.parent.mediaAvailable: if event.angleDelta().y() > 0: self.parent.mpvWidget.frameBackStep() else: self.parent.mpvWidget.frameStep() self.parent.setPlayButton(False) event.accept()
Example #4
Source File: image_dialog.py From CvStudio with MIT License | 5 votes |
def wheelEvent(self, event: QWheelEvent): adj = (event.angleDelta().y() / 120) * 0.1 self.scale(1 + adj, 1 + adj)
Example #5
Source File: image_graphics_view.py From CvStudio with MIT License | 5 votes |
def wheelEvent(self, event: QWheelEvent): adj = (event.angleDelta().y() / 120) * 0.1 self.scale(1 + adj, 1 + adj)
Example #6
Source File: imageViewer.py From CvStudio with MIT License | 5 votes |
def wheelEvent(self, wheelEvent): """Overrides the wheelEvent to handle zooming. :param QWheelEvent wheelEvent: instance of |QWheelEvent|""" assert isinstance(wheelEvent, QtGui.QWheelEvent) if wheelEvent.modifiers() & QtCore.Qt.ControlModifier: self.wheelNotches.emit(wheelEvent.angleDelta().y() / 240.0) wheelEvent.accept() else: super(SynchableGraphicsView, self).wheelEvent(wheelEvent)
Example #7
Source File: cad_viewer.py From ezdxf with MIT License | 5 votes |
def wheelEvent(self, event: qg.QWheelEvent) -> None: # dividing by 120 gets number of notches on a typical scroll wheel. See QWheelEvent documentation delta_notches = event.angleDelta().y() / 120 zoom_per_scroll_notch = 0.2 factor = 1 + zoom_per_scroll_notch * delta_notches resulting_zoom = self._zoom * factor if resulting_zoom < self._zoom_limits[0]: factor = self._zoom_limits[0] / self._zoom elif resulting_zoom > self._zoom_limits[1]: factor = self._zoom_limits[1] / self._zoom self.scale(factor, factor) self._zoom *= factor
Example #8
Source File: candle_demo.py From Python-CTPAPI with MIT License | 5 votes |
def wheelEvent(self, event: QtGui.QWheelEvent) -> None: """ Reimplement this method of parent to zoom in/out. """ delta = event.angleDelta() if delta.y() > 0: self._on_key_up() elif delta.y() < 0: self._on_key_down()
Example #9
Source File: SpectrumDialogController.py From urh with GNU General Public License v3.0 | 5 votes |
def on_graphics_view_wheel_event_triggered(self, event: QWheelEvent): self.ui.sliderYscale.wheelEvent(event)
Example #10
Source File: ZoomableGraphicView.py From urh with GNU General Public License v3.0 | 5 votes |
def wheelEvent(self, event: QWheelEvent): zoom_factor = 1.001 ** event.angleDelta().y() self.zoom(zoom_factor, cursor_pos=event.pos())
Example #11
Source File: LiveGraphicView.py From urh with GNU General Public License v3.0 | 5 votes |
def wheelEvent(self, event: QWheelEvent): self.wheel_event_triggered.emit(event) if self.capturing_data: return super().wheelEvent(event)
Example #12
Source File: ScrollArea.py From urh with GNU General Public License v3.0 | 5 votes |
def wheelEvent(self, event: QWheelEvent): event.ignore()
Example #13
Source File: Frequency.py From nanovna-saver with GNU General Public License v3.0 | 4 votes |
def wheelEvent(self, a0: QtGui.QWheelEvent) -> None: if len(self.data) == 0 and len(self.reference) == 0: a0.ignore() return do_zoom_x = do_zoom_y = True if a0.modifiers() == QtCore.Qt.ShiftModifier: do_zoom_x = False if a0.modifiers() == QtCore.Qt.ControlModifier: do_zoom_y = False if a0.angleDelta().y() > 0: # Zoom in a0.accept() # Center of zoom = a0.x(), a0.y() # We zoom in by 1/10 of the width/height. rate = a0.angleDelta().y() / 120 if do_zoom_x: zoomx = rate * self.chartWidth / 10 else: zoomx = 0 if do_zoom_y: zoomy = rate * self.chartHeight / 10 else: zoomy = 0 absx = max(0, a0.x() - self.leftMargin) absy = max(0, a0.y() - self.topMargin) ratiox = absx/self.chartWidth ratioy = absy/self.chartHeight p1x = int(self.leftMargin + ratiox * zoomx) p1y = int(self.topMargin + ratioy * zoomy) p2x = int(self.leftMargin + self.chartWidth - (1 - ratiox) * zoomx) p2y = int(self.topMargin + self.chartHeight - (1 - ratioy) * zoomy) self.zoomTo(p1x, p1y, p2x, p2y) elif a0.angleDelta().y() < 0: # Zoom out a0.accept() # Center of zoom = a0.x(), a0.y() # We zoom out by 1/9 of the width/height, to match zoom in. rate = -a0.angleDelta().y() / 120 if do_zoom_x: zoomx = rate * self.chartWidth / 9 else: zoomx = 0 if do_zoom_y: zoomy = rate * self.chartHeight / 9 else: zoomy = 0 absx = max(0, a0.x() - self.leftMargin) absy = max(0, a0.y() - self.topMargin) ratiox = absx/self.chartWidth ratioy = absy/self.chartHeight p1x = int(self.leftMargin - ratiox * zoomx) p1y = int(self.topMargin - ratioy * zoomy) p2x = int(self.leftMargin + self.chartWidth + (1 - ratiox) * zoomx) p2y = int(self.topMargin + self.chartHeight + (1 - ratioy) * zoomy) self.zoomTo(p1x, p1y, p2x, p2y) else: a0.ignore()
Example #14
Source File: TDR.py From nanovna-saver with GNU General Public License v3.0 | 4 votes |
def wheelEvent(self, a0: QtGui.QWheelEvent) -> None: if len(self.tdrWindow.td) == 0: a0.ignore() return chart_height = self.chartHeight chart_width = self.chartWidth do_zoom_x = do_zoom_y = True if a0.modifiers() == QtCore.Qt.ShiftModifier: do_zoom_x = False if a0.modifiers() == QtCore.Qt.ControlModifier: do_zoom_y = False if a0.angleDelta().y() > 0: # Zoom in a0.accept() # Center of zoom = a0.x(), a0.y() # We zoom in by 1/10 of the width/height. rate = a0.angleDelta().y() / 120 if do_zoom_x: zoomx = rate * chart_width / 10 else: zoomx = 0 if do_zoom_y: zoomy = rate * chart_height / 10 else: zoomy = 0 absx = max(0, a0.x() - self.leftMargin) absy = max(0, a0.y() - self.topMargin) ratiox = absx/chart_width ratioy = absy/chart_height # TODO: Change zoom to center on the mouse if possible, # or extend box to the side that has room if not. p1x = int(self.leftMargin + ratiox * zoomx) p1y = int(self.topMargin + ratioy * zoomy) p2x = int(self.leftMargin + chart_width - (1 - ratiox) * zoomx) p2y = int(self.topMargin + chart_height - (1 - ratioy) * zoomy) self.zoomTo(p1x, p1y, p2x, p2y) elif a0.angleDelta().y() < 0: # Zoom out a0.accept() # Center of zoom = a0.x(), a0.y() # We zoom out by 1/9 of the width/height, to match zoom in. rate = -a0.angleDelta().y() / 120 if do_zoom_x: zoomx = rate * chart_width / 9 else: zoomx = 0 if do_zoom_y: zoomy = rate * chart_height / 9 else: zoomy = 0 absx = max(0, a0.x() - self.leftMargin) absy = max(0, a0.y() - self.topMargin) ratiox = absx/chart_width ratioy = absy/chart_height p1x = int(self.leftMargin - ratiox * zoomx) p1y = int(self.topMargin - ratioy * zoomy) p2x = int(self.leftMargin + chart_width + (1 - ratiox) * zoomx) p2y = int(self.topMargin + chart_height + (1 - ratioy) * zoomy) self.zoomTo(p1x, p1y, p2x, p2y) else: a0.ignore()