X-Git-Url: https://git.siccegge.de//index.cgi?p=frida%2Ffrida.git;a=blobdiff_plain;f=src%2Fgui%2Fwidgets%2FBasicBlockWidget.hxx;h=8ee33a56f21a43e6bcccfb26bbde48b6e395f58f;hp=5f225b8b9dd7da33ce31ff905aecdacb97d67788;hb=ac5817edcb30c89bc1e5fdcf3a124c3dc2e49630;hpb=588ce9942e60e7bd15038e6902797881bfdd9f6a diff --git a/src/gui/widgets/BasicBlockWidget.hxx b/src/gui/widgets/BasicBlockWidget.hxx index 5f225b8..8ee33a5 100644 --- a/src/gui/widgets/BasicBlockWidget.hxx +++ b/src/gui/widgets/BasicBlockWidget.hxx @@ -8,44 +8,45 @@ #include #include -class BasicBlockWidget : public QGraphicsItem +class Mainwindow; + +class BasicBlockWidget : public QObject, public QGraphicsItem { + Q_OBJECT public: - BasicBlockWidget(const QString& name, BasicBlock * block); + BasicBlockWidget(const QString& name, BasicBlock * block, Mainwindow * mainwindow); - void addItem(uint8_t* bytes, size_t num_bytes, const QString& line); + void addItem(uint8_t* bytes, size_t num_bytes, QString line, const QString& href); - QRectF boundingRect() const { - qreal penWidth = 1; + QRectF boundingRect() const { + qreal penWidth = 1; QRectF result(- penWidth / 2, - penWidth / 2, - width + penWidth, height + penWidth); - return result; - } + width + penWidth, height + penWidth); + return result; + } void mouseMoveEvent(QGraphicsSceneMouseEvent * event) { QGraphicsItem::mouseMoveEvent(event); - scene()->update(); + scene()->update(); } QPointF getEntry() const { return mapToScene(QPointF(width/2, 0)); } - std::array getExits() const { - return { { mapToScene(QPointF( width/3, height)), - mapToScene(QPointF( width/2, height)), - mapToScene(QPointF(2*width/3, height)) } }; - } + std::array getExits() const { + return { { mapToScene(QPointF( width/3, height)), + mapToScene(QPointF( width/2, height)), + mapToScene(QPointF(2*width/3, height)) } }; + } - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget) { - painter->fillRect(0, 0, width, height, QColor(0xcc, 0xcc, 0xff, 0xff)); - painter->setPen(QColor(0x00, 0x00, 0xff, 0xff)); - painter->drawRect(0, 0, width, height); - painter->drawText(5, 15, name); - if (_widget.rowCount() != 0) - _widget.render(painter, QPoint(5, 20)); - } + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, + QWidget *widget) { + painter->fillRect(0, 0, width, height, QColor(0xcc, 0xcc, 0xff, 0xff)); + painter->setPen(QColor(0x00, 0x00, 0xff, 0xff)); + painter->drawRect(0, 0, width, height); + painter->drawText(5, 15, name); + } void addPrevious(BasicBlockWidget * widget) { previous.push_back(widget); @@ -56,15 +57,20 @@ public: next[1] = right; } - BasicBlockWidget ** getNext() { - return next; - } + BasicBlockWidget ** getNext() { + return next; + } + QString getName() const { + return name; + } private: - uint32_t width, height; - QTableWidget _widget; + uint32_t width, height; + QGraphicsTextItem _widget; + QTextTable* _table; QString name; BasicBlock * block; + Mainwindow * mainwindow; std::vector previous; BasicBlockWidget* next[2]; };