aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2018-01-27 17:12:16 +0100
committerKarel Kočí <cynerd@email.cz>2018-01-27 17:12:16 +0100
commit2dc54ce36fd9f45082098e547436626676332188 (patch)
tree7b39bf7e1b84e3e02733fbf2c99b8dedb0dd1537 /qtmips_gui
parent03135c40ddb11f9274612aa0fa001c24ac7dd599 (diff)
downloadqtmips-2dc54ce36fd9f45082098e547436626676332188.tar.gz
qtmips-2dc54ce36fd9f45082098e547436626676332188.tar.bz2
qtmips-2dc54ce36fd9f45082098e547436626676332188.zip
Fix focus to take in account number of columns
Diffstat (limited to 'qtmips_gui')
-rw-r--r--qtmips_gui/memoryview.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/qtmips_gui/memoryview.cpp b/qtmips_gui/memoryview.cpp
index a55dea0..cd01d4a 100644
--- a/qtmips_gui/memoryview.cpp
+++ b/qtmips_gui/memoryview.cpp
@@ -136,7 +136,7 @@ MemoryView::Frame::Frame(MemoryView *parent) : QAbstractScrollArea(parent) {
}
void MemoryView::Frame::focus(unsigned i) {
- content_y = (FOCUS*height()) - widg->row_size()*i - widg->row_size()/2;
+ content_y = (FOCUS*height()) - widg->row_size()*i/widg->columns() - widg->row_size()/2;
viewport()->move(0, content_y);
viewport()->repaint(0, content_y, width(), height());
check_update();
@@ -144,7 +144,7 @@ void MemoryView::Frame::focus(unsigned i) {
// Calculate which row is in focus at the moment
unsigned MemoryView::Frame::focussed() {
- int h = (FOCUS*height() - content_y) / widg->row_size();
+ int h = (FOCUS*height() - content_y) / widg->row_size() * widg->columns();
return qMax(h, 0);
}
@@ -172,6 +172,7 @@ void MemoryView::Frame::resizeEvent(QResizeEvent *e) {
QAbstractScrollArea::resizeEvent(e);
widg->setGeometry(0, content_y, e->size().width(), widg->heightForWidth(e->size().width()));
check_update();
+
}
void MemoryView::Frame::wheelEvent(QWheelEvent *e) {