BasicBlockWidget::BasicBlockWidget(const QString& name, BasicBlock * block)
: width(270), height(45)
- , name(name), block(block) {
+ , name(name), block(block)
+ , _proxy(this) {
next[0] = NULL; next[1] = NULL;
- _widget.move(5, 20);
+ _proxy.setWidget(&_widget);
+ _widget.setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::LinksAccessibleByMouse);
+
+ _proxy.setPos(5, 20);
if (width < 270) width = 270;
}
QString old_text = _widget.text();
if (old_text == "") {
- old_text = "<table style=\"background-color: #ccccff;\">";
+ old_text = "<table style=\"background-color: #ddddff;\">";
}
QString new_text =
old_text.remove("</table>") +
"</td></tr></table>";
_widget.setText(new_text);
+ _widget.resize(_widget.sizeHint().width(), _widget.sizeHint().height());
width = 12 + _widget.sizeHint().width();
height = 25 + _widget.sizeHint().height();
painter->setPen(QColor(0x00, 0x00, 0xff, 0xff));
painter->drawRect(0, 0, width, height);
painter->drawText(5, 15, name);
- if (_widget.text() != "")
- _widget.render(painter, QPoint(5, 20));
}
void addPrevious(BasicBlockWidget * widget) {
private:
uint32_t width, height;
+ QGraphicsProxyWidget _proxy;
QLabel _widget;
QString name;
BasicBlock * block;
relevantRect.adjust(-20, -20, 20, 20);
for (QGraphicsItem * item : items(relevantRect)) {
if (item == widget) continue;
+ if (std::find(widgets.begin(), widgets.end(), item) == widgets.end()) continue;
QRectF itemrect = item->boundingRect();
itemrect.moveTo(item->scenePos());
while (relevantRect.intersects(itemrect)) {