Qt Layout Squashing

I’ve encountered this problem a handful of times over the past few years using Qt’s layouts. Qt generally does a great job making sure that your Windows cannot be resized too small such that your content would be truncated. However, it seems that introducing a QStackedWidget causes a problem.

These two screenshots illustrate the issue:

Screenshot 1 The widget prior to resizing (all text appears correctly)

Screenshot 2 The user resizes the widget (the text is truncated)

Like I said above, I think the problem is caused by the QStackedWidget. Without it, Qt properly limits the widget’s minimum size such that the text cannot be truncated. I would love it if the Trolls could have a look at this issue. I’ve seen the problem since Qt 4.0, but I never reduced the problem to its base (it took a while to deduce that the QStackedWidget was the culprit).

If you’re interested, I’ve included the minimal Designer UI file that shows the problem (right click that link to save it). I used Designer 4.6.2 to create this file.

Has one comment to “Qt Layout Squashing”

You can leave a reply or Trackback this post.
  1. There’s a Qt bug logged here:

    http://bugreports.qt.nokia.com/browse/QTBUG-5838

    And here’s a link to a discussion I had with other Qt’ers:

    http://lists.trolltech.com/pipermail/qt-interest/2010-March/thread.html#20198