Hi all!
Tell me, please, how can I make a delay before the next action. In this case, I still need to update the progress bar.
Code:
void ClassName::start() { action1(); /* Here I need to wait a while, update the progress bar, and go further */ action2(); emit finished(); }
I tried to do it this way, but it does not work.
Code:
void ClassName::start() { timer->setSingleShot(true); timerCount = 10; //timer = new QTimer(); timer->start(timerCount * 1000); while (timer->remainingTime() >= 0) { //qDebug() << smallLabel; emit smallLabelEmit(smallLabel); if (timer->remainingTime() == 0) { timer->stop(); } else { emit progressBarEmit(100 - 100 * timer->remainingTime() / timerCount); } } for (int i = 0; i < 7; i++) { emit open(i); } for (int i = 0; i < 7; i++) { emit close(i); } emit finished(); }
Thanks!