From 10f4d52221438f0d5ce7cc72c5b6c1f6720ef5c6 Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Mon, 11 Feb 2019 17:45:47 +0100 Subject: Extend program view to support selected stage followup. Signed-off-by: Pavel Pisa --- qtmips_gui/memorytableview.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'qtmips_gui/memorytableview.cpp') diff --git a/qtmips_gui/memorytableview.cpp b/qtmips_gui/memorytableview.cpp index 18e1bb1..e2386fa 100644 --- a/qtmips_gui/memorytableview.cpp +++ b/qtmips_gui/memorytableview.cpp @@ -167,7 +167,7 @@ void MemoryTableView::resizeEvent(QResizeEvent *event) { } } -void MemoryTableView:: go_to_address(std::uint32_t address) { +void MemoryTableView::go_to_address(std::uint32_t address) { MemoryModel *m = dynamic_cast(model()); int row; if (m == nullptr) @@ -179,3 +179,15 @@ void MemoryTableView:: go_to_address(std::uint32_t address) { addr0_save_change(address); emit m->update_all(); } + +void MemoryTableView::focus_address(std::uint32_t address) { + int row; + MemoryModel *m = dynamic_cast(model()); + if (m == nullptr) + return; + if (!m->get_row_for_address(row, address)) + go_to_address(address); + if (!m->get_row_for_address(row, address)) + return; + setCurrentIndex(m->index(row, 1)); +} -- cgit v1.2.3