| 294 | } |
| 295 | |
| 296 | QModelIndex QJsonModel::index(int row, int column, const QModelIndex& parent) const { |
| 297 | if (!hasIndex(row, column, parent)) |
| 298 | return QModelIndex{}; |
| 299 | |
| 300 | QJsonTreeItem* parentItem; |
| 301 | |
| 302 | if (!parent.isValid()) |
| 303 | parentItem = mHeadItem; |
| 304 | else |
| 305 | parentItem = static_cast<QJsonTreeItem*>(parent.internalPointer()); |
| 306 | |
| 307 | QJsonTreeItem* childItem = parentItem->child(row); |
| 308 | if (childItem) |
| 309 | return createIndex(row, column, childItem); |
| 310 | |
| 311 | return {}; |
| 312 | } |
| 313 | |
| 314 | QModelIndex QJsonModel::parent(const QModelIndex& index) const { |
| 315 | if (!index.isValid()) |
no test coverage detected