QModelIndex KVModel::index(int row, int column, const QModelIndex &parent) const { if (parent.isValid() && parent.column() != 0) return QModelIndex(); KeyValues *parentItem = getItem(parent); KeyValues *childItem = parentItem->GetChildAt(row); if (childItem) return createIndex(row, column, childItem); else return QModelIndex(); }