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 + 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) {
}
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);
}
private:
- int x, y, dx, dy;
+ uint32_t width, height;
QTableWidget _widget;
QString name;
BasicBlock * block;