多了不说,自己去看下面的几个函数。它们可以帮助你得到所有选中的项,然后你就可以处理关联的操作或数据了。
QTreeWidget
QList<QTreeWidgetItem*> selectedItems () const
QTreeView
57 public functions inherited from QAbstractItemView
QItemSelectionModel * selectionModel () const
QItemSelectionModel
QModelIndexList selectedColumns ( int row = 0 ) const
QModelIndexList selectedIndexes () const
QModelIndexList selectedRows ( int column = 0 ) const