How to enable multiplexing in qtreeview before pressing the Ctrl key in pyqt5?

I have a qtreeview in which I want to enable multiple row selection only when I press the ctrl key. I used setSelectionMode (QAbstractItemView.MultiSelection) to select multiple rows, but it turned out that it looked weird if I just clicked on the item that it selected. I do not want it. I want to select multiple line selection only when pressing ctrl.

+4
source share
1 answer

Use ExtendedSelection, not Multiselection.

tree.setSelectionMode(QAbstractItemView.ExtendedSelection)
+1
source

Source: https://habr.com/ru/post/1692134/


All Articles