diff --git a/src/Mod/Part/Gui/AppPartGui.cpp b/src/Mod/Part/Gui/AppPartGui.cpp index be70015d5c..739b1ffc07 100644 --- a/src/Mod/Part/Gui/AppPartGui.cpp +++ b/src/Mod/Part/Gui/AppPartGui.cpp @@ -244,8 +244,6 @@ PyMOD_INIT_FUNC(PartGui) // add resources and reloads the translators loadPartResource(); - Gui::Workbench::addPermanentMenuItem("Part_SectionCut", "Std_ToggleClipPlane"); - // register bitmaps // Gui::BitmapFactoryInst& rclBmpFactory = Gui::BitmapFactory(); // rclBmpFactory.addXPM("Part_Feature",(const char**) PartFeature_xpm); diff --git a/src/Mod/Part/Gui/WorkbenchManipulator.cpp b/src/Mod/Part/Gui/WorkbenchManipulator.cpp index 063cfa70b7..95a19c8530 100644 --- a/src/Mod/Part/Gui/WorkbenchManipulator.cpp +++ b/src/Mod/Part/Gui/WorkbenchManipulator.cpp @@ -31,6 +31,7 @@ using namespace PartGui; void WorkbenchManipulator::modifyMenuBar([[maybe_unused]] Gui::MenuItem* menuBar) { + addSectionCut(menuBar); } void WorkbenchManipulator::modifyContextMenu(const char* recipient, Gui::MenuItem* menuBar) @@ -44,3 +45,17 @@ void WorkbenchManipulator::modifyToolBars(Gui::ToolBarItem* toolBar) void WorkbenchManipulator::modifyDockWindows([[maybe_unused]] Gui::DockWindowItems* dockWindow) { } + +void WorkbenchManipulator::addSectionCut(Gui::MenuItem* menuBar) +{ + const char* toggleClipPlane = "Std_ToggleClipPlane"; + auto par = menuBar->findParentOf(toggleClipPlane); + if (par) { + auto item = par->findItem(toggleClipPlane); + item = par->afterItem(item); + + auto add = new Gui::MenuItem(); // NOLINT + add->setCommand("Part_SectionCut"); + par->insertItem(item, add); + } +} diff --git a/src/Mod/Part/Gui/WorkbenchManipulator.h b/src/Mod/Part/Gui/WorkbenchManipulator.h index f4c682a490..e89f8c3977 100644 --- a/src/Mod/Part/Gui/WorkbenchManipulator.h +++ b/src/Mod/Part/Gui/WorkbenchManipulator.h @@ -56,6 +56,9 @@ protected: * The default implementation doesn't change anything. */ void modifyDockWindows([[maybe_unused]] Gui::DockWindowItems* dockWindow) override; + +private: + static void addSectionCut(Gui::MenuItem* menuBar); }; } // namespace PartGui