Make selection and dragging behave more like other grid apps: drag only if already selected

This commit is contained in:
Charles Haley 2011-02-15 08:55:11 +00:00
parent 3b1a1bace2
commit eabbe6bc46

View File

@ -551,8 +551,10 @@ class BooksView(QTableView): # {{{
return mods & Qt.ControlModifier or mods & Qt.ShiftModifier
def mousePressEvent(self, event):
if event.button() == Qt.LeftButton and not self.event_has_mods():
self.drag_start_pos = event.pos()
ep = event.pos()
if self.indexAt(ep) in self.selectionModel().selectedIndexes() and \
event.button() == Qt.LeftButton and not self.event_has_mods():
self.drag_start_pos = ep
return QTableView.mousePressEvent(self, event)
def mouseMoveEvent(self, event):