Optional ClearMenuBar parameter

Forum discussion:
https://forum.freecadweb.org/viewtopic.php?f=34&t=34366

P.S. Note that some mixed line endings were detected in this file and were normalized automatically.
This commit is contained in:
triplus
2019-02-28 03:15:13 +01:00
committed by GitHub
parent 1e6cfd430c
commit e56c683f15

View File

@@ -191,12 +191,21 @@ void MenuManager::setup(MenuItem* menuItems) const
return; // empty menu bar
QMenuBar* menuBar = getMainWindow()->menuBar();
#if defined(FC_OS_MACOSX) && QT_VERSION >= 0x050900
// Unknown Qt macOS bug observed with Qt >= 5.9.4 causes random crashes when viewing reused top level menus.
menuBar->clear();
#if defined(FC_OS_MACOSX) && QT_VERSION >= 0x050900
// Unknown Qt macOS bug observed with Qt >= 5.9.4 causes random crashes when viewing reused top level menus.
menuBar->clear();
#endif
// On Kubuntu 18.10 global menu has issues with FreeCAD 0.18 menu bar.
// Optional parameter, clearing the menu bar, can be set as a workaround.
// Clearing the menu bar can cause issues, when trying to access menu bar through Python.
// https://forum.freecadweb.org/viewtopic.php?f=10&t=30340&start=440#p289330
if (App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/MainWindow")->GetBool("ClearMenuBar",false)) {
menuBar->clear();
}
QList<MenuItem*> items = menuItems->getItems();
QList<QAction*> actions = menuBar->actions();
for (QList<MenuItem*>::ConstIterator it = items.begin(); it != items.end(); ++it)