PDA

View Full Version : Scroll bars in scroll area not comming



aurora
27th December 2011, 08:54
Hi all,
Using Qt designer i created a Scroll area, and in run, dynamically adding widgets inside it...
But unfortunately, widgets are added but scroll bar not coming...Because of this only few widgets are visible....

I searched in forum, many r unresolved problems...
Please help me to sort out my problem
this is the code....

void MainWindow::on_pushButton_clicked()
{
QLabel *label =new QLabel;
label->setText("hello");
ui->verticalLayout->addWidget(label,10);


}


i set scroll bar policy as always on....

Lykurg
27th December 2011, 10:39
The sample code is useless! What is ui->verticalLayout? And calling ui->scrollArea->widgetResizable(); is superfluous.

aurora
27th December 2011, 11:23
The sample code is useless! What is ui->verticalLayout? And calling ui->scrollArea->widgetResizable(); is superfluous.
adding widget into layout, which is inside scrollarea....
Sorry Lykurg, i'm first time using this scroll area.....confused very much...please help me...

mattc
27th December 2011, 20:56
Calling scrollArea->widgetResizable() is useless indeed, but calling scrollArea->setWidgetResizable(true) might be a good idea (call it just after you create the scroll area)

Also, you can play with QScrollArea::setSizePolicy() (inherited from QWidget)