mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Book list: Fix a regression in the previous release that broke drag and drop of multiple books. Fixes #1999995 [Unable to drag & drop multiple books to tag browser](https://bugs.launchpad.net/calibre/+bug/1999995)
This commit is contained in:
parent
0f75c185b7
commit
c37df3f108
@ -119,6 +119,12 @@ def mousePressEvent(self, event):
|
||||
return qt_item_view_base_class(self).mousePressEvent(self, event)
|
||||
|
||||
|
||||
def mouseReleaseEvent(self, event):
|
||||
if hasattr(self, 'handle_mouse_press_event'):
|
||||
return self.handle_mouse_release_event(event)
|
||||
return qt_item_view_base_class(self).mouseReleaseEvent(self, event)
|
||||
|
||||
|
||||
def drag_icon(self, cover, multiple):
|
||||
cover = cover.scaledToHeight(120, Qt.TransformationMode.SmoothTransformation)
|
||||
if multiple:
|
||||
@ -263,7 +269,7 @@ def setup_dnd_interface(cls_or_self):
|
||||
cls = cls_or_self
|
||||
fmap = globals()
|
||||
for x in (
|
||||
'dragMoveEvent', 'event_has_mods', 'mousePressEvent', 'mouseMoveEvent',
|
||||
'dragMoveEvent', 'event_has_mods', 'mousePressEvent', 'mouseMoveEvent', 'mouseReleaseEvent',
|
||||
'drag_data', 'drag_icon', 'dragEnterEvent', 'dropEvent', 'paths_from_event'):
|
||||
func = fmap[x]
|
||||
setattr(cls, x, func)
|
||||
|
@ -1229,19 +1229,22 @@ class BooksView(QTableView): # {{{
|
||||
# ensure clicked row is always selected
|
||||
index, QItemSelectionModel.SelectionFlag.Select | QItemSelectionModel.SelectionFlag.Rows)
|
||||
else:
|
||||
if (
|
||||
m == Qt.KeyboardModifier.NoModifier and ev.button() == Qt.MouseButton.LeftButton and
|
||||
self.editTriggers() & QAbstractItemView.EditTrigger.SelectedClicked
|
||||
):
|
||||
# As of Qt 6 , Qt does not clear a multi-row selection when the
|
||||
# edit triggers contain SelectedClicked and the clicked row is
|
||||
# already selected, so do it ourselves
|
||||
index = self.indexAt(ev.pos())
|
||||
sm = self.selectionModel()
|
||||
if index.isValid() and sm.isSelected(index):
|
||||
self.select_rows((index,), using_ids=False, change_current=False, scroll=False)
|
||||
QTableView.mousePressEvent(self, ev)
|
||||
|
||||
def handle_mouse_release_event(self, ev):
|
||||
if (
|
||||
ev.modifiers() == Qt.KeyboardModifier.NoModifier and ev.button() == Qt.MouseButton.LeftButton and
|
||||
self.editTriggers() & QAbstractItemView.EditTrigger.SelectedClicked
|
||||
):
|
||||
# As of Qt 6, Qt does not clear a multi-row selection when the
|
||||
# edit triggers contain SelectedClicked and the clicked row is
|
||||
# already selected, so do it ourselves
|
||||
index = self.indexAt(ev.pos())
|
||||
sm = self.selectionModel()
|
||||
if index.isValid() and sm.isSelected(index):
|
||||
self.select_rows((index,), using_ids=False, change_current=False, scroll=False)
|
||||
QTableView.mouseReleaseEvent(self, ev)
|
||||
|
||||
@property
|
||||
def column_map(self):
|
||||
return self._model.column_map
|
||||
|
Loading…
x
Reference in New Issue
Block a user