| 164 | } |
| 165 | |
| 166 | QModelIndex DeviceModel::parent(const QModelIndex &child) const { |
| 167 | if (!child.isValid()) |
| 168 | return {}; |
| 169 | Node *c = nodeFor(child); |
| 170 | Node *p = c->parent; |
| 171 | if (!p || p == m_root) |
| 172 | return {}; |
| 173 | Node *gp = p->parent; |
| 174 | int row = gp ? gp->children.indexOf(p) : 0; |
| 175 | return createIndex(row, 0, p); |
| 176 | } |
| 177 | |
| 178 | int DeviceModel::rowCount(const QModelIndex &parent) const { |
| 179 | return nodeFor(parent)->children.size(); |
nothing calls this directly
no outgoing calls
no test coverage detected