def mousePressEvent(self, event):
if event.button() == Qt.LeftButton:
for recordIndex, rect in self._optionsRects.items():
if QRect(*rect).contains(event.pos()):
self._clickedIndex = recordIndex
self._oldSelection = self._selection
self._selection = {recordIndex}
if self._selectionMode > 1 and QApplication.keyboardModifiers(
) & Qt.ShiftModifier:
shiftSelection = self._selection ^ self._oldSelection
if shiftSelection:
self._selection = shiftSelection
else:
self._selection |= self._oldSelection
break
self.update()
else:
super().mousePressEvent(event)
评论列表
文章目录