mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-05 08:40:13 -04:00
Book list: Fix Ctrl+Home/End not selecting the first/last book
This commit is contained in:
parent
e8d2a6a02f
commit
5ace899bfb
@ -18,7 +18,8 @@ from PyQt5.Qt import (
|
||||
QTimer, QPalette, QColor, QItemSelection, QPixmap, QMenu, QApplication,
|
||||
QMimeData, QUrl, QDrag, QPoint, QPainter, QRect, pyqtProperty, QEvent,
|
||||
QPropertyAnimation, QEasingCurve, pyqtSlot, QHelpEvent, QAbstractItemView,
|
||||
QStyleOptionViewItem, QToolTip, QByteArray, QBuffer, QBrush, qRed, qGreen, qBlue)
|
||||
QStyleOptionViewItem, QToolTip, QByteArray, QBuffer, QBrush, qRed, qGreen,
|
||||
qBlue, QItemSelectionModel)
|
||||
|
||||
from calibre import fit_image, prints, prepare_string_for_xml, human_readable
|
||||
from calibre.constants import DEBUG, config_dir
|
||||
@ -955,4 +956,9 @@ class GridView(QListView):
|
||||
index = self.model().index(nr, 0)
|
||||
return index
|
||||
|
||||
def selectionCommand(self, index, event):
|
||||
if event and event.type() == event.KeyPress and event.key() in (Qt.Key_Home, Qt.Key_End) and event.modifiers() & Qt.CTRL:
|
||||
return QItemSelectionModel.ClearAndSelect | QItemSelectionModel.Rows
|
||||
return super(GridView, self).selectionCommand(index, event)
|
||||
|
||||
# }}}
|
||||
|
@ -13,7 +13,7 @@ from collections import OrderedDict
|
||||
from PyQt5.Qt import (
|
||||
QTableView, Qt, QAbstractItemView, QMenu, pyqtSignal, QFont, QModelIndex,
|
||||
QIcon, QItemSelection, QMimeData, QDrag, QStyle, QPoint, QUrl, QHeaderView,
|
||||
QStyleOptionHeader)
|
||||
QStyleOptionHeader, QItemSelectionModel)
|
||||
|
||||
from calibre.gui2.library.delegates import (RatingDelegate, PubDateDelegate,
|
||||
TextDelegate, DateDelegate, CompleteDelegate, CcTextDelegate,
|
||||
@ -904,6 +904,11 @@ class BooksView(QTableView): # {{{
|
||||
return self.model().index(self.model().rowCount(QModelIndex()) - 1, orig.column())
|
||||
return index
|
||||
|
||||
def selectionCommand(self, index, event):
|
||||
if event and event.type() == event.KeyPress and event.key() in (Qt.Key_Home, Qt.Key_End) and event.modifiers() & Qt.CTRL:
|
||||
return QItemSelectionModel.ClearAndSelect | QItemSelectionModel.Rows
|
||||
return super(BooksView, self).selectionCommand(index, event)
|
||||
|
||||
def ids_to_rows(self, ids):
|
||||
row_map = OrderedDict()
|
||||
ids = frozenset(ids)
|
||||
|
Loading…
x
Reference in New Issue
Block a user