]> git.siccegge.de Git - frida/frida.git/commitdiff
Change BasicBlockWidget and assume upperLeft is (0, 0) in local coordinates
authorChristoph Egger <christoph@anonymous.siccegge.de>
Fri, 28 Nov 2014 21:50:23 +0000 (22:50 +0100)
committerChristoph Egger <christoph@anonymous.siccegge.de>
Fri, 28 Nov 2014 21:50:23 +0000 (22:50 +0100)
src/gui/widgets/BasicBlockWidget.cxx
src/gui/widgets/BasicBlockWidget.hxx

index 0164bdc9513d67e541a2415ae7aa8cb1f9117a1a..7b33fe0a17fe43f530519c8e3c1544bae375b0d2 100644 (file)
@@ -1,11 +1,10 @@
 #include "BasicBlockWidget.hxx"
 
 BasicBlockWidget::BasicBlockWidget(const QString& name, BasicBlock * block)
-       : x(-5), y(-20)
-       , dx(270), dy(45)
-       , name(name)
-       , block(block) {
+       : width(270), height(45)
+       , name(name), block(block) {
        next[0] = NULL; next[1] = NULL;
+    _widget.move(5, 20);
     _widget.setGridStyle(Qt::NoPen);
     _widget.setMinimumHeight(_widget.rowHeight(0) + 10);
     _widget.setMaximumHeight(20);
@@ -17,8 +16,8 @@ BasicBlockWidget::BasicBlockWidget(const QString& name, BasicBlock * block)
     _widget.setColumnCount(3);
     _widget.verticalHeader()->hide();
     _widget.horizontalHeader()->hide();
-    dx = _widget.rowHeight(0) + 20;
-    if (dx < 270) dx = 270;
+    width = _widget.rowHeight(0) + 20;
+    if (width < 270) width = 270;
 }
 
 void BasicBlockWidget::addItem(uint8_t* bytes, size_t num_bytes,
@@ -59,7 +58,7 @@ void BasicBlockWidget::addItem(uint8_t* bytes, size_t num_bytes,
     _widget.setMaximumHeight(_widget.rowHeight(0) * (_widget.rowCount()) + 2);
 
 
-    dy = _widget.rowHeight(0) * (_widget.rowCount()) + 25;
-    dx = column_width + 10;
-    if (dx < 270) dx = 270;
+    height = _widget.rowHeight(0) * (_widget.rowCount()) + 25;
+    width = column_width + 10;
+    if (width < 270) width = 270;
 }
index 3c547b558ef10750c55d14201c30fb391565d858..bc579a90efaf7670dd5bfdd77a144145ae42a836 100644 (file)
@@ -15,8 +15,6 @@ public:
 
     QRectF boundingRect() const  {
         qreal penWidth = 1;
-               QRectF result(x - penWidth / 2, y - penWidth / 2,
-                      dx + penWidth, dy + penWidth);
 
 
                if (next[0]) {
@@ -32,6 +30,8 @@ public:
                        result |= QRectF(QPointF(x + 2*dx/3, y+dy),
                                                         mapFromScene(next[1]->getEntry()));
 
+               QRectF result(- penWidth / 2, - penWidth / 2,
+                      width + penWidth, height + penWidth);
         return result;
     }
        void mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
@@ -43,15 +43,15 @@ public:
        }
 
        QPointF getEntry() const {
-               return mapToScene(QPointF(x + dx/2, y));
+               return mapToScene(QPointF(width/2, 0));
        }
 
     void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
                QWidget *widget) {
-        painter->fillRect(x, y, dx, dy, QColor(0xcc, 0xcc, 0xff, 0xff));
+        painter->fillRect(0, 0, width, height, QColor(0xcc, 0xcc, 0xff, 0xff));
         painter->setPen(QColor(0x00, 0x00, 0xff, 0xff));
-        painter->drawRect(x, y, dx, dy);
-        painter->drawText(0, -5, name);
+        painter->drawRect(0, 0, width, height);
+        painter->drawText(5, 15, name);
                if (_widget.rowCount() != 0)
                        _widget.render(painter);
 
@@ -83,7 +83,7 @@ public:
        }
 
 private:
-    int x, y, dx, dy;
+    uint32_t width, height;
     QTableWidget _widget;
        QString name;
        BasicBlock * block;