| 148 | } |
| 149 | |
| 150 | QModelIndex 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 | |
| 172 | bool Widget3DSubtreeModel::isParentOf(const QModelIndex &parent, const QModelIndex &child) const |
| 173 | { |
nothing calls this directly
no test coverage detected