From a85d03d807bb7b5a36e251fb48e64be680ac4f2b Mon Sep 17 00:00:00 2001 From: Benjamin Nauck Date: Sun, 20 Oct 2024 18:40:19 +0200 Subject: [PATCH 1/2] Revert "Make sure splasher is stopped before showing dialog" This reverts commit 104a3b90b018dcc53785010d659c9c2039e757ae. --- src/Gui/Application.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index db81ac6629..729f34f1d4 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -975,10 +975,6 @@ void Application::checkForRecomputes() { return; WaitCursor wc; wc.restoreCursor(); - - // Splasher is shown ontop of warnings on macOS so stop it before it's too late - getMainWindow()->stopSplasher(); - auto res = QMessageBox::warning(getMainWindow(), QObject::tr("Recomputation required"), QObject::tr("Some document(s) require recomputation for migration purposes. " "It is highly recommended to perform a recomputation before " From d569098cb6ec7cd36ad66dfb48b72b6d4a77e67e Mon Sep 17 00:00:00 2001 From: Benjamin Nauck Date: Sun, 20 Oct 2024 18:59:04 +0200 Subject: [PATCH 2/2] Repost QFileOpenEvent event to avoid an undefined state --- src/Gui/GuiApplication.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Gui/GuiApplication.cpp b/src/Gui/GuiApplication.cpp index b050e3ab8f..00500179b4 100644 --- a/src/Gui/GuiApplication.cpp +++ b/src/Gui/GuiApplication.cpp @@ -159,6 +159,20 @@ void GUIApplication::commitData(QSessionManager &manager) bool GUIApplication::event(QEvent * ev) { if (ev->type() == QEvent::FileOpen) { + // (macOS workaround when opening FreeCAD by opening a .FCStd file in 1.0) + // With the current implementation of the splash screen boot procedure, Qt will + // start an event loop before FreeCAD is fully initalized. This event loop will + // process the QFileOpenEvent that is sent by macOS before the main window is ready. + if (!Gui::getMainWindow()->property("eventLoop").toBool()) { + // If we never reach this point when opening FreeCAD by double clicking an + // .FCStd file, then the workaround isn't needed anymore and can be removed + QEvent* eventCopy = new QFileOpenEvent(static_cast(ev)->file()); + QTimer::singleShot(0, [eventCopy, this]() { + QCoreApplication::postEvent(this, eventCopy); + }); + return true; + } + QString file = static_cast(ev)->file(); QFileInfo fi(file); if (fi.suffix().toLower() == QLatin1String("fcstd")) {