MCPcopy Create free account
hub / github.com/KDAB/GammaRay / findIndexForObject

Method findIndexForObject

plugins/widgetinspector/widget3dsubtreemodel.cpp:150–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150QModelIndex Widget3DSubtreeModel::findIndexForObject(const QString &objectId) const
151{
152 if (!sourceModel()) {
153 return QModelIndex();
154 }
155
156 QVector<QModelIndex> toVisit = { QModelIndex() };
157 while (!toVisit.isEmpty()) {
158 const auto idx = toVisit.takeLast();
159 const QString v = sourceModel()->data(idx, Widget3DModel::IdRole).toString();
160 if (v == objectId) {
161 return idx;
162 }
163
164 for (int i = 0, c = sourceModel()->rowCount(idx); i < c; ++i) {
165 toVisit.push_back(sourceModel()->index(i, 0, idx));
166 }
167 }
168
169 return QModelIndex();
170}
171
172bool Widget3DSubtreeModel::isParentOf(const QModelIndex &parent, const QModelIndex &child) const
173{

Callers

nothing calls this directly

Calls 5

QModelIndexClass · 0.70
isEmptyMethod · 0.45
dataMethod · 0.45
rowCountMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected