]> git.siccegge.de Git - frida/frida.git/blobdiff - src/gui/widgets/BasicBlockWidget.hxx
Fix height of BasicBlockWidgets
[frida/frida.git] / src / gui / widgets / BasicBlockWidget.hxx
index effb5880665a9c4eeaed5baa2105ed7c4a7e9c39..7f4a0a36dfb791aff828b98e79f60bf741f4f4cf 100644 (file)
@@ -5,15 +5,25 @@ class BasicBlockWidget : public QGraphicsItem
 public:
     BasicBlockWidget(const QString& name)
                : x(-5), y(-20)
-               , dx(250), dy(270)
+               , dx(270), dy(45)
                , name(name) {
-        _widget.addItem("THIS");
-        _widget.addItem("IS");
-        _widget.addItem("A");
-        _widget.addItem("TEST");
-               _widget.resize(dx-20, dy-20);
+               _widget.setMinimumWidth(_widget.sizeHintForColumn(0) + 10);
+               _widget.setMaximumHeight(20);
+               dx = _widget.sizeHintForColumn(0) + 20;
+               if (dx < 270) dx = 270;
     }
 
+       void addItem(const QString& line) {
+               _widget.addItem(line);
+               _widget.updateGeometry();
+               _widget.setMinimumWidth(_widget.sizeHintForColumn(0) + 10);
+               _widget.setMinimumHeight(_widget.sizeHintForRow(0) * (1 + _widget.count()));
+               _widget.setMaximumHeight(_widget.sizeHintForRow(0) * (1 + _widget.count()));
+               dy = _widget.sizeHintForRow(0) * (1 + _widget.count()) + 25;
+               dx = _widget.sizeHintForColumn(0) + 20;
+               if (dx < 270) dx = 270;
+       }
+
     QRectF boundingRect() const
     {
         qreal penWidth = 1;