| 629 | // QAbstractItemModel methods |
| 630 | |
| 631 | QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override |
| 632 | { |
| 633 | if(!m_Ctx.IsCaptureLoaded()) |
| 634 | return QModelIndex(); |
| 635 | |
| 636 | // create fake root if the parent is invalid |
| 637 | if(!parent.isValid()) |
| 638 | return createIndex(0, column, TagRoot); |
| 639 | |
| 640 | // if the parent is the root, return the index for the specified child if it's in bounds |
| 641 | if(parent.internalId() == TagRoot) |
| 642 | { |
| 643 | // first child is the capture start |
| 644 | if(row == 0) |
| 645 | return createIndex(row, column, TagCaptureStart); |
| 646 | |
| 647 | // the rest are in the root action node |
| 648 | return GetIndexForActionChildRow(m_Nodes[0], row, column); |
| 649 | } |
| 650 | else if(parent.internalId() == TagCaptureStart) |
| 651 | { |
| 652 | // no children for this |
| 653 | return QModelIndex(); |
| 654 | } |
| 655 | else |
| 656 | { |
| 657 | // otherwise the parent is a real action |
| 658 | auto it = m_Nodes.find(parent.internalId()); |
| 659 | if(it != m_Nodes.end()) |
| 660 | return GetIndexForActionChildRow(*it, row, column); |
| 661 | } |
| 662 | |
| 663 | return QModelIndex(); |
| 664 | } |
| 665 | |
| 666 | QModelIndex parent(const QModelIndex &index) const override |
| 667 | { |
no test coverage detected