| 215 | } |
| 216 | |
| 217 | QModelIndex LocalTreeModel::indexForItem(const LocalTreeItem *item) const |
| 218 | { |
| 219 | if (!item || item == rootItem) { |
| 220 | return QModelIndex(); |
| 221 | } |
| 222 | |
| 223 | LocalTreeItem *p = item->parent(); |
| 224 | if (!p) |
| 225 | return QModelIndex(); |
| 226 | |
| 227 | auto mitem = const_cast<LocalTreeItem *>(item); |
| 228 | int row = p->indexOf(mitem); |
| 229 | return createIndex(row, 0, mitem); |
| 230 | } |
no test coverage detected