From e56c683f15f450bf5bcf669dd1ad31dea0e07d0e Mon Sep 17 00:00:00 2001 From: triplus Date: Thu, 28 Feb 2019 03:15:13 +0100 Subject: [PATCH] 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. --- src/Gui/MenuManager.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Gui/MenuManager.cpp b/src/Gui/MenuManager.cpp index 80036b7bd8..8393923723 100644 --- a/src/Gui/MenuManager.cpp +++ b/src/Gui/MenuManager.cpp @@ -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 items = menuItems->getItems(); QList actions = menuBar->actions(); for (QList::ConstIterator it = items.begin(); it != items.end(); ++it)