From ec7bd8628841063f90b35d8498eba2acdaf0eb6f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 14 Dec 2010 23:23:17 -0700 Subject: [PATCH] When sorting the book list, keep the current book visible after the sort completes. Fixes #7504 (Book List to Maintain book pointer when the list is sorted by another column) --- src/calibre/gui2/library/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/library/views.py b/src/calibre/gui2/library/views.py index f724ca7b58..0e0cc0eec2 100644 --- a/src/calibre/gui2/library/views.py +++ b/src/calibre/gui2/library/views.py @@ -105,7 +105,8 @@ class BooksView(QTableView): # {{{ hv.setCursor(Qt.PointingHandCursor) self.selected_ids = [] self._model.about_to_be_sorted.connect(self.about_to_be_sorted) - self._model.sorting_done.connect(self.sorting_done) + self._model.sorting_done.connect(self.sorting_done, + type=Qt.QueuedConnection) # Column Header Context Menu {{{ def column_header_context_handler(self, action=None, column=None): @@ -227,6 +228,7 @@ class BooksView(QTableView): # {{{ sm = self.selectionModel() for idx in indices: sm.select(idx, sm.Select|sm.Rows) + self.scroll_to_row(indices[0].row()) self.selected_ids = [] # }}}