mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Book list: Preserve the current column when using Ctrl+Home or Ctrl+End shortcuts
This commit is contained in:
parent
d3ebfefc23
commit
682161fb66
@ -851,14 +851,6 @@ class BooksView(QTableView): # {{{
|
|||||||
sm = self.selectionModel()
|
sm = self.selectionModel()
|
||||||
sm.select(index, sm.ClearAndSelect|sm.Rows)
|
sm.select(index, sm.ClearAndSelect|sm.Rows)
|
||||||
|
|
||||||
def keyPressEvent(self, ev):
|
|
||||||
val = self.horizontalScrollBar().value()
|
|
||||||
ret = super(BooksView, self).keyPressEvent(ev)
|
|
||||||
if ev.isAccepted() and ev.key() in (Qt.Key_Home, Qt.Key_End
|
|
||||||
) and ev.modifiers() & Qt.ControlModifier:
|
|
||||||
self.horizontalScrollBar().setValue(val)
|
|
||||||
return ret
|
|
||||||
|
|
||||||
def row_at_top(self):
|
def row_at_top(self):
|
||||||
pos = 0
|
pos = 0
|
||||||
while pos < 100:
|
while pos < 100:
|
||||||
@ -895,6 +887,10 @@ class BooksView(QTableView): # {{{
|
|||||||
rows = moved
|
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.MoveHome and modifiers & Qt.ControlModifier:
|
||||||
|
return self.model().index(0, orig.column())
|
||||||
|
elif action == QTableView.MoveEnd and modifiers & Qt.ControlModifier:
|
||||||
|
return self.model().index(self.model().rowCount(QModelIndex()) - 1, orig.column())
|
||||||
return index
|
return index
|
||||||
|
|
||||||
def ids_to_rows(self, ids):
|
def ids_to_rows(self, ids):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user