| 127 | } |
| 128 | |
| 129 | QModelIndex KeyTreeModel::indexFromItem(const KeyTreeItem *item) const { |
| 130 | if(!item || item == rootItem) |
| 131 | return QModelIndex(); |
| 132 | |
| 133 | return createIndex(item->childNumber(), 0, const_cast<KeyTreeItem *>(item)); |
| 134 | } |
| 135 | |
| 136 | KeyTreeItem *KeyTreeModel::getItem(const QModelIndex &index) const |
| 137 | { |