| 110 | } |
| 111 | |
| 112 | QModelIndex AspectTreeModel::index(int row, int column, const QModelIndex& parent) const { |
| 113 | if (!m_root || !hasIndex(row, column, parent)) |
| 114 | return QModelIndex{}; |
| 115 | |
| 116 | if (!parent.isValid()) { |
| 117 | if (row != 0) |
| 118 | return QModelIndex{}; |
| 119 | return createIndex(row, column, m_root); |
| 120 | } |
| 121 | |
| 122 | auto* parent_aspect = static_cast<AbstractAspect*>(parent.internalPointer()); |
| 123 | auto* child_aspect = parent_aspect->child<AbstractAspect>(row); |
| 124 | if (!child_aspect) |
| 125 | return QModelIndex{}; |
| 126 | return createIndex(row, column, child_aspect); |
| 127 | } |
| 128 | |
| 129 | QModelIndex AspectTreeModel::parent(const QModelIndex& index) const { |
| 130 | if (!index.isValid()) |
no test coverage detected