diff --git a/src/blackgui/components/dbautostashingcomponent.cpp b/src/blackgui/components/dbautostashingcomponent.cpp index efc2673f1..c612bb5f5 100644 --- a/src/blackgui/components/dbautostashingcomponent.cpp +++ b/src/blackgui/components/dbautostashingcomponent.cpp @@ -221,7 +221,7 @@ namespace BlackGui if (c % 25 == 0) { Q_ASSERT_X(c <= all, Q_FUNC_INFO, "illegal numbers"); - QCoreApplication::processEvents(QEventLoop::AllEvents, 100); + sGui->processEventsToRefreshGui(); int percent = c * 100 / all; if (max < all) @@ -235,7 +235,7 @@ namespace BlackGui } this->updateGuiValues(100); - QCoreApplication::processEvents(QEventLoop::AllEvents, 100); + sGui->processEventsToRefreshGui(); const CStatusMessage stashedMsg(categgories(), CStatusMessage::SeverityInfo, QString("Ready to auto stashed %1 models").arg(autoStashed.size())); this->addStatusMessage(stashedMsg); diff --git a/src/blackgui/guiapplication.cpp b/src/blackgui/guiapplication.cpp index a9d837c89..c9924fdab 100644 --- a/src/blackgui/guiapplication.cpp +++ b/src/blackgui/guiapplication.cpp @@ -72,6 +72,11 @@ namespace BlackGui } } + void CGuiApplication::processEventsToRefreshGui() const + { + QCoreApplication::processEvents(QEventLoop::AllEvents, 100); + } + QWidget *CGuiApplication::mainApplicationWindow() { return CGuiUtility::mainApplicationWindow(); diff --git a/src/blackgui/guiapplication.h b/src/blackgui/guiapplication.h index 592a01af9..f876ef66e 100644 --- a/src/blackgui/guiapplication.h +++ b/src/blackgui/guiapplication.h @@ -54,6 +54,9 @@ namespace BlackGui //! Window mode (window flags) CEnableForFramelessWindow::WindowMode getWindowMode() const; + //! Allow the GUI to refresh by processing events + void processEventsToRefreshGui() const; + //! Init the main application window based on information in this application void initMainApplicationWindow(QWidget *mainWindow) const; diff --git a/src/swiftcore/swiftcore.cpp b/src/swiftcore/swiftcore.cpp index 4e17c2ddd..e96336333 100644 --- a/src/swiftcore/swiftcore.cpp +++ b/src/swiftcore/swiftcore.cpp @@ -135,7 +135,7 @@ void CSwiftCore::startCore(const QString &dBusAdress) ui->pb_StartCore->setEnabled(false); ui->pb_StopCore->setEnabled(true); ui->gb_DBusMode->setDisabled(true); - QCoreApplication::processEvents(QEventLoop::AllEvents, 100); + sGui->processEventsToRefreshGui(); // context connect(ui->le_CommandLineInput, &CCommandInput::commandEntered, sGui->getCoreFacade(), &CCoreFacade::parseCommandLine); @@ -146,7 +146,7 @@ void CSwiftCore::stopCore() ui->pb_StartCore->setEnabled(true); ui->pb_StopCore->setEnabled(false); ui->gb_DBusMode->setDisabled(false); - QCoreApplication::processEvents(QEventLoop::AllEvents, 100); + sGui->processEventsToRefreshGui(); sGui->exit(); } diff --git a/src/swiftguistandard/swiftguistd.cpp b/src/swiftguistandard/swiftguistd.cpp index de242f508..1904152ed 100644 --- a/src/swiftguistandard/swiftguistd.cpp +++ b/src/swiftguistandard/swiftguistd.cpp @@ -103,7 +103,7 @@ void SwiftGuiStd::performGracefulShutdown() this->ui->comp_MainInfoArea->dockAllWidgets(); // allow some other parts to react - QApplication::processEvents(QEventLoop::AllEvents, 100); + sGui->processEventsToRefreshGui(); // tell GUI components to shut down emit requestGracefulShutdown(); @@ -115,7 +115,7 @@ void SwiftGuiStd::performGracefulShutdown() } // allow some other parts to react - QApplication::processEvents(QEventLoop::AllEvents, 100); + sGui->processEventsToRefreshGui(); } void SwiftGuiStd::closeEvent(QCloseEvent *event)