PDA

View Full Version : Adding ScrolBar to QWidget obj of TabWidget



reticent
31st July 2010, 12:07
Hi,

I have a TabWidget and each tab is a QWidget. One of the tabs have elements added dynamically and when elements exceeded the scrollBar has to appear.
I tried using QScrollArea but its not working for me. My app look like this

xWidget = new QTabWidget();
yWidget = new QTabWidget();
central->addTab(xWidget);
central->addTab(yWidget);

QVBoxLayout *vLayout = new QVBoxLayout;
vLayout->addWidget(...);
vLayout->addWidget(...);
vLayout->addLayout(...);
xWidget->setLayout(vLayout);
QScrollArea *scrollArea = new QScrollArea;
scrollArea->setWidget(xWidget);

Here the widgets added are those that are children of xWidget.
Can anyone please let me how can I add scrollBar here.

Thanks.