Skip to content

Instantly share code, notes, and snippets.

@jnareb
Created May 18, 2019 09:45
Show Gist options
  • Save jnareb/5a513d25c89aee09aa060d0bedd060cb to your computer and use it in GitHub Desktop.
Save jnareb/5a513d25c89aee09aa060d0bedd060cb to your computer and use it in GitHub Desktop.
Nieblokujące opóźnienie w aplikacjach napisanych za pomocą biblioteki Qt (np. do animacji)
void MainWindow::delay(int ms)
{
QTime endTime = QTime::currentTime().addMSecs(ms);
while (QTime::currentTime() < endTime)
QCoreApplication::processEvents(QEventLoop::AllEvents, 100 /* maxtime in ms */);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment