MCPcopy Create free account
hub / github.com/KDE/kdevelop / parent

Method parent

kdevplatform/debugger/util/treemodel.cpp:110–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110QModelIndex 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
126int TreeModel::rowCount(const QModelIndex &parent) const
127{

Callers 1

indexForItemMethod · 0.45

Calls 4

createIndexFunction · 0.85
QModelIndexClass · 0.50
isValidMethod · 0.45
rowMethod · 0.45

Tested by

no test coverage detected