当前位置: 首页>>代码示例>>Python>>正文


Python QtGui.QWheelEvent方法代码示例

本文整理汇总了Python中PyQt5.QtGui.QWheelEvent方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QWheelEvent方法的具体用法?Python QtGui.QWheelEvent怎么用?Python QtGui.QWheelEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtGui的用法示例。


在下文中一共展示了QtGui.QWheelEvent方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: event

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QWheelEvent [as 别名]
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) 
开发者ID:frans-fuerst,项目名称:track,代码行数:27,代码来源:mainwindow.py

示例2: wheelEvent

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QWheelEvent [as 别名]
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() 
开发者ID:ozmartian,项目名称:vidcutter,代码行数:10,代码来源:videoslider.py

示例3: wheelEvent

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QWheelEvent [as 别名]
def wheelEvent(self, event: QWheelEvent):
        self.wheel_event_triggered.emit(event)
        if self.capturing_data:
            return

        super().wheelEvent(event) 
开发者ID:jopohl,项目名称:urh,代码行数:8,代码来源:LiveGraphicView.py

示例4: wheelEvent

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QWheelEvent [as 别名]
def wheelEvent(self, event: QWheelEvent) -> None:
        self.parent.seekSlider.wheelEvent(event) 
开发者ID:ozmartian,项目名称:vidcutter,代码行数:4,代码来源:mpvwidget.py

示例5: wheelEvent

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QWheelEvent [as 别名]
def wheelEvent(self, event: QWheelEvent):
        adj = (event.angleDelta().y() / 120) * 0.1
        self.scale(1 + adj, 1 + adj) 
开发者ID:haruiz,项目名称:CvStudio,代码行数:5,代码来源:image_dialog.py

示例6: wheelEvent

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QWheelEvent [as 别名]
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) 
开发者ID:haruiz,项目名称:CvStudio,代码行数:12,代码来源:imageViewer.py

示例7: wheelEvent

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QWheelEvent [as 别名]
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 
开发者ID:mozman,项目名称:ezdxf,代码行数:14,代码来源:cad_viewer.py

示例8: wheelEvent

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QWheelEvent [as 别名]
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() 
开发者ID:nicai0609,项目名称:Python-CTPAPI,代码行数:12,代码来源:candle_demo.py

示例9: on_graphics_view_wheel_event_triggered

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QWheelEvent [as 别名]
def on_graphics_view_wheel_event_triggered(self, event: QWheelEvent):
        self.ui.sliderYscale.wheelEvent(event) 
开发者ID:jopohl,项目名称:urh,代码行数:4,代码来源:SpectrumDialogController.py

示例10: wheelEvent

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QWheelEvent [as 别名]
def wheelEvent(self, event: QWheelEvent):
        zoom_factor = 1.001 ** event.angleDelta().y()
        self.zoom(zoom_factor, cursor_pos=event.pos()) 
开发者ID:jopohl,项目名称:urh,代码行数:5,代码来源:ZoomableGraphicView.py

示例11: wheelEvent

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QWheelEvent [as 别名]
def wheelEvent(self, event: QWheelEvent):
        event.ignore() 
开发者ID:jopohl,项目名称:urh,代码行数:4,代码来源:ScrollArea.py

示例12: wheelEvent

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QWheelEvent [as 别名]
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() 
开发者ID:NanoVNA-Saver,项目名称:nanovna-saver,代码行数:59,代码来源:Frequency.py

示例13: wheelEvent

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QWheelEvent [as 别名]
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() 
开发者ID:NanoVNA-Saver,项目名称:nanovna-saver,代码行数:63,代码来源:TDR.py


注:本文中的PyQt5.QtGui.QWheelEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。