def index(self, row, column=0, parent=QModelIndex()): if self._is_index_valid_for(row, self) and column == 0: return QAbstractListModel.createIndex(self, row, column, parent) else: return QModelIndex()