def selected_items(list_widget, items):
 item_count = len(items)
 selected = []
 for widget_item in list_widget.selectedItems():
  row = list_widget.row(widget_item)
  if (row < item_count):
   selected.append(items[row])
 return selected

def selected_items ( list_widget , items ) : item_count = len ( items ) selected = [ ] for widget_item in list_widget . selectedItems ( ) : row = list_widget . row ( widget_item ) if ( row < item_count ) : selected . append ( items [ row ] ) return selected
returns an array of model items that correspond to the selected qlistwidget rows .