MCPcopy Create free account
hub / github.com/actuallyaridan/linux-devmgmt / parent

Method parent

src/model/DeviceModel.cpp:166–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166QModelIndex 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
178int DeviceModel::rowCount(const QModelIndex &parent) const {
179 return nodeFor(parent)->children.size();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected