Change the "widgetResizable" property of the scroll area to true. Also bear in mind your construction is very weird (or at least unusual). You allow test2 to be created with a parent and then you place it inside some other widget (the scroll area) that reparents the widget to itself. Furthermore there is no reference to the window (scroll area) outside the test2 object which leads to a certain memory leak.
Bookmarks