| 199 | } |
| 200 | |
| 201 | QModelIndex KeyTreeModel::parent(const QModelIndex &index) const |
| 202 | { |
| 203 | if (!index.isValid()) |
| 204 | return QModelIndex(); |
| 205 | |
| 206 | KeyTreeItem *childItem = getItem(index); |
| 207 | if(childItem == nullptr) |
| 208 | return QModelIndex(); |
| 209 | |
| 210 | KeyTreeItem *parentItem = childItem->parent(); |
| 211 | |
| 212 | if (parentItem == nullptr || parentItem == rootItem) |
| 213 | return QModelIndex(); |
| 214 | |
| 215 | if(parentItem->parent() == nullptr) |
| 216 | return QModelIndex(); |
| 217 | |
| 218 | return createIndex(parentItem->childNumber(), 0, parentItem); |
| 219 | } |
| 220 | |
| 221 | bool KeyTreeModel::removeRows(int position, int rows, const QModelIndex &parent) |
| 222 | { |