From b5f582057f66328e643cdff8181308fba7641185 Mon Sep 17 00:00:00 2001 From: Christoph Egger Date: Tue, 27 May 2014 17:24:27 +0200 Subject: [PATCH 1/1] resize widgets to fit content --- src/gui/widgets/BasicBlockWidget.hxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/BasicBlockWidget.hxx b/src/gui/widgets/BasicBlockWidget.hxx index ec443f3..803331c 100644 --- a/src/gui/widgets/BasicBlockWidget.hxx +++ b/src/gui/widgets/BasicBlockWidget.hxx @@ -7,11 +7,18 @@ public: : x(-5), y(-20) , dx(250), dy(270) , name(name) { - _widget.resize(dx-20, dy-20); + _widget.setMinimumWidth(_widget.sizeHintForColumn(0) + 10); + dy = _widget.sizeHint().height() + 20; + dx = _widget.sizeHintForColumn(0) + 10; + 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; + if (dx < 270) dx = 270; } QRectF boundingRect() const -- 2.39.2