Drag 'n drop: Dont start drag if any keyboard modifiers are pressed

This commit is contained in:
Kovid Goyal 2010-10-04 14:04:25 -06:00
parent 8854982f14
commit 588ce1adb8

View File

@ -500,11 +500,13 @@ class BooksView(QTableView): # {{{
return QTableView.mousePressEvent(self, event)
def mouseMoveEvent(self, event):
if not (event.buttons() & Qt.LeftButton) or self.drag_start_pos is None:
return
if (event.pos() - self.drag_start_pos).manhattanLength() \
< QApplication.startDragDistance():
return
if not (event.buttons() & Qt.LeftButton) or \
self.drag_start_pos is None or \
QApplication.keyboardModifiers() != Qt.NoModifier or \
(event.pos() - self.drag_start_pos).manhattanLength() \
< QApplication.startDragDistance():
return QTableView.mouseMoveEvent(self, event)
index = self.indexAt(event.pos())
if not index.isValid():
return