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