Qt/debugger: recenter the code widget when selecting a breakpoint

This commit is contained in:
aldelaro5 2018-05-05 22:55:10 -04:00
parent 53803c1fca
commit 09792fde70
No known key found for this signature in database
GPG Key ID: 054DD3E6FF48DB71
3 changed files with 15 additions and 0 deletions

View File

@ -80,6 +80,15 @@ void BreakpointWidget::CreateWidgets()
m_table->setEditTriggers(QAbstractItemView::NoEditTriggers);
m_table->verticalHeader()->hide();
connect(m_table, &QTableWidget::itemClicked, [this](QTableWidgetItem* item) {
if (m_table->selectedItems()[0]->row() == item->row() &&
Core::GetState() == Core::State::Paused)
{
auto address = m_table->selectedItems()[0]->data(Qt::UserRole).toUInt();
emit SelectedBreakpoint(address);
}
});
auto* layout = new QVBoxLayout;
layout->addWidget(m_toolbar);

View File

@ -29,6 +29,7 @@ public:
signals:
void BreakpointsChanged();
void SelectedBreakpoint(u32 address);
protected:
void closeEvent(QCloseEvent*) override;

View File

@ -54,6 +54,7 @@
#include "DolphinQt2/Config/Mapping/MappingWindow.h"
#include "DolphinQt2/Config/SettingsWindow.h"
#include "DolphinQt2/Debugger/BreakpointWidget.h"
#include "DolphinQt2/Debugger/CodeViewWidget.h"
#include "DolphinQt2/Debugger/CodeWidget.h"
#include "DolphinQt2/Debugger/JITWidget.h"
#include "DolphinQt2/Debugger/MemoryWidget.h"
@ -245,6 +246,10 @@ void MainWindow::CreateComponents()
&CodeWidget::Update);
connect(m_breakpoint_widget, &BreakpointWidget::BreakpointsChanged, m_memory_widget,
&MemoryWidget::Update);
connect(m_breakpoint_widget, &BreakpointWidget::SelectedBreakpoint, [this](u32 address) {
if (Core::GetState() == Core::State::Paused)
m_code_widget->SetAddress(address, CodeViewWidget::SetAddressUpdate::WithUpdate);
});
#if defined(HAVE_XRANDR) && HAVE_XRANDR
m_xrr_config = std::make_unique<X11Utils::XRRConfiguration>(