本文整理汇总了Python中PyQt4.QtGui.QListView.keyPressEvent方法的典型用法代码示例。如果您正苦于以下问题:Python QListView.keyPressEvent方法的具体用法?Python QListView.keyPressEvent怎么用?Python QListView.keyPressEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QListView
的用法示例。
在下文中一共展示了QListView.keyPressEvent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _listKeyPressEvent
# 需要导入模块: from PyQt4.QtGui import QListView [as 别名]
# 或者: from PyQt4.QtGui.QListView import keyPressEvent [as 别名]
def _listKeyPressEvent(self, event):
if event.matches(QKeySequence.Delete):
self._deleteList()
elif event.key() == Qt.Key_Escape:
self.playlistList.setCurrentIndex(QModelIndex())
else:
QListView.keyPressEvent(self.playlistList, event)
示例2: keyPressEvent
# 需要导入模块: from PyQt4.QtGui import QListView [as 别名]
# 或者: from PyQt4.QtGui.QListView import keyPressEvent [as 别名]
def keyPressEvent(self, event):
if event.matches(QKeySequence.Delete):
self._removeSelected()
elif event.key() == Qt.Key_Escape:
self.currentList.reset()
else:
QListView.keyPressEvent(self.currentList, event)
示例3: keyPressEvent
# 需要导入模块: from PyQt4.QtGui import QListView [as 别名]
# 或者: from PyQt4.QtGui.QListView import keyPressEvent [as 别名]
def keyPressEvent(self, evt):
"""
Protected method implementing special key handling.
@param evt reference to the event (QKeyEvent)
"""
if evt.key() in [Qt.Key_Delete, Qt.Key_Backspace] and \
self.model() is not None:
self.removeSelected()
evt.setAccepted(True)
else:
QListView.keyPressEvent(self, evt)