PDA

View Full Version : scrollbar to QTabWidget



mkkguru
29th January 2010, 12:19
Hi,
How to add Scrollbar or ScrollArea in TabWidget..



plcconfiguration::plcconfiguration(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);

QTabWidget *main_tab_widget = new QTabWidget;
main_tab_widget->setTabPosition(QTabWidget::South);

scrollArea1 = new QScrollArea;
PLCconfig = new plcconfiguration;
scrollArea1->setWidget(PLCconfig);

main_tab_widget->insertTab(0,PLCconfig, "PLC");
QHBoxLayout *centralLayout1 = new QHBoxLayout;
centralLayout1->addWidget(scrollArea1,1);



above is not working for me ,can you tell me how can i do ?

faldzip
29th January 2010, 12:52
1. Nice try, but you still did not use CODE tags...
2. If you want to add ScrollArea to tab widget you have to... add QScrollArea to tab widget. In your code you have added PLCconfig to the tab widget, not scroll area. Then you have created some layout and added scroll area which doesn't make much sense as this layout is not used in any widget. And you even don't need this layout at all.

All you need is to create scroll area (QScrollArea) add your widget (PLCconfig) to it and then insert scroll area to tab widget.

mkkguru
30th January 2010, 04:46
1. Nice try, but you still did not use CODE tags...
2. If you want to add ScrollArea to tab widget you have to... add QScrollArea to tab widget. In your code you have added PLCconfig to the tab widget, not scroll area. Then you have created some layout and added scroll area which doesn't make much sense as this layout is not used in any widget. And you even don't need this layout at all.

All you need is to create scroll area (QScrollArea) add your widget (PLCconfig) to it and then insert scroll area to tab widget.


Hi,

Thanks i got my requirement....