Sketcher: [skip ci] add create polygon command to sketcher menu

This commit is contained in:
wmayer
2020-02-07 15:28:07 +01:00
parent f2c83ac46b
commit f22607a617
2 changed files with 12 additions and 9 deletions

View File

@@ -7482,7 +7482,7 @@ CmdSketcherCreateRegularPolygon::CmdSketcherCreateRegularPolygon()
sToolTipText = QT_TR_NOOP("Create a regular polygon in the sketch");
sWhatsThis = "Sketcher_CreateRegularPolygon";
sStatusTip = sToolTipText;
sPixmap = "CreateRegularPolygon";
sPixmap = "Sketcher_CreateRegularPolygon";
sAccel = "";
eType = ForEdit;
}
@@ -7490,7 +7490,11 @@ CmdSketcherCreateRegularPolygon::CmdSketcherCreateRegularPolygon()
void CmdSketcherCreateRegularPolygon::activated(int iMsg)
{
Q_UNUSED(iMsg);
ActivateHandler(getActiveGuiDocument(),new DrawSketchHandlerRegularPolygon(8) );
// Pop-up asking for values
SketcherRegularPolygonDialog srpd;
if (srpd.exec() == QDialog::Accepted)
ActivateHandler(getActiveGuiDocument(),new DrawSketchHandlerRegularPolygon(srpd.sides));
}
bool CmdSketcherCreateRegularPolygon::isActive(void)
@@ -7530,12 +7534,9 @@ void CmdSketcherCompCreateRegularPolygon::activated(int iMsg)
case 6:
{
// Pop-up asking for values
SketcherRegularPolygonDialog * srpd = new SketcherRegularPolygonDialog();
if (srpd->exec() == QDialog::Accepted)
ActivateHandler(getActiveGuiDocument(),new DrawSketchHandlerRegularPolygon(srpd->sides));
delete srpd;
SketcherRegularPolygonDialog srpd;
if (srpd.exec() == QDialog::Accepted)
ActivateHandler(getActiveGuiDocument(),new DrawSketchHandlerRegularPolygon(srpd.sides));
}
break;
default:
@@ -7688,6 +7689,7 @@ void CreateSketcherCommandsCreateGeo(void)
rcCmdMgr.addCommand(new CmdSketcherCreateHexagon());
rcCmdMgr.addCommand(new CmdSketcherCreateHeptagon());
rcCmdMgr.addCommand(new CmdSketcherCreateOctagon());
rcCmdMgr.addCommand(new CmdSketcherCreateRegularPolygon());
rcCmdMgr.addCommand(new CmdSketcherCreateSlot());
rcCmdMgr.addCommand(new CmdSketcherCreateFillet());
//rcCmdMgr.addCommand(new CmdSketcherCreateText());

View File

@@ -182,7 +182,8 @@ inline void SketcherAddWorkspaceRegularPolygon<Gui::MenuItem>(Gui::MenuItem& geo
<< "Sketcher_CreatePentagon"
<< "Sketcher_CreateHexagon"
<< "Sketcher_CreateHeptagon"
<< "Sketcher_CreateOctagon";
<< "Sketcher_CreateOctagon"
<< "Sketcher_CreateRegularPolygon";
}
template <>
inline void SketcherAddWorkspaceRegularPolygon<Gui::ToolBarItem>(Gui::ToolBarItem& geom){