3 class BasicBlockWidget : public QGraphicsItem
6 BasicBlockWidget(const QString& name)
10 _widget.setMinimumWidth(_widget.sizeHintForColumn(0) + 10);
11 dy = _widget.sizeHint().height() + 20;
12 dx = _widget.sizeHintForColumn(0) + 10;
13 if (dx < 270) dx = 270;
16 void addItem(const QString& line) {
17 _widget.addItem(line);
18 _widget.setMinimumWidth(_widget.sizeHintForColumn(0));
19 dy = _widget.sizeHint().height() + 20;
20 dx = _widget.sizeHintForColumn(0) + 10;
21 if (dx < 270) dx = 270;
24 QRectF boundingRect() const
27 return QRectF(x - penWidth / 2, y - penWidth / 2,
28 dx + penWidth, dy + penWidth);
31 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
34 painter->fillRect(x, y, dx, dy, QColor(0xcc, 0xcc, 0xff, 0xff));
35 painter->setPen(QColor(0x00, 0x00, 0xff, 0xff));
36 painter->drawRect(x, y, dx, dy);
37 painter->drawText(0, -5, name);
38 _widget.render(painter);