Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple Selection QTreeWidget

Does anyone know if its possible to select multiple items on a QTreeWidget and how to go about enabling the multiple selection?

All the items I want to be selectable are top level QTreeWidgetItems and all their children are set to be disabled (i.e QTreeWidgetItem.setDisabled(True) )

like image 528
Jay Avatar asked Aug 03 '11 10:08

Jay


2 Answers

It is, you'll want to call setSelectionMode during init to enable QAbstractItemView::MultiSelection. QTreeView/QTreeWidget inherit QAbstractItemView, so it is available.

Then to disable the items, just hook on to QTreeWidgets.itemSelectionChanged() signal.

like image 87
Mike Ramirez Avatar answered Oct 13 '22 18:10

Mike Ramirez


I think below will help:

youQTreeWidget.setSelectionMode(QGui.QAbstractView.MultiSelection)
like image 1
zleung Avatar answered Oct 13 '22 18:10

zleung