C++ (Qt)#include <QtWidgets> class MyWin : public QWidget {public: MyWin( void ) : testNo(0) { resize(320, 240); QLayout * layout = new QVBoxLayout(this); setLayout(layout); lab1 = new QLabel("Lab 1", this); lab2 = new QLabel("Lab 2", this); QPushButton * btn = new QPushButton("Test", this); QObject::connect(btn, &QPushButton::pressed, this, &MyWin::Test); layout->addWidget(lab1); layout->addWidget(lab2); layout->addWidget(btn); } void Test( void ) { lab2->setUpdatesEnabled(false); for (int i = 0; i < 5; ++i) { ++testNo; lab1->setText("Lab1 Test " + QString::number(testNo)); lab2->setText("Lab2 Test " + QString::number(testNo)); qApp->processEvents(); QThread::sleep(1); } lab2->setUpdatesEnabled(true); } // data int testNo; QLabel * lab1, * lab2; }; int main( int argc, char **argv ) { QApplication app(argc, argv); MyWin * win = new MyWin; win->show(); app.exec();}