aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui/programtableview.h
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-03-14 21:43:34 +0100
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-03-14 21:43:34 +0100
commit36747de2c73d3c11e30abd7b371cc5a5cf91a331 (patch)
treeb00c7e3acc62bd55bb51f66f0a0e627a3e1a510a /qtmips_gui/programtableview.h
parent0765d399e56aa387674c3591ec4886cc37d8fccd (diff)
downloadqtmips-36747de2c73d3c11e30abd7b371cc5a5cf91a331.tar.gz
qtmips-36747de2c73d3c11e30abd7b371cc5a5cf91a331.tar.bz2
qtmips-36747de2c73d3c11e30abd7b371cc5a5cf91a331.zip
Fix nested calls of setCurrentIndex which caused breakage.
ProgramTableView::focus_address() calls QAbstractItemView::setCurrentIndex(). verticalScrollBar() value is updated as result of current row change. This emits signal valueChanged which is connected to ProgramTableView::adjust_scroll_pos(). It checks if the limit of range covered by actual model and row to address offset is reached. If the top or bottom 1/8 of range is reached then model needs to be adjusted to cover continuation area. Model shift requires update of the current row to stay on the same address even that row 0 address offset is changed. This model shifting is required because range of scroll is only signed integer and QTableView is even more limited in row count to work reliably. Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui/programtableview.h')
-rw-r--r--qtmips_gui/programtableview.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/qtmips_gui/programtableview.h b/qtmips_gui/programtableview.h
index 5a67f51..6298d89 100644
--- a/qtmips_gui/programtableview.h
+++ b/qtmips_gui/programtableview.h
@@ -53,19 +53,22 @@ public:
void resizeEvent(QResizeEvent *event) override;
signals:
void address_changed(std::uint32_t address);
+ void adjust_scroll_pos_queue();
public slots:
void go_to_address(std::uint32_t address);
void focus_address(std::uint32_t address);
protected:
- void keyPressEvent(QKeyEvent *event);
+ void keyPressEvent(QKeyEvent *event);
private slots:
- void adjust_scroll_pos();
+ void adjust_scroll_pos_check();
+ void adjust_scroll_pos_process();
private:
void addr0_save_change(std::uint32_t val);
void adjustColumnCount();
QSettings *settings;
std::uint32_t initial_address;
+ bool adjust_scroll_pos_in_progress;
};
#endif // PROGRAMTABLEVIEW_H