BasicBlockWidget::BasicBlockWidget(const QString& name, BasicBlock * block,
Mainwindow * mainwindow)
- : width(270), height(45)
- , _widget("", this)
- , _table(NULL), name(name)
+ : width(270), height(45), name(name)
+ , _widget("", this), _table(NULL)
, block(block), mainwindow(mainwindow) {
next[0] = NULL; next[1] = NULL;
+ _widget.setPos(5, 20);
_widget.setTextInteractionFlags(Qt::TextSelectableByMouse|
Qt::LinksAccessibleByMouse);
- _widget.setPos(5, 20);
-
if (width < 250) width = 250;
}
if (width < 250) width = 250;
}
+
+void BasicBlockWidget::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);
+}
+
+QRectF BasicBlockWidget::boundingRect() const {
+ qreal penWidth = 1;
+ QRectF result(- penWidth / 2, - penWidth / 2,
+ width + penWidth, height + penWidth);
+ return result;
+}
+
+std::array<QPointF, 3> BasicBlockWidget::getExits() const {
+ return { { mapToScene(QPointF( width/3, height)),
+ mapToScene(QPointF( width/2, height)),
+ mapToScene(QPointF(2*width/3, height)) } };
+}
+