(view)
Return the index of selected row in a `view` (:class:`QListView`)

    The view's selection mode must be a QAbstractItemView.SingleSelction
Return the index of selected row in a `view` (:class:`QListView`)
Return the index of selected row in a view ( : class : QListView )
def selected_row(view):
    """
    Return the index of selected row in a `view` (:class:`QListView`)

    The view's selection mode must be a QAbstractItemView.SingleSelction
    """
    if view.selectionMode() in [QAbstractItemView.MultiSelection,
                                QAbstractItemView.ExtendedSelection]:
        raise ValueError("invalid 'selectionMode'")

    sel_model = view.selectionModel()
    indexes = sel_model.selectedRows()
    if indexes:
        assert len(indexes) == 1
        return indexes[0].row()
    else:
        return None
def selected_row ( view ) : if view . selectionMode ( ) in [ QAbstractItemView . MultiSelection , QAbstractItemView . ExtendedSelection ] : raise ValueError ( "invalid 'selectionMode'" ) sel_model = view . selectionModel ( ) indexes = sel_model . selectedRows ( ) if indexes : assert len ( indexes ) == 1 return indexes [ 0 ] . row ( ) else : return None