Part: handle Part_SectionCut in WorkbenchManipulator

This commit is contained in:
wmayer
2023-10-03 17:43:40 +02:00
committed by wwmayer
parent 6e12bbf79a
commit 09148fa617
3 changed files with 18 additions and 2 deletions

View File

@@ -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);

View File

@@ -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);
}
}

View File

@@ -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