QModelIndex HistoryModel::index(int row, int column, const QModelIndex &parent) const { if (!hasIndex(row, column, parent)) { return QModelIndex(); } HistoryItem* parentItem = itemFromIndex(parent); HistoryItem* childItem = parentItem->child(row); return childItem ? createIndex(row, column, childItem) : QModelIndex(); }