Grid View: Fix selectAll() behavior

Cover grid: Fix selecting all books with Ctrl+A causing subsequent
deselects to not fully work. Fixes #1236348 [Cover grid: Ctrl-A (Select ALL), deselect one, does not update status bar](https://bugs.launchpad.net/calibre/+bug/1236348)
This commit is contained in:
Kovid Goyal 2013-10-09 08:50:33 +05:30
parent e9ae3e058e
commit f0d65fa0c2

View File

@ -731,6 +731,16 @@ class GridView(QListView):
sel.merge(QItemSelection(m.index(min(group), 0), m.index(max(group), 0)), sm.Select)
sm.select(sel, sm.ClearAndSelect)
def selectAll(self):
# We re-implement this to ensure that only indexes from column 0 are
# selected. The base class implementation selects all columns. This
# causes problems with selection syncing, see
# https://bugs.launchpad.net/bugs/1236348
m = self.model()
sm = self.selectionModel()
sel = QItemSelection(m.index(0, 0), m.index(m.rowCount(QModelIndex())-1, 0))
sm.select(sel, sm.ClearAndSelect)
def set_current_row(self, row):
sm = self.selectionModel()
sm.setCurrentIndex(self.model().index(row, 0), sm.NoUpdate)