QHBoxLayout* hLayout = new QHBoxLayout(); hLayout->addWidget(new QLabel("Label 1")); hLayout->addWidget(new QLabel("Label 2")); hLayout->addWidget(new QLabel("Label 3")); QLabel* secondLabel = dynamic_castIn this example, we create a QHBoxLayout and add three QLabel widgets to it. We then use itemAt to retrieve the second widget (index 1) in the layout and cast it to a QLabel pointer. Finally, we set the text of the second label to "New Label Text". This example uses Qt library and is written in C++.(hLayout->itemAt(1)->widget()); if (secondLabel) secondLabel->setText("New Label Text");