| 768 | } |
| 769 | |
| 770 | void MemoryView::openContextMenu(QPoint pos) |
| 771 | { |
| 772 | if (!cpu().isAlive()) |
| 773 | return; |
| 774 | |
| 775 | QMenu* menu = new QMenu(this); |
| 776 | menu->setAttribute(Qt::WA_DeleteOnClose); |
| 777 | |
| 778 | QAction* copy_action = menu->addAction(tr("Copy Address")); |
| 779 | connect(copy_action, &QAction::triggered, this, [this]() { |
| 780 | QApplication::clipboard()->setText(QString::number(m_table.selectedAddress, 16).toUpper()); |
| 781 | }); |
| 782 | |
| 783 | createEventActions<DebuggerEvents::GoToAddress>(menu, [this]() { |
| 784 | DebuggerEvents::GoToAddress event; |
| 785 | event.address = m_table.selectedAddress; |
| 786 | return std::optional(event); |
| 787 | }); |
| 788 | |
| 789 | QAction* go_to_address_action = menu->addAction(tr("Go to Address")); |
| 790 | connect(go_to_address_action, &QAction::triggered, this, [this]() { contextGoToAddress(); }); |
| 791 | |
| 792 | QAction* follow_address_action = menu->addAction(tr("Follow Address")); |
| 793 | connect(follow_address_action, &QAction::triggered, this, [this]() { contextFollowAddress(); }); |
| 794 | |
| 795 | menu->addSeparator(); |
| 796 | |
| 797 | QAction* endian_action = menu->addAction(tr("Show as Little Endian")); |
| 798 | endian_action->setCheckable(true); |
| 799 | endian_action->setChecked(m_table.GetLittleEndian()); |
| 800 | connect(endian_action, &QAction::triggered, this, [this, endian_action]() { |
| 801 | m_table.SetLittleEndian(endian_action->isChecked()); |
| 802 | }); |
| 803 | |
| 804 | const MemoryViewType current_view_type = m_table.GetViewType(); |
| 805 | |
| 806 | // View Types |
| 807 | QActionGroup* view_type_group = new QActionGroup(menu); |
| 808 | view_type_group->setExclusive(true); |
| 809 | |
| 810 | QAction* byte_action = menu->addAction(tr("Show as 1 byte")); |
| 811 | byte_action->setCheckable(true); |
| 812 | byte_action->setChecked(current_view_type == MemoryViewType::BYTE); |
| 813 | connect(byte_action, &QAction::triggered, this, [this]() { m_table.SetViewType(MemoryViewType::BYTE); }); |
| 814 | view_type_group->addAction(byte_action); |
| 815 | |
| 816 | QAction* bytehw_action = menu->addAction(tr("Show as 2 bytes")); |
| 817 | bytehw_action->setCheckable(true); |
| 818 | bytehw_action->setChecked(current_view_type == MemoryViewType::BYTEHW); |
| 819 | connect(bytehw_action, &QAction::triggered, this, [this]() { m_table.SetViewType(MemoryViewType::BYTEHW); }); |
| 820 | view_type_group->addAction(bytehw_action); |
| 821 | |
| 822 | QAction* word_action = menu->addAction(tr("Show as 4 bytes")); |
| 823 | word_action->setCheckable(true); |
| 824 | word_action->setChecked(current_view_type == MemoryViewType::WORD); |
| 825 | connect(word_action, &QAction::triggered, this, [this]() { m_table.SetViewType(MemoryViewType::WORD); }); |
| 826 | view_type_group->addAction(word_action); |
| 827 |
nothing calls this directly
no test coverage detected