]> git.siccegge.de Git - frida/frida.git/commitdiff
Add horizontal space between BasicBlockWidgets
authorChristoph Egger <christoph@anonymous.siccegge.de>
Sat, 29 Nov 2014 00:22:34 +0000 (01:22 +0100)
committerChristoph Egger <christoph@anonymous.siccegge.de>
Sat, 29 Nov 2014 00:22:34 +0000 (01:22 +0100)
src/gui/widgets/CFGScene.cxx

index a297c856f3dd7dc8aa91e5a29e8d3c9da59cb7dc..81c973540f25aeeaccdf57891d92b5e77abf4a37 100644 (file)
@@ -61,12 +61,21 @@ void CFGScene::spaceWidgets() {
     } while (changed);
 
     for (BasicBlockWidget * widget : widgets) {
-        for (QGraphicsItem * item : widget->collidingItems()) {
-            while (widget->collidesWithItem(item)) {
-                if (widget->scenePos().x() > item->scenePos().x())
+        QRectF relevantRect = widget->boundingRect();
+        relevantRect.moveTo(widget->scenePos());
+        relevantRect.adjust(-20, -20, 20, 20);
+        for (QGraphicsItem * item : items(relevantRect)) {
+            if (item == widget) continue;
+            QRectF itemrect = item->boundingRect();
+            itemrect.moveTo(item->scenePos());
+            while (relevantRect.intersects(itemrect)) {
+                if (widget->scenePos().x() > item->scenePos().x()) {
                     widget->moveBy(1, 0);
-                else
+                    relevantRect.moveTo(widget->scenePos());
+                } else {
                     item->moveBy(1, 0);
+                    itemrect.moveTo(item->scenePos());
+                }
             }
         }
     }