From 7c797b5a10c19ae55e317c4ff9a02823a4b4dc0b Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Sun, 18 Aug 2024 08:18:38 -0500 Subject: [PATCH] Gui: Workaround for #14350 --- src/Gui/propertyeditor/PropertyEditor.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Gui/propertyeditor/PropertyEditor.cpp b/src/Gui/propertyeditor/PropertyEditor.cpp index b446dfc338..ea34e67fdc 100644 --- a/src/Gui/propertyeditor/PropertyEditor.cpp +++ b/src/Gui/propertyeditor/PropertyEditor.cpp @@ -261,7 +261,23 @@ void PropertyEditor::closeEditor() if (editingIndex.isValid()) { Base::StateLocker guard(closingEditor); bool hasFocus = activeEditor && activeEditor->hasFocus(); +#ifdef Q_OS_MACOS + // Brute-force workaround for https://github.com/FreeCAD/FreeCAD/issues/14350 + int currentIndex = 0; + QTabBar *tabBar = nullptr; + if (auto mdiArea = Gui::MainWindow::getInstance()->findChild()) { + tabBar = mdiArea->findChild(); + if (tabBar) { + currentIndex = tabBar->currentIndex(); + } + } +#endif closePersistentEditor(editingIndex); +#ifdef Q_OS_MACOS + if (tabBar) { + tabBar->setCurrentIndex(currentIndex); + } +#endif editingIndex = QPersistentModelIndex(); activeEditor = nullptr; if(hasFocus)