From 6b99cd01c26244d2ca11cf6877200545a18736e3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 3 May 2013 14:24:15 +0530 Subject: [PATCH] When pressing Ctrl+Home/End preserve the horizontal scroll position in the book list --- src/calibre/gui2/library/views.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/calibre/gui2/library/views.py b/src/calibre/gui2/library/views.py index 2dc84cf240..b7fe690717 100644 --- a/src/calibre/gui2/library/views.py +++ b/src/calibre/gui2/library/views.py @@ -807,6 +807,14 @@ class BooksView(QTableView): # {{{ sm = self.selectionModel() sm.select(index, sm.ClearAndSelect|sm.Rows) + def keyPressEvent(self, ev): + val = self.horizontalScrollBar().value() + ret = super(BooksView, self).keyPressEvent(ev) + if ev.isAccepted() and ev.key() in (Qt.Key_Home, Qt.Key_End + ) and ev.modifiers() & Qt.ControlModifier: + self.horizontalScrollBar().setValue(val) + return ret + def ids_to_rows(self, ids): row_map = OrderedDict() ids = frozenset(ids)