X-Git-Url: https://git.siccegge.de//index.cgi?p=frida%2Ffrida.git;a=blobdiff_plain;f=src%2Fgui%2Fwidgets%2FBasicBlockWidget.hxx;h=bc579a90efaf7670dd5bfdd77a144145ae42a836;hp=3c61121c75fa3da7f7e55894dc723c3f15e2e5be;hb=2c83a39c132aa0ea0ed0b771d160ada7691261f3;hpb=d51782798930575415d53300340ede3a004f1661 diff --git a/src/gui/widgets/BasicBlockWidget.hxx b/src/gui/widgets/BasicBlockWidget.hxx index 3c61121..bc579a9 100644 --- a/src/gui/widgets/BasicBlockWidget.hxx +++ b/src/gui/widgets/BasicBlockWidget.hxx @@ -15,18 +15,23 @@ public: QRectF boundingRect() const { qreal penWidth = 1; - QRectF result(x - penWidth / 2, y - penWidth / 2, - dx + penWidth, dy + penWidth); - if (next[0]) - result |= QRectF(QPointF(x + dx/3, y+dy), - mapFromScene(next[0]->getEntry())); - + if (next[0]) { + if (next[1]) { + result |= QRectF(QPointF(x + dx/3, y+dy), + mapFromScene(next[0]->getEntry())); + } else { + result |= QRectF(QPointF(x + dx/2, y+dy), + mapFromScene(next[0]->getEntry())); + } + } if (next[1]) 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) { @@ -38,23 +43,29 @@ 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); - painter->setPen(QColor(0x00, 0xff, 0x00, 0xff)); - if (next[0]) - painter->drawLine(QPointF(x + dx/3, y+dy), - mapFromScene(next[0]->getEntry())); - + if (next[0]) { + if (next[1]) { + painter->setPen(QColor(0x00, 0xff, 0x00, 0xff)); + painter->drawLine(QPointF(x + dx/3, y+dy), + mapFromScene(next[0]->getEntry())); + } else { + painter->setPen(QColor(0x00, 0x00, 0x00, 0xff)); + painter->drawLine(QPointF(x + dx/2, y+dy), + mapFromScene(next[0]->getEntry())); + } + } painter->setPen(QColor(0xff, 0x00, 0x00, 0xff)); if (next[1]) painter->drawLine(QPointF(x + 2*dx/3, y+dy), @@ -72,7 +83,7 @@ public: } private: - int x, y, dx, dy; + uint32_t width, height; QTableWidget _widget; QString name; BasicBlock * block;