| 9 | #include <QtWidgets/QMenu> |
| 10 | |
| 11 | ModuleView::ModuleView(const DebuggerViewParameters& parameters) |
| 12 | : DebuggerView(parameters, MONOSPACE_FONT) |
| 13 | , m_model(new ModuleModel(cpu())) |
| 14 | { |
| 15 | m_ui.setupUi(this); |
| 16 | m_ui.moduleList->setModel(m_model); |
| 17 | m_ui.moduleList->horizontalHeader()->setSectionsMovable(true); |
| 18 | |
| 19 | m_ui.moduleList->setContextMenuPolicy(Qt::CustomContextMenu); |
| 20 | connect(m_ui.moduleList, &QTableView::customContextMenuRequested, this, &ModuleView::openContextMenu); |
| 21 | connect(m_ui.moduleList, &QTableView::doubleClicked, this, &ModuleView::onDoubleClick); |
| 22 | |
| 23 | m_ui.moduleList->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeMode::ResizeToContents); |
| 24 | for (std::size_t i = 0; auto mode : ModuleModel::HeaderResizeModes) |
| 25 | { |
| 26 | m_ui.moduleList->horizontalHeader()->setSectionResizeMode(i, mode); |
| 27 | i++; |
| 28 | } |
| 29 | |
| 30 | receiveEvent<DebuggerEvents::Refresh>([this](const DebuggerEvents::Refresh& event) -> bool { |
| 31 | if (!QtHost::IsVMPaused()) |
| 32 | m_model->refreshData(); |
| 33 | return true; |
| 34 | }); |
| 35 | |
| 36 | receiveEvent<DebuggerEvents::VMUpdate>([this](const DebuggerEvents::VMUpdate& event) -> bool { |
| 37 | m_model->refreshData(); |
| 38 | return true; |
| 39 | }); |
| 40 | } |
| 41 | |
| 42 | void ModuleView::openContextMenu(QPoint pos) |
| 43 | { |
nothing calls this directly
no test coverage detected