<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<font face="Consolas">Hi,<br>
<br>
4-5 years I needed a widget</font> with the following properties:<br>
<br>
<ul>
<li>Display text incl. HTML</li>
<li>Text should be wrapped on several lines</li>
<li>When the widget is put into a layout, the height of the widget
should be adjusted in such a way that the text exactly fits the
widget geometry</li>
</ul>
<p>This subwidget should be used in a layout to provide some detail
on how the other GUI elements in the layout work but only consume
a minimum space to display its content.<br>
</p>
<p>I thought this was an easy one - but each time I return to the
challenge I always end by giving up.<br>
</p>
<p>The main problem is that the layout breaks down when
heightForWidth() is implemented and a QSizePolicy with
setHeightForWidth(True) is used. It can shrink to infinitely
small. Apparently this is Qt bug.<br>
</p>
<p>Another approach is to call updateGeometry() when a resizeEvent()
occurs and call setFixedHeight(h) using a width dependent height.
But this also gives rise to some weird layout behavior.<br>
</p>
<p>If anybody has any good suggestions on how to approach this,
please let me know. <br>
</p>
<p>I attach a small snippet that reproduces the layout resizing
behavior.<br>
</p>
<p>Best regards,<br>
</p>
<p>Mads<br>
<br>
</p>
<pre class="moz-signature" cols="72">--
+-----------------------------------------------------+
| Mads Ipsen |
+----------------------+------------------------------+
| Gåsebæksvej 7, 4. tv | |
| DK-2500 Valby | phone: +45-29716388 |
| Denmark | email: <a class="moz-txt-link-abbreviated" href="mailto:mads.ipsen@gmail.com">mads.ipsen@gmail.com</a> |
+----------------------+------------------------------+
</pre>
</body>
</html>