Fix height of BasicBlockWidgets
authorChristoph Egger <christoph@christoph-egger.org>
Sat, 31 May 2014 10:25:44 +0000 (12:25 +0200)
committerChristoph Egger <christoph@christoph-egger.org>
Sat, 31 May 2014 10:25:44 +0000 (12:25 +0200)
src/gui/widgets/BasicBlockWidget.hxx

index 803331c7cfd9a597750daaeb31041c413041a190..7f4a0a36dfb791aff828b98e79f60bf741f4f4cf 100644 (file)
@@ -5,19 +5,22 @@ class BasicBlockWidget : public QGraphicsItem
 public:
     BasicBlockWidget(const QString& name)
                : x(-5), y(-20)
-               , dx(250), dy(270)
+               , dx(270), dy(45)
                , name(name) {
                _widget.setMinimumWidth(_widget.sizeHintForColumn(0) + 10);
-               dy = _widget.sizeHint().height() + 20;
-               dx = _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.setMinimumWidth(_widget.sizeHintForColumn(0));
-               dy = _widget.sizeHint().height() + 20;
-               dx = _widget.sizeHintForColumn(0) + 10;
+               _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;
        }