本文整理汇总了Python中PySide2.QtCore.QObject.eventFilter方法的典型用法代码示例。如果您正苦于以下问题:Python QObject.eventFilter方法的具体用法?Python QObject.eventFilter怎么用?Python QObject.eventFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide2.QtCore.QObject
的用法示例。
在下文中一共展示了QObject.eventFilter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: eventFilter
# 需要导入模块: from PySide2.QtCore import QObject [as 别名]
# 或者: from PySide2.QtCore.QObject import eventFilter [as 别名]
def eventFilter(self, obj, event):
'''Just checks if is the correct object and event type
incrementing counter until reaching the limit. After that it
stops filtering the events for the object.'''
if (self.obj == obj):
if isinstance(event, self.event_type) and self.events_handled < 5:
self.events_handled += 1
return True
else:
self.events_bypassed += 1
return False
else:
return QObject.eventFilter(self, obj, event)
示例2: eventFilter
# 需要导入模块: from PySide2.QtCore import QObject [as 别名]
# 或者: from PySide2.QtCore.QObject import eventFilter [as 别名]
def eventFilter(self, obj, event):
if event.type() == QEvent.KeyPress:
pass
return QObject.eventFilter(self, obj, event)