QHBoxLayout *hlayout = new QHBoxLayout(this);
QPushButton *btn1 = new QPushButton;
QPushButton *btn2 = new QPushButton;
hlayout->addWidget(btn1);
hlayout->addWidget(btn2);
QPushButton *pbtn = dynamic_cast<QPushButton*>(hlayout->itemAt(0)->widget());
pbtn->setText("ok");
pbtn = dynamic_cast<QPushButton*>(hlayout->itemAt(1)->widget());
pbtn->setText("not ok");