diff --git a/src/cuttemplate.h b/src/cuttemplate.h index 2fbfabf1..af370eb4 100644 --- a/src/cuttemplate.h +++ b/src/cuttemplate.h @@ -8,7 +8,7 @@ enum class CutTemplate { Quad = 0, - //Octagon, + Triangle, Count }; @@ -19,6 +19,8 @@ QString CutTemplateToDispName(CutTemplate cutTemplate) \ switch (cutTemplate) { \ case CutTemplate::Quad: \ return QObject::tr("Quad"); \ + case CutTemplate::Triangle: \ + return QObject::tr("Triangle"); \ default: \ return ""; \ } \ @@ -35,6 +37,12 @@ std::vector CutTemplateToPoints(CutTemplate cutTemplate) \ { 1.0, 1.0}, \ {-1.0, 1.0}, \ }; \ + case CutTemplate::Triangle: \ + return { \ + {0, -1.0}, \ + {1.732, 0}, \ + {0, 1.0}, \ + }; \ default: \ return { \ {-1.0, -1.0}, \ diff --git a/src/partwidget.cpp b/src/partwidget.cpp index 1eddaf2e..7a7f740f 100644 --- a/src/partwidget.cpp +++ b/src/partwidget.cpp @@ -498,7 +498,7 @@ void PartWidget::showCutTemplateSettingPopup(const QPoint &pos) for (size_t i = 0; i < (size_t)CutTemplate::Count; ++i) { CutTemplate cutTemplate = (CutTemplate)i; QPushButton *button = new QPushButton(CutTemplateToDispName(cutTemplate)); - connect(button, &QPushButton::clicked, [&]() { + connect(button, &QPushButton::clicked, [cutTemplate, &cutDocument, this]() { auto points = CutTemplateToPoints(cutTemplate); cutDocument.fromCutTemplate(points); emit setPartCutTemplate(m_partId, points);