Gui: Workaround for #14350

This commit is contained in:
Chris Hennes
2024-08-18 08:18:38 -05:00
committed by Chris Hennes
parent ffb2ebe4c6
commit 7c797b5a10

View File

@@ -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<QMdiArea*>()) {
tabBar = mdiArea->findChild<QTabBar*>();
if (tabBar) {
currentIndex = tabBar->currentIndex();
}
}
#endif
closePersistentEditor(editingIndex);
#ifdef Q_OS_MACOS
if (tabBar) {
tabBar->setCurrentIndex(currentIndex);
}
#endif
editingIndex = QPersistentModelIndex();
activeEditor = nullptr;
if(hasFocus)