From f0d65fa0c2eeec1c1ac90f1a69a0d9b53c25bde2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 9 Oct 2013 08:50:33 +0530 Subject: [PATCH] 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) --- 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 c4a0b79c3a..4f21c4868e 100644 --- a/src/calibre/gui2/library/alternate_views.py +++ b/src/calibre/gui2/library/alternate_views.py @@ -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)