def tree_selection(tree_item, items):
 selected = []
 count = min(tree_item.childCount(), len(items))
 for idx in range(count):
  if tree_item.child(idx).isSelected():
   selected.append(items[idx])
 return selected

def tree_selection ( tree_item , items ) : selected = [ ] count = min ( tree_item . childCount ( ) , len ( items ) ) for idx in range ( count ) : if tree_item . child ( idx ) . isSelected ( ) : selected . append ( items [ idx ] ) return selected
returns an array of model items that correspond to the selected qtreewidgetitem children .