PDA

View Full Version : sizepolicies, QScrollArea, and tabwidgets



method
18th December 2009, 16:08
i want to add a scrollarea to a tabwidget, and have the scrollarea expand to the available size in its tab.

i can't seem to get the scrollarea to size properly, it is always either undersized in both directions, or far far too wide and still too short.

can someone kindly point me in the right direction?

ChiliPalmer
18th December 2009, 23:35
I guess the simplest thing to do would be to put a layout into the tabpage and the scrollarea into the layout. Like this:


QTabWidget *tabWidget = new QTabWidget();
QWidget *widget = new QWidget(tabWidget );
QScrollArea *sa = new QScrollArea(widget );
QVBoxLayout *layout = new QVBoxLayout(widget);

layout->addWidget(sa);
tabWidget->addTab(widget, "Tada");