[Qt-interest] QScrollArea with QStackedWidget?

Robert Hairgrove evorgriahr at hispeed.ch
Sun Aug 23 12:36:24 CEST 2009


Probably something of a beginner question here, but I can't seem to get 
it right.

I have a dialog which has a tree view on the left extending the entire 
height of the dialog window. It is in a vertical splitter. On the right 
side is a table view on the upper right, and below that a QStackedWidget 
with various pages. The table view and QStackedWidget are placed in a 
horizontal splitter layout. When the selection in the tree view is 
changed, a different page in the stacked widget and table view is 
displayed depending on the data.

Some of the pages of the stacked widget contain many child widgets and 
these extend beyond the default dimensions of the containing widget. I 
would like to enable scrolling for these pages, also so that the user 
can enlarge the other views if necessary and still be able to access the 
controls in the bottom stacked widget page. I tried adding a Scroll Area 
in QtDesigner to the pages of the stacked widget which need to scroll 
and moved the child widgets inside of the scroll area. However, when I 
preview the form, the scroll bars do not appear in spite of the fact 
that they are enabled to appear as needed.

What is the correct way to do this? Do I need to add the QStackedWidget 
as a child of the scroll area? What about the layouts?



More information about the Qt-interest-old mailing list