How to get Qwidget that added to Vertical lay out
-
Hi, i add Some Widget to a Vertical lay out. now i want retrieve them like this:
@
for(int i =0; i < ui->verticalLayout_6->children().count(); i++)
{
QWidget* Widget = dynamic_cast<QWidget*>(ui->verticalLayout_6->children().at(i));
if(Widget != NULL)
{
for(int j = 0; j < Widget->children().count(); j++)
{
QLineEdit TempLine = dynamic_cast<QLineEdit>(Widget->children().at(j));
if(TempLine != NULL)
{
TempLine->setText("peida kardam :D :P");
}
}} }
@
but ui->verticalLayout_6->children().count(); returns 0. how can i retrieve them?
any idea?
another question is that how can change space between Pushbuttons that added to Vertical lay out. I use
@
ui->verticalLayout->setSpacing(1);
@
but i doesn't work.
any idea? -
Hi,
Since it looks like you have an UI file... Do you add your widgets programmatically ?