]> git.siccegge.de Git - frida/frida.git/commitdiff
Fix redraw bug -- call prepareGeometryChange()
authorChristoph Egger <christoph@christoph-egger.org>
Tue, 26 May 2015 18:38:47 +0000 (20:38 +0200)
committerChristoph Egger <christoph@christoph-egger.org>
Tue, 26 May 2015 18:38:47 +0000 (20:38 +0200)
"If you want to change the item's bounding rectangle, you must first
call prepareGeometryChange()." -- we are now doing so

src/gui/widgets/BasicBlockWidget.cxx
src/gui/widgets/BasicBlockWidget.hxx

index eee78c4ea55d06b47e672afeb10367967b3e8a30..e08cba5e86ac394751f7e3db3d6ac88f14ab88fc 100644 (file)
@@ -235,6 +235,7 @@ void BasicBlockWidget::populateWidget() {
        QGraphicsTextItem* item = _widget.get();
        item->setDocument(document);
        item->adjustSize();
+       updateSize();
 }
 
 QString BasicBlockWidget::formatComments(Instruction* inst) {
@@ -245,11 +246,16 @@ QString BasicBlockWidget::formatComments(Instruction* inst) {
        return (comments.empty() ? "" : ";; ") + comments.join("<br />").trimmed();
 }
 
-void BasicBlockWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem*,
-                  QWidget*) {
+void BasicBlockWidget::updateSize() {
+       prepareGeometryChange();
        width = 10 + _widget->boundingRect().width();
        height = 25 + _widget->boundingRect().height();
        if (width < 250) width = 250;
+}
+
+void BasicBlockWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem*,
+                  QWidget*) {
+       updateSize();
 
        painter->fillRect(0, 0, width, height, currentColor);
        painter->setPen(QColor(0x00, 0x00, 0xff, 0xff));
index 7c402c0a663bb4f89d8b0216ce6280aee5e752a6..ba1153ebacde883767cae2f42b39f0d37cc02e4e 100644 (file)
@@ -60,6 +60,7 @@ private:
        void populateWidget();
        void changeCommentHandler(ChangeCommentEvent* event);
        QString formatComments(Instruction* inst);
+       void updateSize();
 
        uint32_t width, height;
        QString name;