| 108 | } |
| 109 | |
| 110 | QModelIndex TreeModel::parent(const QModelIndex &index) const |
| 111 | { |
| 112 | Q_D(const TreeModel); |
| 113 | |
| 114 | if (!index.isValid()) |
| 115 | return QModelIndex(); |
| 116 | |
| 117 | auto *childItem = static_cast<TreeItem*>(index.internalPointer()); |
| 118 | TreeItem *parentItem = childItem->parent(); |
| 119 | |
| 120 | if (parentItem == d->root) |
| 121 | return QModelIndex(); |
| 122 | |
| 123 | return createIndex(parentItem->row(), 0, parentItem); |
| 124 | } |
| 125 | |
| 126 | int TreeModel::rowCount(const QModelIndex &parent) const |
| 127 | { |
no test coverage detected