From 0e11cafb0c92d15fe9c969a49f84133391e1ca00 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 22 Mar 2014 08:38:24 +0530 Subject: [PATCH] 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) --- src/calibre/gui2/library/alternate_views.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/calibre/gui2/library/alternate_views.py b/src/calibre/gui2/library/alternate_views.py index b09bec64c8..80ca24fc71 100644 --- a/src/calibre/gui2/library/alternate_views.py +++ b/src/calibre/gui2/library/alternate_views.py @@ -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 + # }}}