Ok, I seem to have fixed the stretching problem and the lack of scrollbars.
I had previously tried placing everything in a VBoxLayout, but that didn't work. I compared what I was doing to the source code of another program which worked. The difference was that in the designer, the layout in the working example had its properties combined with the widget properties. Whereas, in mine the VBoxLayout had its own separate properties and its own entry in the object list.
So, I compared the UI files. In mine there was a second top level widget definition, not present in the working example:
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>254</width>
<height>381</height>
</rect>
</property>
.
.
.
</widget>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>254</width>
<height>381</height>
</rect>
</property>
.
.
.
</widget>
To copy to clipboard, switch view to plain text mode
I manually edited the UI file to remove this which left me with the layout at the top level (below the first widget definition):
<layout class="QVBoxLayout" name="verticalLayout">
.
.
.
</layout>
<layout class="QVBoxLayout" name="verticalLayout">
.
.
.
</layout>
To copy to clipboard, switch view to plain text mode
And the moral of the story is don't use the designer, code everything manually!
Bookmarks