aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2018-02-05 12:04:34 +0100
committerKarel Kočí <cynerd@email.cz>2018-02-05 12:04:34 +0100
commitfc39f11e52ae7b3fa3073aab38fdd4eecbdc02d8 (patch)
tree1a50335066c9a83bbebe1d41a0387e3479a15e3d
parent2dc54ce36fd9f45082098e547436626676332188 (diff)
downloadqtmips-fc39f11e52ae7b3fa3073aab38fdd4eecbdc02d8.tar.gz
qtmips-fc39f11e52ae7b3fa3073aab38fdd4eecbdc02d8.tar.bz2
qtmips-fc39f11e52ae7b3fa3073aab38fdd4eecbdc02d8.zip
Fix widget docking for MemoryView
For some reason the layout resize resulted to different height then we counted out. So just calculate it on place instead.
-rw-r--r--qtmips_gui/memoryview.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/qtmips_gui/memoryview.cpp b/qtmips_gui/memoryview.cpp
index cd01d4a..beb364d 100644
--- a/qtmips_gui/memoryview.cpp
+++ b/qtmips_gui/memoryview.cpp
@@ -154,16 +154,17 @@ void MemoryView::Frame::check_update() {
int hpart = qMax(height()/10, MIN_OFF);
int req_height = height() + 2*hpart;
- while (!((content_y <= -hpart) && (content_y >= -2*hpart)) || (widg->height() <= req_height)) {
- int row_h = widg->row_size();
- // Calculate how many we need and how much we need to move and update content accordingly
- int count = (req_height / row_h) + 1;
- int shift = (content_y + hpart + hpart/2)/row_h;
- mv->update_content(count * widg->columns(), shift * widg->columns());
- // Move and resize widget
- content_y -= shift * row_h;
- widg->setGeometry(0, content_y, width(), widg->heightForWidth(width()));
- }
+ if (((content_y > -hpart) || (content_y < -2*hpart)) && (widg->height() >= req_height))
+ return;
+
+ int row_h = widg->row_size();
+ // Calculate how many we need and how much we need to move and update content accordingly
+ int count = (req_height / row_h) + 1;
+ int shift = (content_y + hpart + hpart/2)/row_h;
+ mv->update_content(count * widg->columns(), shift * widg->columns());
+ // Move and resize widget
+ content_y -= shift * row_h;
+ widg->setGeometry(0, content_y, width(), count * row_h);
mv->edit_load_focus();
}
@@ -172,7 +173,6 @@ 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) {