"If you want to change the item's bounding rectangle, you must first
call prepareGeometryChange()." -- we are now doing so
QGraphicsTextItem* item = _widget.get();
item->setDocument(document);
item->adjustSize();
QGraphicsTextItem* item = _widget.get();
item->setDocument(document);
item->adjustSize();
}
QString BasicBlockWidget::formatComments(Instruction* inst) {
}
QString BasicBlockWidget::formatComments(Instruction* inst) {
return (comments.empty() ? "" : ";; ") + comments.join("<br />").trimmed();
}
return (comments.empty() ? "" : ";; ") + comments.join("<br />").trimmed();
}
-void BasicBlockWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem*,
- QWidget*) {
+void BasicBlockWidget::updateSize() {
+ prepareGeometryChange();
width = 10 + _widget->boundingRect().width();
height = 25 + _widget->boundingRect().height();
if (width < 250) width = 250;
width = 10 + _widget->boundingRect().width();
height = 25 + _widget->boundingRect().height();
if (width < 250) width = 250;
+}
+
+void BasicBlockWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem*,
+ QWidget*) {
+ updateSize();
painter->fillRect(0, 0, width, height, currentColor);
painter->setPen(QColor(0x00, 0x00, 0xff, 0xff));
painter->fillRect(0, 0, width, height, currentColor);
painter->setPen(QColor(0x00, 0x00, 0xff, 0xff));
void populateWidget();
void changeCommentHandler(ChangeCommentEvent* event);
QString formatComments(Instruction* inst);
void populateWidget();
void changeCommentHandler(ChangeCommentEvent* event);
QString formatComments(Instruction* inst);
uint32_t width, height;
QString name;
uint32_t width, height;
QString name;