| 68 | } |
| 69 | |
| 70 | QModelIndex ElaNavigationModel::index(int row, int column, const QModelIndex& parent) const |
| 71 | { |
| 72 | if (!hasIndex(row, column, parent)) |
| 73 | { |
| 74 | return {}; |
| 75 | } |
| 76 | ElaNavigationNode* parentNode; |
| 77 | if (!parent.isValid()) |
| 78 | { |
| 79 | parentNode = _rootNode; |
| 80 | } |
| 81 | else |
| 82 | { |
| 83 | parentNode = static_cast<ElaNavigationNode*>(parent.internalPointer()); |
| 84 | } |
| 85 | ElaNavigationNode* childNode = nullptr; |
| 86 | if (parentNode->getChildrenNodes().count() > row) |
| 87 | { |
| 88 | if (parentNode == _rootNode && !_isMaximalMode) |
| 89 | { |
| 90 | childNode = parentNode->getExceptCategoryNodes().at(row); |
| 91 | } |
| 92 | else |
| 93 | { |
| 94 | childNode = parentNode->getChildrenNodes().at(row); |
| 95 | } |
| 96 | } |
| 97 | if (childNode) |
| 98 | { |
| 99 | childNode->setModelIndex(createIndex(row, column, childNode)); |
| 100 | return childNode->getModelIndex(); |
| 101 | } |
| 102 | return {}; |
| 103 | } |
| 104 | |
| 105 | int ElaNavigationModel::rowCount(const QModelIndex& parent) const |
| 106 | { |
no test coverage detected