[Solved] Scroll Area
-
can i put a layout into a scroll area. cuz when i did tht i could get any scroll bars. I have a series of labels put into layouts. I have tried to put the layout into the scrollarea.
It doesn work. Any other alternative?? Shouldi put the labels directly on to the scroll area
Thanks
alfah
-
andre
@
QScrollArea *scrollarea = new QScrollArea();controlLayout=new QVBoxLayout; controlLayoutSec=new QVBoxLayout; controlLayout->addWidget(lblBlnk); controlLayoutSec->addWidget(lblBlnk); hLayout3->addLayout(controlLayout); hLayout3->addSpacing(50); hLayout3->addLayout(controlLayoutSec); scrollarea->setWidget(hLayout3);
@
I have done somethin like tht but the scrol bars do not appear
-
i got the program runnin but no widgets are displayed!!!!
@
QHBoxLayout *hLayout3 = new QHBoxLayout;
QLabel *lblBlnk =new QLabel();QScrollArea *scrollarea = new QScrollArea(); controlLayout=new QVBoxLayout; controlLayoutSec=new QVBoxLayout; controlLayout->addWidget(lblBlnk); controlLayoutSec->addWidget(lblBlnk); hLayout3->addLayout(controlLayout); hLayout3->addSpacing(50); hLayout3->addLayout(controlLayoutSec); QWidget *baseArea = new QWidget(); baseArea->setLayout(hLayout3); scrollarea->setWidget(baseArea); scrollarea->widget()->setLayout(hLayout3); QHBoxLayout *hLayoutScrollArea = new QHBoxLayout; hLayoutScrollArea->addWidget(scrollarea); secondLbl =new QLabel(); secondLbl->setText(" "); vLayout=new QVBoxLayout; vLayout->addWidget(lblHeader); vLayout->addSpacing(50); vLayout->addLayout(hLayout1); vLayout->addWidget(lblTitle2); vLayout->addLayout(hLayout2); vLayout->addLayout(hLayoutScrollArea); vLayout->addWidget(secondLbl);
@
-
Found tht something is displayed, but its not legible.
I have put the scroll area into another layout. and finally all the layouts are put into one single vLayout.
I have done this so as to display in another class containing tabs, so the final vLayout goes into the another widget and then displayed on tabs -
-
:D i got it right. It was jus that the widgets were not stretched. There is a property called setWidgetResizable(true) which automatically adjusts the size of widgets. :)
solution:
after you create a scroll area jus add the following line
@
scrollarea->setWidgetResizable(true);
@Au Revoir :D
alfah