本文整理汇总了Python中PyQt5.QtCore.QEvent方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.QEvent方法的具体用法?Python QtCore.QEvent怎么用?Python QtCore.QEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore
的用法示例。
在下文中一共展示了QtCore.QEvent方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: event
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QEvent [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)
示例2: log_events
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QEvent [as 别名]
def log_events(klass: typing.Type) -> typing.Type:
"""Class decorator to log Qt events."""
old_event = klass.event
@functools.wraps(old_event)
def new_event(self: typing.Any, e: QEvent) -> bool:
"""Wrapper for event() which logs events."""
log.misc.debug("Event in {}: {}".format(utils.qualname(klass),
qenum_key(QEvent, e.type())))
return old_event(self, e)
klass.event = new_event
return klass
示例3: eventFilter
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QEvent [as 别名]
def eventFilter(self, source, event):
"""
Filters events if this object has been installed as an event filter for the watched object.
:type source: QObject
:type event: QtCore.QEvent
:rtype: bool
"""
if event.type() == QtCore.QEvent.Resize:
widget = source.widget()
widget.redraw()
return super().eventFilter(source, event)
#############################################
# SLOTS
#################################
示例4: leaveEvent
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QEvent [as 别名]
def leaveEvent(self, event: QEvent) -> None:
self.returnCursorToNormal()
示例5: leaveEvent
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QEvent [as 别名]
def leaveEvent(self, event: QEvent) -> None:
self.editor.returnCursorToNormal()
super().leaveEvent(event)
示例6: enterEvent
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QEvent [as 别名]
def enterEvent(self, evt: QtCore.QEvent) -> None:
shadow = QGraphicsDropShadowEffect(self)
shadow.setBlurRadius(8)
shadow.setColor(QtGui.QColor(76, 35, 45).lighter())
shadow.setOffset(4)
self.setGraphicsEffect(shadow)
super(SwitchButton, self).enterEvent(evt)
示例7: leaveEvent
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QEvent [as 别名]
def leaveEvent(self, evt: QtCore.QEvent) -> None:
self.setGraphicsEffect(self._effect)
super(SwitchButton, self).leaveEvent(evt)
示例8: enterEvent
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QEvent [as 别名]
def enterEvent(self, evt: QtCore.QEvent) -> None:
self._hover_thread = HoverThread()
self._hover_thread.start()
self._hover_thread.signals.timeoutSignal.connect(self.timeout_callback)
super(LabelHovered, self).enterEvent(evt)
示例9: leaveEvent
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QEvent [as 别名]
def leaveEvent(self, evt: QtCore.QEvent) -> None:
if self._hover_thread:
self._hover_thread.join()
del self._hover_thread
super(LabelHovered, self).leaveEvent(evt)
示例10: enterEvent
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QEvent [as 别名]
def enterEvent(self, evt: QtCore.QEvent) -> None:
# self.setIconSize(QSize(math.floor(self._size.width() * 1.2),math.floor(self._size.height() * 1.2)))
shadow = QGraphicsDropShadowEffect(self)
shadow.setBlurRadius(8)
# shadow.setColor(QtGui.QColor(76,35,45).lighter())
shadow.setColor(QtGui.QColor(76, 35, 45).lighter())
shadow.setOffset(4)
self.setGraphicsEffect(shadow)
super(ImageButton, self).enterEvent(evt)
示例11: edit
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QEvent [as 别名]
def edit(self, index: QModelIndex, trigger: QAbstractItemView.EditTrigger, event: QEvent):
if index.column() == 0:
super(QTreeWidget, self).edit(index, trigger, event)
return False
示例12: leaveEvent
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QEvent [as 别名]
def leaveEvent(self, event: QEvent):
super().leaveEvent(event)
if isinstance(self.scene(), GridScene):
self.scene().clear_frequency_marker()