The code below creates a single QTreeWidget.
Clicking any item adds it to the current selection (QTreeWidget is set to support MultiSelection). But I would like to only add to the current selection when Shift or Command modifier key is used.
app = QApplication([])
widget = QTreeWidget()
widget.setSelectionMode(QAbstractItemView.MultiSelection)
widget.setColumnCount(5)
for row in range(7):
item = QTreeWidgetItem(widget)
for col in range(5):
item.setText(col, 'Column %s' % col)
widget.show()
qApp.exec_()
