本文整理汇总了Python中PyQt5.QtCore.QEvent.Wheel方法的典型用法代码示例。如果您正苦于以下问题:Python QEvent.Wheel方法的具体用法?Python QEvent.Wheel怎么用?Python QEvent.Wheel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.QEvent
的用法示例。
在下文中一共展示了QEvent.Wheel方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handleEvent
# 需要导入模块: from PyQt5.QtCore import QEvent [as 别名]
# 或者: from PyQt5.QtCore.QEvent import Wheel [as 别名]
def handleEvent(self, event):
if event.type() == QEvent.MouseButtonPress:
ex, ey = self._normalizeCoordinates(event.windowPos().x(), event.windowPos().y())
e = MouseEvent(MouseEvent.MousePressEvent, ex, ey, self._x, self._y, self._qtButtonsToButtonList(event.buttons()))
self._x = ex
self._y = ey
self.event.emit(e)
elif event.type() == QEvent.MouseMove:
ex, ey = self._normalizeCoordinates(event.windowPos().x(), event.windowPos().y())
e = MouseEvent(MouseEvent.MouseMoveEvent, ex, ey, self._x, self._y, self._qtButtonsToButtonList(event.buttons()))
self._x = ex
self._y = ey
self.event.emit(e)
elif event.type() == QEvent.MouseButtonRelease:
ex, ey = self._normalizeCoordinates(event.windowPos().x(), event.windowPos().y())
e = MouseEvent(MouseEvent.MouseReleaseEvent, ex, ey, self._x, self._y, self._qtButtonsToButtonList(event.button()))
self._x = ex
self._y = ey
self.event.emit(e)
elif event.type() == QEvent.Wheel:
delta = event.angleDelta()
e = WheelEvent(delta.x(), delta.y())
self.event.emit(e)
示例2: __init__
# 需要导入模块: from PyQt5.QtCore import QEvent [as 别名]
# 或者: from PyQt5.QtCore.QEvent import Wheel [as 别名]
def __init__(self, tab, *, parent=None):
super().__init__(parent)
self._tab = tab
self._handlers = {
QEvent.MouseButtonPress: self._handle_mouse_press,
QEvent.MouseButtonRelease: self._handle_mouse_release,
QEvent.Wheel: self._handle_wheel,
QEvent.KeyRelease: self._handle_key_release,
}
self._ignore_wheel_event = False
self._check_insertmode_on_release = False
示例3: eventFilter
# 需要导入模块: from PyQt5.QtCore import QEvent [as 别名]
# 或者: from PyQt5.QtCore.QEvent import Wheel [as 别名]
def eventFilter(self, obj, event):
if event.type() == QEvent.Wheel and 'SpinBox' in str(obj):
return True
return False
示例4: eventFilter
# 需要导入模块: from PyQt5.QtCore import QEvent [as 别名]
# 或者: from PyQt5.QtCore.QEvent import Wheel [as 别名]
def eventFilter(self, source, evt):
t = evt.type()
if t == QEvent.Wheel:
self.new_entry_flag = True
self.mouse_scroll_event(evt)
return True
elif t == QEvent.KeyPress:
self.new_entry_flag = True
if evt.key() == QtCore.Qt.Key_Return:
self.update_entry(evt)
return True
return False
示例5: eventFilter
# 需要导入模块: from PyQt5.QtCore import QEvent [as 别名]
# 或者: from PyQt5.QtCore.QEvent import Wheel [as 别名]
def eventFilter(self, source, evt):
t = evt.type()
if t == QEvent.Wheel:
self.mouse_scroll_event(evt)
return True
elif t == QEvent.ContextMenu:
self.parent.erase_digits_to_right(self)
self.reset_color()
return True
return False
示例6: eventFilter
# 需要导入模块: from PyQt5.QtCore import QEvent [as 别名]
# 或者: from PyQt5.QtCore.QEvent import Wheel [as 别名]
def eventFilter(self, object, evt):
if evt.type() == QEvent.Wheel:
self.bias += (-4,4)[evt.angleDelta().y() > 0]
return False
示例7: eventFilter
# 需要导入模块: from PyQt5.QtCore import QEvent [as 别名]
# 或者: from PyQt5.QtCore.QEvent import Wheel [as 别名]
def eventFilter(self, source, evt):
t = evt.type()
if t == QEvent.Wheel:
v = (-5,5)[evt.angleDelta().y() > 0]
pos = self.obj.value() + v
pos = self.limit_range(pos)
self.obj.setValue(pos)
self.config[self.config_name] = pos
return True
return False