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) return QTableView.mousePressEvent(self, event)
def mouseMoveEvent(self, event): def mouseMoveEvent(self, event):
if not (event.buttons() & Qt.LeftButton) or self.drag_start_pos is None: if not (event.buttons() & Qt.LeftButton) or \
return self.drag_start_pos is None or \
if (event.pos() - self.drag_start_pos).manhattanLength() \ QApplication.keyboardModifiers() != Qt.NoModifier or \
(event.pos() - self.drag_start_pos).manhattanLength() \
< QApplication.startDragDistance(): < QApplication.startDragDistance():
return return QTableView.mouseMoveEvent(self, event)
index = self.indexAt(event.pos()) index = self.indexAt(event.pos())
if not index.isValid(): if not index.isValid():
return return