本文整理匯總了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