mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Tag browser: only start a possible drag if the item is draggable. This prevents latching onto a different item before the mouse moves "far enough".
This commit is contained in:
parent
767b9796e0
commit
3499f03ae5
@ -384,7 +384,12 @@ class TagsView(QTreeView): # {{{
|
||||
|
||||
def mousePressEvent(self, event):
|
||||
if event.buttons() & Qt.MouseButton.LeftButton:
|
||||
self.possible_drag_start = event.pos()
|
||||
# Only remember a possible drag start if the item is drag enabled
|
||||
dex = self.indexAt(event.pos())
|
||||
if self._model.flags(dex) & Qt.ItemFlag.ItemIsDragEnabled:
|
||||
self.possible_drag_start = event.pos()
|
||||
else:
|
||||
self.possible_drag_start = None
|
||||
return QTreeView.mousePressEvent(self, event)
|
||||
|
||||
def mouseMoveEvent(self, event):
|
||||
@ -399,7 +404,8 @@ class TagsView(QTreeView): # {{{
|
||||
QTreeView.mouseMoveEvent(self, event)
|
||||
return
|
||||
# don't start drag/drop until the mouse has moved a bit.
|
||||
if ((event.pos() - self.possible_drag_start).manhattanLength() <
|
||||
if (self.possible_drag_start is None or
|
||||
(event.pos() - self.possible_drag_start).manhattanLength() <
|
||||
QApplication.startDragDistance()):
|
||||
QTreeView.mouseMoveEvent(self, event)
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user