mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 16:43:40 +02:00
Book list: Fix Ctrl+Home/End not selecting the first/last book
This commit is contained in:
parent
e8d2a6a02f
commit
5ace899bfb
2 changed files with 13 additions and 2 deletions
|
|
@ -18,7 +18,8 @@
|
|||
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 @@ def moveCursor(self, action, modifiers):
|
|||
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 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 @@ def moveCursor(self, action, modifiers):
|
|||
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…
Reference in a new issue