Add new cut face type: triangle
parent
2b44576f22
commit
86978d0ac3
|
@ -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<QVector2D> 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}, \
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue