mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-07 09:01:38 -04:00
Handle case of less than a screenful of books
This commit is contained in:
parent
d50c85b885
commit
9688c9fe14
@ -880,13 +880,19 @@ class BooksView(QTableView): # {{{
|
|||||||
orig = self.currentIndex()
|
orig = self.currentIndex()
|
||||||
index = QTableView.moveCursor(self, action, modifiers)
|
index = QTableView.moveCursor(self, action, modifiers)
|
||||||
if action == QTableView.MovePageDown:
|
if action == QTableView.MovePageDown:
|
||||||
rows = self.row_at_bottom() - self.row_at_top()
|
|
||||||
moved = index.row() - orig.row()
|
moved = index.row() - orig.row()
|
||||||
|
try:
|
||||||
|
rows = self.row_at_bottom() - self.row_at_top()
|
||||||
|
except TypeError:
|
||||||
|
rows = moved
|
||||||
if moved > rows:
|
if moved > rows:
|
||||||
index = self.model().index(orig.row() + rows, index.column())
|
index = self.model().index(orig.row() + rows, index.column())
|
||||||
elif action == QTableView.MovePageUp:
|
elif action == QTableView.MovePageUp:
|
||||||
rows = self.row_at_bottom() - self.row_at_top()
|
|
||||||
moved = orig.row() - index.row()
|
moved = orig.row() - index.row()
|
||||||
|
try:
|
||||||
|
rows = self.row_at_bottom() - self.row_at_top()
|
||||||
|
except TypeError:
|
||||||
|
rows = moved
|
||||||
if moved > rows:
|
if moved > rows:
|
||||||
index = self.model().index(orig.row() - rows, index.column())
|
index = self.model().index(orig.row() - rows, index.column())
|
||||||
return index
|
return index
|
||||||
|
Loading…
x
Reference in New Issue
Block a user