Skip to content

Commit

Permalink
Optional ClearMenuBar parameter
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
triplus committed Feb 28, 2019
1 parent 10c7451 commit b0d83f3
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/Gui/MenuManager.cpp
Expand Up @@ -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)
Expand Down

0 comments on commit b0d83f3

Please sign in to comment.