本文整理汇总了Python中enki.widgets.dockwidget.DockWidget.eventFilter方法的典型用法代码示例。如果您正苦于以下问题:Python DockWidget.eventFilter方法的具体用法?Python DockWidget.eventFilter怎么用?Python DockWidget.eventFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类enki.widgets.dockwidget.DockWidget
的用法示例。
在下文中一共展示了DockWidget.eventFilter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: eventFilter
# 需要导入模块: from enki.widgets.dockwidget import DockWidget [as 别名]
# 或者: from enki.widgets.dockwidget.DockWidget import eventFilter [as 别名]
def eventFilter(self, object_, event):
if object_ is self._tree:
if event.type() == QEvent.KeyPress:
if event.key() == Qt.Key_Backspace:
if event.modifiers() == Qt.ControlModifier:
self._onTreeCtrlBackspace()
else:
self._onTreeBackspace()
return True
elif event.text() and \
(event.text().isalnum() or event.text() == '_'):
self._onTreeTextTyped(event.text())
return True
elif object_ is self._filterEdit:
if event.type() == QEvent.KeyPress:
if event.key() in (Qt.Key_Up, Qt.Key_Down):
self._tree.setFocus()
self._tree.event(event)
return True
elif event.key() in (Qt.Key_Enter, Qt.Key_Return):
currIndex = self._tree.currentIndex()
if currIndex.isValid():
self._tagModel.onActivated(currIndex)
return DockWidget.eventFilter(self, object_, event)
示例2: eventFilter
# 需要导入模块: from enki.widgets.dockwidget import DockWidget [as 别名]
# 或者: from enki.widgets.dockwidget.DockWidget import eventFilter [as 别名]
def eventFilter(self, obj, event):
"""Event filter for the widget. Catches Esc pressings. It is necessary, because QScintilla eats it
"""
if (event.type() == QEvent.KeyPress or event.type() == QEvent.ShortcutOverride) and \
event.key() == Qt.Key_Escape and \
event.modifiers() == Qt.NoModifier:
self.hide()
return True
return DockWidget.eventFilter(self, obj, event)
示例3: eventFilter
# 需要导入模块: from enki.widgets.dockwidget import DockWidget [as 别名]
# 或者: from enki.widgets.dockwidget.DockWidget import eventFilter [as 别名]
def eventFilter(self, obj, ev):
""" Event filter for the web view
Zooms the web view
"""
if isinstance(ev, QWheelEvent) and \
ev.modifiers() == Qt.ControlModifier:
multiplier = 1 + (0.1 * (ev.angleDelta().y() / 120.))
view = self._widget.webView
view.setZoomFactor(view.zoomFactor() * multiplier)
return True
else:
return DockWidget.eventFilter(self, obj, ev)