def selected_item(list_widget, items):
 widget_items = list_widget.selectedItems()
 if (not widget_items):
  return None
 widget_item = widget_items[0]
 row = list_widget.row(widget_item)
 if (row < len(items)):
  return items[row]
 else:
  return None

def selected_item ( list_widget , items ) : widget_items = list_widget . selectedItems ( ) if ( not widget_items ) : return None widget_item = widget_items [ 0 ] row = list_widget . row ( widget_item ) if ( row < len ( items ) ) : return items [ row ] else : return None
returns the model item that corresponds to the selected qlistwidget row .