diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-11 17:45:47 +0100 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-11 17:45:47 +0100 |
commit | 10f4d52221438f0d5ce7cc72c5b6c1f6720ef5c6 (patch) | |
tree | 2bf2cf63384a5d83d29ccbd036ea8ca30a84918e /qtmips_gui/memorytableview.cpp | |
parent | 745a2aff8602a48b723a8d2ebf54b0e92cd17b30 (diff) | |
download | qtmips-10f4d52221438f0d5ce7cc72c5b6c1f6720ef5c6.tar.gz qtmips-10f4d52221438f0d5ce7cc72c5b6c1f6720ef5c6.tar.bz2 qtmips-10f4d52221438f0d5ce7cc72c5b6c1f6720ef5c6.zip |
Extend program view to support selected stage followup.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui/memorytableview.cpp')
-rw-r--r-- | qtmips_gui/memorytableview.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
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<MemoryModel*>(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<MemoryModel*>(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)); +} |