From: Christoph Egger Date: Thu, 12 Mar 2015 15:46:00 +0000 (+0100) Subject: [BasicBlockWidget] Adjust inner widget size before drawing X-Git-Tag: v0.1~42 X-Git-Url: https://git.siccegge.de//index.cgi?a=commitdiff_plain;h=2227e316e52bbca8bec594d0bb487f6c0c2ba08f;p=frida%2Ffrida.git [BasicBlockWidget] Adjust inner widget size before drawing Adjust size of the innner QGraphicsTextItem before getting it's size for drawing the outer parts. That way the BasicBlockWidget always has the correct size matching it's content Closes: T20 --- diff --git a/src/gui/widgets/BasicBlockWidget.cxx b/src/gui/widgets/BasicBlockWidget.cxx index a2312c2..4889cb4 100644 --- a/src/gui/widgets/BasicBlockWidget.cxx +++ b/src/gui/widgets/BasicBlockWidget.cxx @@ -156,6 +156,7 @@ void BasicBlockWidget::addItem(uint8_t* bytes, size_t num_bytes, void BasicBlockWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem*, QWidget*) { + _widget->adjustSize(); width = 10 + _widget->boundingRect().width(); height = 25 + _widget->boundingRect().height(); if (width < 250) width = 250;