def _arrowKeyPressEvent(self, event):
count = event.count()
key = event.key()
modifiers = event.modifiers()
# TODO: it might be the case that self._lastSelectedCell cannot be None
# when we arrive here whatsoever
if self._lastSelectedCell is not None:
if key == Qt.Key_Up:
delta = -self._columnCount
elif key == Qt.Key_Down:
delta = self._columnCount
elif key == Qt.Key_Left:
delta = -1
elif key == Qt.Key_Right:
delta = 1
newSel = self._lastSelectedCell + delta * count
if newSel < 0 or newSel >= len(self._glyphs):
return
if modifiers & Qt.ShiftModifier:
self._selection |= self._linearSelection(newSel)
else:
self._selection = {newSel}
self._lastSelectedCell = newSel
self.scrollToCell(newSel)
self.selectionChanged.emit()
self.update()
评论列表
文章目录