X-Git-Url: https://git.siccegge.de//index.cgi?p=frida%2Ffrida.git;a=blobdiff_plain;f=src%2Fgui%2Fwidgets%2FBasicBlockWidget.hxx;h=2122bf208e6b55fa5323367fb4fd496a4c5dfeaf;hp=8c86667f7c9a480e5a32d2eb8745dc50c49841aa;hb=e75c3d69cb2ebf78e156932deb136c0346b10234;hpb=119d1aff7df9c3235177c3bf55bd618feb3c1519 diff --git a/src/gui/widgets/BasicBlockWidget.hxx b/src/gui/widgets/BasicBlockWidget.hxx index 8c86667..2122bf2 100644 --- a/src/gui/widgets/BasicBlockWidget.hxx +++ b/src/gui/widgets/BasicBlockWidget.hxx @@ -8,62 +8,44 @@ #include #include -class BasicBlockWidget : public QGraphicsItem +class Mainwindow; + +class BasicBlockWidget : public QObject, public QGraphicsItem { + Q_OBJECT public: - BasicBlockWidget(const QString& name, BasicBlock * block); - - void addItem(uint8_t* bytes, size_t num_bytes, const QString& line); - - QRectF boundingRect() const { - qreal penWidth = 1; - QRectF result(- penWidth / 2, - penWidth / 2, - width + penWidth, height + penWidth); - return result; - } + BasicBlockWidget(const QString& name, BasicBlock * block, Mainwindow * mainwindow); - void mouseMoveEvent(QGraphicsSceneMouseEvent * event) { - QGraphicsItem::mouseMoveEvent(event); - scene()->update(); - } - - QPointF getEntry() const { - return mapToScene(QPointF(width/2, 0)); - } + void addItem(uint8_t* bytes, size_t num_bytes, QString line, const QString& href); + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, + QWidget *widget); + QRectF boundingRect() const; + std::array getExits() const; - std::array getExits() const { - return { { mapToScene(QPointF( width/3, height)), - mapToScene(QPointF( width/2, height)), - mapToScene(QPointF(2*width/3, height)) } }; - } + void mouseMoveEvent(QGraphicsSceneMouseEvent * event) + { QGraphicsItem::mouseMoveEvent(event); scene()->update(); } - 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); - } + QPointF getEntry() const + { return mapToScene(QPointF(width/2, 0)); } - void addPrevious(BasicBlockWidget * widget) { - previous.push_back(widget); - } + void addPrevious(BasicBlockWidget * widget) + { previous.push_back(widget); } - void addNext(BasicBlockWidget * left, BasicBlockWidget * right) { - next[0] = left; - next[1] = right; - } + void addNext(BasicBlockWidget * left, BasicBlockWidget * right) + { next[0] = left; next[1] = right; } - BasicBlockWidget ** getNext() { - return next; - } + BasicBlockWidget ** getNext() + { return next; } + QString getName() const + { return name; } private: uint32_t width, height; - QGraphicsProxyWidget _proxy; - QLabel _widget; QString name; - BasicBlock * block; + QGraphicsTextItem _widget; + QTextTable* _table; + BasicBlock* block; + Mainwindow* mainwindow; std::vector previous; BasicBlockWidget* next[2]; };