开发者

Multiple Selection QTreeWidget

开发者 https://www.devze.com 2023-03-25 02:53 出处:网络
Does anyone know if its possible to select multiple items on a QTreeWidget and how to go about enabling the multiple selection?

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开发者_StackOverflow社区 all their children are set to be disabled (i.e QTreeWidgetItem.setDisabled(True) )


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.


I think below will help:

youQTreeWidget.setSelectionMode(QGui.QAbstractView.MultiSelection)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号