From ed6df986531337e089dd0b2c9c056c3f06f2e6d7 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Fri, 11 Aug 2023 11:05:33 +0200 Subject: [PATCH] Set progress bar timer to 500ms. Yield thread to give worker thread its share of CPU time. --- mainwindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index df5594f..5d53966 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -87,7 +87,7 @@ void MainWindow::customEvent(QEvent *event) { m_progressValue = progress; ui->updateProgress->setValue(progress/10); QApplication::postEvent(this, new ProgressEvent(this, progress+10)); - QThread::msleep(100); + QThread::msleep(500); } } } @@ -110,6 +110,8 @@ void MainWindow::customEvent(QEvent *event) { qCritical() << "!!! UNKNOWN SENDER !!!"; } } + + QThread::yieldCurrentThread(); } void MainWindow::onStopStartTimer() {