def mouseMoveEvent(self, event):
if event.buttons() & (Qt.LeftButton | Qt.RightButton):
index = self._findIndexForEvent(event, True)
if index == self._lastSelectedCell:
return
if self.maybeExecuteDrag(event):
return
self.scrollToCell(index)
if index >= len(self._glyphs):
return
modifiers = event.modifiers()
if modifiers & Qt.ControlModifier:
if index in self._selection and index in self._oldSelection:
self._selection.remove(index)
elif index not in self._selection and \
index not in self._oldSelection:
self._selection.add(index)
elif modifiers & Qt.ShiftModifier:
self._selection = self._linearSelection(index)
else:
self._selection = {index}
self._lastSelectedCell = index
self.selectionChanged.emit()
self.update()
else:
super(GlyphCellWidget, self).mouseMoveEvent(event)
评论列表
文章目录