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