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)

This commit is contained in:
Kovid Goyal 2010-12-14 23:23:17 -07:00
parent ef23a7c8c4
commit ec7bd86288

View File

@ -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 = []
# }}}