mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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:
parent
e9ae3e058e
commit
f0d65fa0c2
@ -731,6 +731,16 @@ class GridView(QListView):
|
|||||||
sel.merge(QItemSelection(m.index(min(group), 0), m.index(max(group), 0)), sm.Select)
|
sel.merge(QItemSelection(m.index(min(group), 0), m.index(max(group), 0)), sm.Select)
|
||||||
sm.select(sel, sm.ClearAndSelect)
|
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):
|
def set_current_row(self, row):
|
||||||
sm = self.selectionModel()
|
sm = self.selectionModel()
|
||||||
sm.setCurrentIndex(self.model().index(row, 0), sm.NoUpdate)
|
sm.setCurrentIndex(self.model().index(row, 0), sm.NoUpdate)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user