mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Grid View: Allow the left and right arrow keys to traverse over rows. Fixes #1295901 [[Enhancement Request] Allow continuous right and left scrolling in cover grid](https://bugs.launchpad.net/calibre/+bug/1295901)
This commit is contained in:
parent
c570ace3f9
commit
0e11cafb0c
@ -850,4 +850,14 @@ class GridView(QListView):
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
def moveCursor(self, action, modifiers):
|
||||
index = QListView.moveCursor(self, action, modifiers)
|
||||
if action in (QListView.MoveLeft, QListView.MoveRight) and index.isValid():
|
||||
ci = self.currentIndex()
|
||||
if ci.isValid() and index.row() == ci.row():
|
||||
nr = index.row() + (1 if action == QListView.MoveRight else -1)
|
||||
if 0 <= nr < self.model().rowCount(QModelIndex()):
|
||||
index = self.model().index(nr, 0)
|
||||
return index
|
||||
|
||||
# }}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user