54 #include "ui_pattern_piece_dialog.h"
60 #include "../ifc/xml/vlabeltemplateconverter.h"
61 #include "../vformat/vlabeltemplate.h"
62 #include "../vmisc/logging.h"
63 #include "../vmisc/vcommonsettings.h"
64 #include "../vpatterndb/calculator.h"
65 #include "../vpatterndb/vpiecenode.h"
66 #include "../vpatterndb/vpiecepath.h"
67 #include "../../support/edit_formula_dialog.h"
68 #include "../../support/editlabeltemplate_dialog.h"
69 #include "../../../tools/pattern_piece_tool.h"
70 #include "../../../undocommands/savepiecepathoptions.h"
72 #include <QColorDialog>
74 #include <QGuiApplication>
83 Q_LOGGING_CATEGORY(pattern_piece_dialog,
"pattern_piece_dialog")
94 defButton->setEnabled(
true);
103 QString formula = textEdit->toPlainText();
104 formula.replace(
"\n",
" ");
105 return qApp->TrVars()->TryFormulaFromUser(formula,
qApp->Settings()->GetOsSeparator());
113 , applyAllowed(false)
114 , flagGrainlineAnchor(true)
115 , flagPieceLabelAnchor(true)
116 , flagPatternLabelAnchor(true)
117 , flagGrainlineFormula(true)
118 , flagPieceLabelAngle(true)
119 , flagPieceLabelFormula(true)
120 , flagPatternLabelAngle(true)
121 , flagPatternLabelFormula(true)
122 , flagBeforeFormula(true)
123 , flagAfterFormula(true)
135 , m_rotationBaseHeight(0)
136 , m_lengthBaseHeight(0)
137 , m_pieceLabelWidthBaseHeight(0)
138 , m_pieceLabelHeightBaseHeight(0)
139 , m_pieceLabelAngleBaseHeight(0)
140 , m_patternLabelWidthBaseHeight(0)
141 , m_patternLabelHeightBaseHeight(0)
142 , m_patternLabelAngleBaseHeight(0)
144 , m_beforeWidthFormula(0)
145 , m_afterWidthFormula(0)
146 , m_timerWidth(nullptr)
147 , m_timerWidthBefore(nullptr)
148 , m_timerWidthAfter(nullptr)
150 , m_patternLabelLines()
151 , m_pieceLabelLines()
152 , m_beep(new QSound(
qApp->Settings()->getSelectionSound()))
155 setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
156 setWindowIcon(QIcon(
":/toolicon/32x32/new_piece.png"));
159 setMaximumHeight(qRound(QGuiApplication::primaryScreen()->availableGeometry().height() * .8));
200 if (current ==
nullptr)
204 int rowIndex =
ui->menuTab_ListWidget->row(current);
205 ui->pages_StackedWidget->setCurrentIndex(rowIndex);
230 qCDebug(pattern_piece_dialog,
"PatternPieceDialog applyAllowed = True");
233 auto flags =
ui->menuTab_ListWidget->item(i)->flags();
234 ui->menuTab_ListWidget->item(i)->setFlags(flags | Qt::ItemIsEnabled);
239 qCDebug(pattern_piece_dialog,
"PatternPieceDialog applyAllowed = False");
242 auto flags =
ui->menuTab_ListWidget->item(i)->flags();
243 ui->menuTab_ListWidget->item(i)->setFlags(flags & ~Qt::ItemIsEnabled);
257 ui->mainPath_ListWidget->clear();
258 for (
int i = 0; i < piece.
GetPath().CountNodes(); ++i)
264 ui->customSeamAllowance_ListWidget->blockSignals(
true);
265 ui->customSeamAllowance_ListWidget->clear();
270 ui->customSeamAllowance_ListWidget->blockSignals(
false);
272 ui->internalPaths_ListWidget->clear();
278 ui->anchorPoints_ListWidget->clear();
279 for (
int i = 0; i < piece.
getAnchors().size(); ++i)
286 ui->startPoint_ComboBox->blockSignals(
true);
287 ui->startPoint_ComboBox->clear();
288 ui->startPoint_ComboBox->blockSignals(
false);
290 ui->endPoint_ComboBox->blockSignals(
true);
291 ui->endPoint_ComboBox->clear();
292 ui->endPoint_ComboBox->blockSignals(
false);
299 ui->pieceName_LineEdit->setText(piece.
GetName());
306 ui->widthFormula_PlainTextEdit->setPlainText(width);
369 bool reverse =
false;
371 const GOType objType =
static_cast<GOType>(obj->getType());
376 if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
380 else if (QGuiApplication::keyboardModifiers() == Qt::ControlModifier)
384 else if (previousId ==
NULL_ID)
388 else if (previousId !=
NULL_ID)
390 QPointF previousPoint;
392 const GOType previousObjType =
static_cast<GOType>(previousObj->getType());
401 : previousPoint = curve->getLastPoint();
405 if (curve->isPointOnCurve(previousPoint) &&
406 curve->getFirstPoint() != previousPoint &&
407 curve->getLastPoint() != previousPoint)
412 if (!items.isEmpty())
414 VPieceNode rowNode = qvariant_cast<VPieceNode>(items[0]->
data(Qt::UserRole));
418 else if (curve->getFirstPoint() != previousPoint)
428 points.append(curvePoints);
433 if (
id != previousId)
461 qDebug() <<
"Invalid scene object. Ignore.";
467 if (
ui->mainPath_ListWidget->count() > 1)
469 QApplication::beep();
478 auto visPath = qobject_cast<PatternPieceVisual *>(
vis);
481 visPath->SetPiece(p);
485 emit
ToolTip(tr(
"Select main path objects clockwise, Use <b>SHIFT</b> to reverse curve direction, "
486 " or <b>CTRL</b> to keep curve direction. "
487 "Press <b>ENTER</b> to finish piece creation "));
489 if (!
qApp->getCurrentScene()->items().contains(visPath))
495 visPath->RefreshGeometry();
500 visPath->RefreshGeometry();
516 auto visPath = qobject_cast<PatternPieceVisual *>(
vis);
519 visPath->RefreshGeometry();
523 setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
562 QString tooltip = tr(
"Ready!");
565 tooltip = tooltip + QLatin1String(
" <b>") +
566 tr(
"Press OK to create pattern piece") + QLatin1String(
"</b>");
568 ui->status_Label->setText(tooltip);
579 ui->menuTab_ListWidget->item(tab)->setText(text + QLatin1String(
"*"));
584 ui->menuTab_ListWidget->item(tab)->setText(text);
599 if (QListWidget *list = qobject_cast<QListWidget *>(
object))
601 if (event->type() == QEvent::KeyPress)
603 const int row =
ui->mainPath_ListWidget->currentRow();
604 if (
ui->mainPath_ListWidget->count() <= 0 || row < 0 || row >=
ui->mainPath_ListWidget->count())
608 QListWidgetItem *rowItem = list->item(row);
611 QKeyEvent *keyEvent =
static_cast<QKeyEvent *
>(event);
613 if (keyEvent->key() == Qt::Key_Delete)
618 if (keyEvent->modifiers() & Qt::ControlModifier)
620 switch (keyEvent->key())
639 else if (keyEvent->modifiers() & Qt::ShiftModifier)
641 switch (keyEvent->key())
697 ui->widthFormula_PlainTextEdit->blockSignals(
true);
698 ui->beforeWidthFormula_PlainTextEdit->blockSignals(
true);
699 ui->afterWidthFormula_PlainTextEdit->blockSignals(
true);
700 ui->rotationFormula_LineEdit->blockSignals(
true);
701 ui->lengthFormula_LineEdit->blockSignals(
true);
708 QDialog::showEvent(event);
714 const QSize size =
qApp->Settings()->getPatternPieceDialogSize();
730 qApp->Settings()->setPatternPieceDialogSize(size());
732 DialogTool::resizeEvent(event);
738 QLineEdit *name = qobject_cast<QLineEdit*>(sender());
741 if (name->text().isEmpty())
760 const QColor color = QColorDialog::getColor(Qt::white,
this,
"Select Color", QColorDialog::DontUseNativeDialog);
764 ui->color_Label->setText(color.name());
765 ui->color_Label->setPalette(QPalette(color));
773 const int row =
ui->mainPath_ListWidget->currentRow();
774 if (
ui->mainPath_ListWidget->count() == 0 || row == -1 || row >=
ui->mainPath_ListWidget->count())
780 QScopedPointer<QMenu> menu(
new QMenu(
ui->mainPath_ListWidget));
783 bool isNotch =
false;
784 QListWidgetItem *rowItem =
ui->mainPath_ListWidget->item(row);
786 VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
788 QAction *actionNotch =
nullptr;
789 QAction *actionNone =
nullptr;
790 QAction *actionSlit =
nullptr;
791 QAction *actionTNotch =
nullptr;
792 QAction *actionUNotch =
nullptr;
793 QAction *actionVInternal =
nullptr;
794 QAction *actionVExternal =
nullptr;
795 QAction *actionCastle =
nullptr;
796 QAction *actionDiamond =
nullptr;
798 QAction *actionReverse =
nullptr;
799 QAction *actionDuplicate =
nullptr;
803 actionReverse = menu->addAction(tr(
"Reverse") + QStringLiteral(
"\tCtrl + R"));
804 actionReverse->setCheckable(
true);
805 actionReverse->setChecked(rowNode.
GetReverse());
807 actionDuplicate = menu->addAction(tr(
"Duplicate") + QStringLiteral(
"\tCtrl + D"));
811 QMenu *notchMenu = menu->addMenu(tr(
"Notch"));
812 actionNotch = notchMenu->menuAction();
813 actionNotch->setCheckable(
true);
814 actionNotch->setChecked(rowNode.
isNotch());
816 actionNone = notchMenu->addAction( tr(
"None") + QStringLiteral(
"\tShift + X"));
817 actionSlit = notchMenu->addAction(QIcon(
"://icon/24x24/slit_notch.png"), tr(
"Slit") + QStringLiteral(
"\tShift + S"));
818 actionTNotch = notchMenu->addAction(QIcon(
"://icon/24x24/t_notch.png"), tr(
"TNotch") + QStringLiteral(
"\tShift + T"));
819 actionUNotch = notchMenu->addAction(QIcon(
"://icon/24x24/u_notch.png"), tr(
"UNotch") + QStringLiteral(
"\tShift + U"));
820 actionVInternal = notchMenu->addAction(QIcon(
"://icon/24x24/internal_v_notch.png"), tr(
"VInternal") + QStringLiteral(
"\tShift + I"));
821 actionVExternal = notchMenu->addAction(QIcon(
"://icon/24x24/external_v_notch.png"), tr(
"VExternal") + QStringLiteral(
"\tShift + E"));
822 actionCastle = notchMenu->addAction(QIcon(
"://icon/24x24/castle_notch.png"), tr(
"Castle") + QStringLiteral(
"\tShift + C"));
823 actionDiamond = notchMenu->addAction(QIcon(
"://icon/24x24/diamond_notch.png"), tr(
"Diamond") + QStringLiteral(
"\tShift + D"));
826 QAction *actionExcluded = menu->addAction(tr(
"Excluded") + QStringLiteral(
"\tCtrl + E"));
827 actionExcluded->setCheckable(
true);
828 actionExcluded->setChecked(rowNode.
isExcluded());
830 QAction *actionDelete = menu->addAction(QIcon::fromTheme(
"edit-delete"), tr(
"Delete") + QStringLiteral(
"\tDel"));
832 QAction *selectedAction = menu->exec(
ui->mainPath_ListWidget->viewport()->mapToGlobal(pos));
833 if (selectedAction == actionDelete)
835 delete ui->mainPath_ListWidget->item(row);
845 else if (selectedAction == actionExcluded)
851 if (selectedAction == actionNone)
856 else if (selectedAction == actionSlit)
861 else if (selectedAction == actionTNotch)
866 else if (selectedAction == actionUNotch)
871 else if (selectedAction == actionVInternal)
876 else if (selectedAction == actionVExternal)
881 else if (selectedAction == actionCastle)
886 else if (selectedAction == actionDiamond)
892 setNotch(rowItem, isNotch, notchType);
902 const int row =
ui->customSeamAllowance_ListWidget->currentRow();
903 if (
ui->customSeamAllowance_ListWidget->count() == 0 || row == -1 || row >=
ui->customSeamAllowance_ListWidget->count())
909 QScopedPointer<QMenu> menu(
new QMenu(
ui->customSeamAllowance_ListWidget));
910 QAction *actionOption = menu->addAction(QIcon::fromTheme(
"preferences-other"), tr(
"Options"));
912 QListWidgetItem *rowItem =
ui->customSeamAllowance_ListWidget->item(row);
914 CustomSARecord record = qvariant_cast<CustomSARecord>(rowItem->data(Qt::UserRole));
916 QAction *actionReverse = menu->addAction(tr(
"Reverse"));
917 actionReverse->setCheckable(
true);
918 actionReverse->setChecked(record.
reverse);
920 QAction *actionDelete = menu->addAction(QIcon::fromTheme(
"edit-delete"), tr(
"Delete"));
922 QAction *selectedAction = menu->exec(
ui->customSeamAllowance_ListWidget->viewport()->mapToGlobal(pos));
923 if (selectedAction == actionDelete)
925 delete ui->customSeamAllowance_ListWidget->item(row);
927 else if (selectedAction == actionReverse)
930 rowItem->setData(Qt::UserRole, QVariant::fromValue(record));
933 else if (selectedAction == actionOption)
937 dialog->SetPieceId(
toolId);
942 dialog->EnbleShowMode(
true);
953 const int row =
ui->internalPaths_ListWidget->currentRow();
954 if (
ui->internalPaths_ListWidget->count() == 0 || row == -1
955 || row >=
ui->internalPaths_ListWidget->count())
961 QScopedPointer<QMenu> menu(
new QMenu(
ui->internalPaths_ListWidget));
962 QAction *actionOption = menu->addAction(QIcon::fromTheme(
"preferences-other"), tr(
"Options"));
963 QAction *actionDelete = menu->addAction(QIcon::fromTheme(
"edit-delete"), tr(
"Delete"));
965 QAction *selectedAction = menu->exec(
ui->internalPaths_ListWidget->viewport()->mapToGlobal(pos));
966 if (selectedAction == actionDelete)
968 delete ui->internalPaths_ListWidget->item(row);
970 else if (selectedAction == actionOption)
972 QListWidgetItem *rowItem =
ui->internalPaths_ListWidget->item(row);
974 const quint32 pathId = qvariant_cast<quint32>(rowItem->data(Qt::UserRole));
978 dialog->SetPieceId(
toolId);
979 dialog->EnbleShowMode(
true);
990 const int row =
ui->anchorPoints_ListWidget->currentRow();
991 if (
ui->anchorPoints_ListWidget->count() == 0 || row == -1 || row >=
ui->anchorPoints_ListWidget->count())
997 QScopedPointer<QMenu> menu(
new QMenu(
ui->anchorPoints_ListWidget));
998 QAction *actionDelete = menu->addAction(QIcon::fromTheme(
"edit-delete"), tr(
"Delete"));
1000 QAction *selectedAction = menu->exec(
ui->anchorPoints_ListWidget->viewport()->mapToGlobal(pos));
1001 if (selectedAction == actionDelete)
1003 delete ui->anchorPoints_ListWidget->item(row);
1013 auto visPath = qobject_cast<PatternPieceVisual *>(
vis);
1016 visPath->RefreshGeometry();
1027 ui->builtIn_CheckBox->setEnabled(enable);
1028 ui->hideSeamLine_CheckBox->setEnabled(enable);
1032 ui->automatic_GroupBox->setEnabled(enable);
1033 ui->custom_GroupBox->setEnabled(enable);
1037 ui->builtIn_CheckBox->toggled(
ui->builtIn_CheckBox->isChecked());
1044 ui->automatic_GroupBox->setEnabled(!enable);
1045 ui->custom_GroupBox->setEnabled(!enable);
1056 ui->beforeWidthFormula_PlainTextEdit->setDisabled(
true);
1057 ui->beforeExpr_ToolButton->setDisabled(
true);
1058 ui->beforeDefault_PushButton->setDisabled(
true);
1060 ui->afterWidthFormula_PlainTextEdit->setDisabled(
true);
1061 ui->afterExpr_ToolButton->setDisabled(
true);
1062 ui->afterDefault_PushButton->setDisabled(
true);
1064 ui->angle_ComboBox->setDisabled(
true);
1066 ui->angle_ComboBox->blockSignals(
true);
1072 if (nodeIndex != -1)
1077 ui->beforeWidthFormula_PlainTextEdit->setEnabled(
true);
1078 ui->beforeExpr_ToolButton->setEnabled(
true);
1082 w1Formula =
qApp->TrVars()->FormulaToUser(w1Formula,
qApp->Settings()->GetOsSeparator());
1085 if (w1Formula.length() > 80)
1089 ui->beforeWidthFormula_PlainTextEdit->setPlainText(w1Formula);
1093 ui->afterWidthFormula_PlainTextEdit->setEnabled(
true);
1094 ui->afterExpr_ToolButton->setEnabled(
true);
1098 w2Formula =
qApp->TrVars()->FormulaToUser(w2Formula,
qApp->Settings()->GetOsSeparator());
1101 if (w2Formula.length() > 80)
1105 ui->afterWidthFormula_PlainTextEdit->setPlainText(w2Formula);
1109 ui->angle_ComboBox->setEnabled(
true);
1110 const int index =
ui->angle_ComboBox->findData(
static_cast<unsigned char>(node.
GetAngleType()));
1113 ui->angle_ComboBox->setCurrentIndex(index);
1121 ui->angle_ComboBox->setCurrentIndex(-1);
1123 ui->angle_ComboBox->blockSignals(
false);
1129 ui->slitNotch_RadioButton->setDisabled(
true);
1130 ui->tNotch_RadioButton->setDisabled(
true);
1131 ui->uNotch_RadioButton->setDisabled(
true);
1132 ui->vInternalNotch_RadioButton->setDisabled(
true);
1133 ui->vExternalNotch_RadioButton->setDisabled(
true);
1134 ui->castleNotch_RadioButton->setDisabled(
true);
1135 ui->diamondNotch_RadioButton->setDisabled(
true);
1137 ui->straightforward_RadioButton->setDisabled(
true);
1138 ui->bisector_RadioButton->setDisabled(
true);
1139 ui->intersection_RadioButton->setDisabled(
true);
1141 ui->showNotch_CheckBox->setDisabled(
true);
1142 ui->showNotch_CheckBox->blockSignals(
true);
1144 ui->showSeamlineNotch_CheckBox->setDisabled(
true);
1145 ui->showSeamlineNotch_CheckBox->blockSignals(
true);
1147 ui->notchType_GroupBox->blockSignals(
true);
1148 ui->notchSubType_GroupBox->blockSignals(
true);
1153 const int nodeIndex = piece.
GetPath().
indexOfNode(
ui->notches_ComboBox->currentData().toUInt());
1154 if (nodeIndex != -1)
1159 ui->slitNotch_RadioButton->setEnabled(
true);
1160 ui->tNotch_RadioButton->setEnabled(
true);
1161 ui->uNotch_RadioButton->setEnabled(
true);
1162 ui->vInternalNotch_RadioButton->setEnabled(
true);
1163 ui->vExternalNotch_RadioButton->setEnabled(
true);
1164 ui->castleNotch_RadioButton->setEnabled(
true);
1165 ui->diamondNotch_RadioButton->setEnabled(
true);
1167 ui->notchAngle_DoubleSpinBox->setEnabled(
false);
1172 ui->slitNotch_RadioButton->setChecked(
true);
1173 ui->notchAngle_DoubleSpinBox->setEnabled(
true);
1177 ui->tNotch_RadioButton->setChecked(
true);
1180 ui->uNotch_RadioButton->setChecked(
true);
1183 ui->vInternalNotch_RadioButton->setChecked(
true);
1186 ui->vExternalNotch_RadioButton->setChecked(
true);
1189 ui->castleNotch_RadioButton->setChecked(
true);
1192 ui->diamondNotch_RadioButton->setChecked(
true);
1199 ui->straightforward_RadioButton->setEnabled(
true);
1200 ui->bisector_RadioButton->setEnabled(
true);
1201 ui->intersection_RadioButton->setEnabled(
true);
1206 ui->straightforward_RadioButton->setChecked(
true);
1209 ui->bisector_RadioButton->setChecked(
true);
1212 ui->intersection_RadioButton->setChecked(
true);
1219 ui->showNotch_CheckBox->setEnabled(
true);
1220 ui->showNotch_CheckBox->setChecked(node.
showNotch());
1223 ui->showSeamlineNotch_CheckBox->setEnabled(
true);
1226 ui->notchLength_DoubleSpinBox->setEnabled(
true);
1229 ui->notchWidth_DoubleSpinBox->setEnabled(
true);
1232 ui->notchCount_SpinBox->setEnabled(
true);
1237 ui->showNotch_CheckBox->blockSignals(
false);
1238 ui->showSeamlineNotch_CheckBox->blockSignals(
false);
1240 ui->notchType_GroupBox->blockSignals(
false);
1241 ui->notchSubType_GroupBox->blockSignals(
false);
1249 const int row =
ui->customSeamAllowance_ListWidget->currentRow();
1250 if (
ui->customSeamAllowance_ListWidget->count() == 0 || row == -1 || row >=
ui->customSeamAllowance_ListWidget->count())
1255 QListWidgetItem *rowItem =
ui->customSeamAllowance_ListWidget->item(row);
1257 CustomSARecord record = qvariant_cast<CustomSARecord>(rowItem->data(Qt::UserRole));
1258 record.
startPoint =
ui->startPoint_ComboBox->currentData().toUInt();
1259 rowItem->setData(Qt::UserRole, QVariant::fromValue(record));
1267 const int row =
ui->customSeamAllowance_ListWidget->currentRow();
1268 if (
ui->customSeamAllowance_ListWidget->count() == 0 || row == -1 || row >=
ui->customSeamAllowance_ListWidget->count())
1273 QListWidgetItem *rowItem =
ui->customSeamAllowance_ListWidget->item(row);
1275 CustomSARecord record = qvariant_cast<CustomSARecord>(rowItem->data(Qt::UserRole));
1276 record.
endPoint =
ui->endPoint_ComboBox->currentData().toUInt();
1277 rowItem->setData(Qt::UserRole, QVariant::fromValue(record));
1285 const int row =
ui->customSeamAllowance_ListWidget->currentRow();
1286 if (
ui->customSeamAllowance_ListWidget->count() == 0 || row == -1 || row >=
ui->customSeamAllowance_ListWidget->count())
1291 QListWidgetItem *rowItem =
ui->customSeamAllowance_ListWidget->item(row);
1293 CustomSARecord record = qvariant_cast<CustomSARecord>(rowItem->data(Qt::UserRole));
1295 rowItem->setData(Qt::UserRole, QVariant::fromValue(record));
1301 const int i =
ui->nodes_ComboBox->currentIndex();
1302 if (i != -1 && index != -1)
1304 QListWidgetItem *rowItem =
getItemById(
ui->nodes_ComboBox->currentData().toUInt());
1307 VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
1309 rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
1320 ui->beforeWidthFormula_PlainTextEdit->setPlainText(allowance);
1321 if (QPushButton *button = qobject_cast<QPushButton*>(sender()))
1323 button->setEnabled(
false);
1331 ui->afterWidthFormula_PlainTextEdit->setPlainText(allowance);
1332 if (QPushButton *button = qobject_cast<QPushButton*>(sender()))
1334 button->setEnabled(
false);
1341 if (
ui->customSeamAllowance_ListWidget->count() == 0 || row == -1 || row >=
ui->customSeamAllowance_ListWidget->count())
1343 ui->startPoint_ComboBox->blockSignals(
true);
1344 ui->startPoint_ComboBox->clear();
1345 ui->startPoint_ComboBox->blockSignals(
false);
1347 ui->endPoint_ComboBox->blockSignals(
true);
1348 ui->endPoint_ComboBox->clear();
1349 ui->endPoint_ComboBox->blockSignals(
false);
1351 ui->comboBoxIncludeType->blockSignals(
true);
1352 ui->comboBoxIncludeType->clear();
1353 ui->comboBoxIncludeType->blockSignals(
false);
1357 const QListWidgetItem *item =
ui->customSeamAllowance_ListWidget->item(row);
1359 const CustomSARecord record = qvariant_cast<CustomSARecord>(item->data(Qt::UserRole));
1361 ui->startPoint_ComboBox->blockSignals(
true);
1364 const int index =
ui->startPoint_ComboBox->findData(record.
startPoint);
1367 ui->startPoint_ComboBox->setCurrentIndex(index);
1370 ui->startPoint_ComboBox->blockSignals(
false);
1372 ui->endPoint_ComboBox->blockSignals(
true);
1375 const int index =
ui->endPoint_ComboBox->findData(record.
endPoint);
1378 ui->endPoint_ComboBox->setCurrentIndex(index);
1381 ui->endPoint_ComboBox->blockSignals(
false);
1383 ui->comboBoxIncludeType->blockSignals(
true);
1386 const int index =
ui->comboBoxIncludeType->findData(
static_cast<unsigned char>(record.
includeType));
1389 ui->comboBoxIncludeType->setCurrentIndex(index);
1392 ui->comboBoxIncludeType->blockSignals(
false);
1398 if (result == QDialog::Accepted)
1411 qApp->getUndoStack()->push(saveCommand);
1417 qCritical(
"%s\n\n%s\n\n%s", qUtf8Printable(tr(
"Error. Can't save piece path.")),
1427 const int i =
ui->notches_ComboBox->currentIndex();
1430 QListWidgetItem *rowItem =
getItemById(
ui->notches_ComboBox->currentData().toUInt());
1433 ui->notchAngle_DoubleSpinBox->setEnabled(
false);
1434 ui->notchAngle_DoubleSpinBox->setValue(0.0);
1436 VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
1440 if (
id ==
ui->notchType_ButtonGroup->id(
ui->slitNotch_RadioButton))
1443 ui->notchAngle_DoubleSpinBox->setEnabled(
true);
1445 else if (
id ==
ui->notchType_ButtonGroup->id(
ui->tNotch_RadioButton))
1449 else if (
id ==
ui->notchType_ButtonGroup->id(
ui->uNotch_RadioButton))
1453 else if (
id ==
ui->notchType_ButtonGroup->id(
ui->vInternalNotch_RadioButton))
1457 else if (
id ==
ui->notchType_ButtonGroup->id(
ui->vExternalNotch_RadioButton))
1461 else if (
id ==
ui->notchType_ButtonGroup->id(
ui->castleNotch_RadioButton))
1465 else if (
id ==
ui->notchType_ButtonGroup->id(
ui->diamondNotch_RadioButton))
1472 rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
1473 rowItem->setIcon(QIcon(info.
icon));
1474 rowItem->setText(info.
name);
1484 const int i =
ui->notches_ComboBox->currentIndex();
1487 QListWidgetItem *rowItem =
getItemById(
ui->notches_ComboBox->currentData().toUInt());
1490 VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
1493 if (
id ==
ui->notchSubType_ButtonGroup->id(
ui->straightforward_RadioButton))
1497 else if (
id ==
ui->notchSubType_ButtonGroup->id(
ui->bisector_RadioButton))
1501 else if (
id ==
ui->notchSubType_ButtonGroup->id(
ui->intersection_RadioButton))
1507 rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
1517 const int i =
ui->notches_ComboBox->currentIndex();
1520 QListWidgetItem *rowItem =
getItemById(
ui->notches_ComboBox->currentData().toUInt());
1523 VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
1525 rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
1535 const int i =
ui->notches_ComboBox->currentIndex();
1538 QListWidgetItem *rowItem =
getItemById(
ui->notches_ComboBox->currentData().toUInt());
1541 VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
1543 rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
1554 const int i =
ui->notches_ComboBox->currentIndex();
1557 QListWidgetItem *rowItem =
getItemById(
ui->notches_ComboBox->currentData().toUInt());
1560 VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
1562 rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
1572 ui->notchLength_DoubleSpinBox->setValue(
qApp->Settings()->getDefaultNotchLength());
1578 const int i =
ui->notches_ComboBox->currentIndex();
1581 QListWidgetItem *rowItem =
getItemById(
ui->notches_ComboBox->currentData().toUInt());
1584 VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
1586 rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
1596 ui->notchWidth_DoubleSpinBox->setValue(
qApp->Settings()->getDefaultNotchWidth());
1602 const int i =
ui->notches_ComboBox->currentIndex();
1605 QListWidgetItem *rowItem =
getItemById(
ui->notches_ComboBox->currentData().toUInt());
1608 VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
1610 rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
1619 ui->notchAngle_DoubleSpinBox->setValue(0.0);
1625 const int i =
ui->notches_ComboBox->currentIndex();
1628 QListWidgetItem *rowItem =
getItemById(
ui->notches_ComboBox->currentData().toUInt());
1631 VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
1633 rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
1643 QPlainTextEdit *lineEdit[2] = {
ui->rotationFormula_LineEdit,
ui->lengthFormula_LineEdit};
1644 bool formulasOK[2] = {
true,
true};
1646 for (
int i = 0; i < 2; ++i)
1653 labelValue =
ui->labelRot;
1654 labelText =
ui->labelEditRot;
1659 labelValue =
ui->labelLen;
1660 labelText =
ui->labelEditLen;
1661 labelUnits = QLatin1String(
" ") +
UnitsToStr(
qApp->patternUnit());
1664 labelValue->setToolTip(tr(
"Value"));
1666 QString formula = lineEdit[i]->toPlainText().simplified();
1667 QString formulaValueStr;
1670 formula.replace(
"\n",
" ");
1671 formula =
qApp->TrVars()->FormulaFromUser(formula,
qApp->Settings()->GetOsSeparator());
1674 if (qIsInf(calculatedValue) ==
true || qIsNaN(calculatedValue) ==
true)
1678 else if (i == 1 && calculatedValue <= 0.0)
1684 formulaValueStr.setNum(calculatedValue,
'f', 2);
1690 formulaValueStr = tr(
"Error");
1692 formulasOK[i] =
false;
1693 labelValue->setToolTip(tr(
"Parser error: %1").arg(e.
GetMsg()));
1696 if (formulasOK[i] && formulaValueStr.isEmpty() ==
false)
1698 formulaValueStr += labelUnits;
1700 labelValue->setText(formulaValueStr);
1718 QPlainTextEdit *lineEdit[3] = {
ui->pieceLabelWidthFormula_LineEdit,
ui->pieceLabelHeightFormula_LineEdit,
1719 ui->pieceLabelAngleFormula_LineEdit};
1720 bool formulasOK[3] = {
true,
true,
true};
1722 for (
int i = 0; i < 3; ++i)
1729 labelValue =
ui->labelDLWidth;
1730 labelText =
ui->labelEditDLWidth;
1731 labelUnits = QLatin1String(
" ") +
UnitsToStr(
qApp->patternUnit());
1735 labelValue =
ui->labelDLHeight;
1736 labelText =
ui->labelEditDLHeight;
1737 labelUnits = QLatin1String(
" ") +
UnitsToStr(
qApp->patternUnit());
1741 labelValue =
ui->labelDLAngle;
1742 labelText =
ui->labelEditDLAngle;
1746 labelValue->setToolTip(tr(
"Value"));
1748 QString formula = lineEdit[i]->toPlainText().simplified();
1749 QString formulaValueStr;
1752 formula.replace(
"\n",
" ");
1753 formula =
qApp->TrVars()->FormulaFromUser(formula,
qApp->Settings()->GetOsSeparator());
1756 if (qIsInf(calculatedValue) ==
true || qIsNaN(calculatedValue) ==
true)
1760 else if ((i == 0 || i == 1) && calculatedValue <= 0.0)
1766 formulaValueStr.setNum(calculatedValue,
'f', 2);
1772 formulaValueStr = tr(
"Error");
1774 formulasOK[i] =
false;
1775 labelValue->setToolTip(tr(
"Parser error: %1").arg(e.
GetMsg()));
1778 if (formulasOK[i] && formulaValueStr.isEmpty() ==
false)
1780 formulaValueStr += labelUnits;
1782 labelValue->setText(formulaValueStr);
1790 QIcon icon(
":/icons/win.icon.theme/16x16/status/dialog-warning.png");
1791 ui->labels_TabWidget->setTabIcon(
ui->labels_TabWidget->indexOf(
ui->pieceLabel_Tab), icon);
1803 QPlainTextEdit *lineEdit[3] = {
ui->patternLabelWidthFormula_LineEdit,
ui->patternLabelHeightFormula_LineEdit,
1804 ui->patternLabelAngleFormula_LineEdit};
1805 bool formulasOK[3] = {
true,
true,
true};
1807 for (
int i = 0; i < 3; ++i)
1814 labelValue =
ui->labelPLWidth;
1815 labelText =
ui->labelEditPLWidth;
1816 labelUnits = QLatin1String(
" ") +
UnitsToStr(
qApp->patternUnit());
1820 labelValue =
ui->labelPLHeight;
1821 labelText =
ui->labelEditPLHeight;
1822 labelUnits = QLatin1String(
" ") +
UnitsToStr(
qApp->patternUnit());
1826 labelValue =
ui->labelPLAngle;
1827 labelText =
ui->labelEditPLAngle;
1831 labelValue->setToolTip(tr(
"Value"));
1833 QString formula = lineEdit[i]->toPlainText().simplified();
1834 QString formulaValueStr;
1837 formula.replace(
"\n",
" ");
1838 formula =
qApp->TrVars()->FormulaFromUser(formula,
qApp->Settings()->GetOsSeparator());
1841 if (qIsInf(calculatedValue) ==
true || qIsNaN(calculatedValue) ==
true)
1845 else if ((i == 0 || i == 1) && calculatedValue <= 0.0)
1851 formulaValueStr.setNum(calculatedValue,
'f', 2);
1857 formulaValueStr = tr(
"Error");
1859 formulasOK[i] =
false;
1860 labelValue->setToolTip(tr(
"Parser error: %1").arg(e.
GetMsg()));
1863 if (formulasOK[i] && formulaValueStr.isEmpty() ==
false)
1865 formulaValueStr += labelUnits;
1867 labelValue->setText(formulaValueStr);
1875 QIcon icon(
":/icons/win.icon.theme/16x16/status/dialog-warning.png");
1876 ui->labels_TabWidget->setTabIcon(
ui->labels_TabWidget->indexOf(
ui->patternLabel_Tab), icon);
1888 if (
ui->grainline_GroupBox->isChecked() ==
true)
1904 if (
ui->pieceLabel_GroupBox->isChecked() ==
true)
1921 if (
ui->patternLabel_GroupBox->isChecked() ==
true)
1938 QPlainTextEdit *labelFormula;
1942 if (sender() ==
ui->length_PushButton)
1944 labelFormula =
ui->lengthFormula_LineEdit;
1945 checkForZero =
true;
1946 title = tr(
"Edit length");
1948 else if (sender() ==
ui->rotation_PushButton)
1950 labelFormula =
ui->rotationFormula_LineEdit;
1951 checkForZero =
false;
1952 title = tr(
"Edit angle");
1961 dialog.setWindowTitle(title);
1962 dialog.
SetFormula(
qApp->TrVars()->TryFormulaFromUser(labelFormula->toPlainText(),
qApp->Settings()->GetOsSeparator()));
1964 if (dialog.exec() == QDialog::Accepted)
1967 formula.replace(
"\n",
" ");
1969 if (sender() ==
ui->length_PushButton)
1973 else if (sender() ==
ui->rotation_PushButton)
1980 labelFormula->setPlainText(formula);
1989 QPlainTextEdit *labelFormula;
1993 if (sender() ==
ui->pieceLabelHeght_PushButton)
1995 labelFormula =
ui->pieceLabelHeightFormula_LineEdit;
1996 checkForZero =
true;
1997 title = tr(
"Edit height");
1999 else if (sender() ==
ui->pieceLabelWidth_PushButton)
2001 labelFormula =
ui->pieceLabelWidthFormula_LineEdit;
2002 checkForZero =
true;
2003 title = tr(
"Edit width");
2005 else if (sender() ==
ui->pieceLabelAngle_PushButton)
2007 labelFormula =
ui->pieceLabelAngleFormula_LineEdit;
2008 checkForZero =
false;
2009 title = tr(
"Edit angle");
2018 dialog.setWindowTitle(title);
2019 dialog.
SetFormula(
qApp->TrVars()->TryFormulaFromUser(labelFormula->toPlainText(),
qApp->Settings()->GetOsSeparator()));
2021 if (dialog.exec() == QDialog::Accepted)
2024 formula.replace(
"\n",
" ");
2025 if (sender() ==
ui->pieceLabelHeght_PushButton)
2029 else if (sender() ==
ui->pieceLabelWidth_PushButton)
2033 else if (sender() ==
ui->pieceLabelAngle_PushButton)
2040 labelFormula->setPlainText(formula);
2049 QPlainTextEdit *labelFormula;
2053 if (sender() ==
ui->patternLabelHeght_PushButton)
2055 labelFormula =
ui->patternLabelHeightFormula_LineEdit;
2056 checkForZero =
true;
2057 title = tr(
"Edit height");
2059 else if (sender() ==
ui->patternLabelWidth_PushButton)
2061 labelFormula =
ui->patternLabelWidthFormula_LineEdit;
2062 checkForZero =
true;
2063 title = tr(
"Edit width");
2065 else if (sender() ==
ui->patternLabelAngle_PushButton)
2067 labelFormula =
ui->patternLabelAngleFormula_LineEdit;
2068 checkForZero =
false;
2069 title = tr(
"Edit angle");
2078 dialog.setWindowTitle(title);
2079 dialog.
SetFormula(
qApp->TrVars()->TryFormulaFromUser(labelFormula->toPlainText(),
qApp->Settings()->GetOsSeparator()));
2081 if (dialog.exec() == QDialog::Accepted)
2084 formula.replace(
"\n",
" ");
2085 if (sender() ==
ui->patternLabelHeght_PushButton)
2089 else if (sender() ==
ui->patternLabelWidth_PushButton)
2093 else if (sender() ==
ui->patternLabelAngle_PushButton)
2100 labelFormula->setPlainText(formula);
2121 DeployFormula(
ui->pieceLabelWidthFormula_LineEdit,
ui->showPieceLabelWidth_PushButton,
2128 DeployFormula(
ui->pieceLabelHeightFormula_LineEdit,
ui->showPieceLabelHeight_PushButton,
2135 DeployFormula(
ui->pieceLabelAngleFormula_LineEdit,
ui->showPieceLabelAngle_PushButton,
2142 DeployFormula(
ui->patternLabelWidthFormula_LineEdit,
ui->showPatternLabelWidth_PushButton,
2149 DeployFormula(
ui->patternLabelHeightFormula_LineEdit,
ui->showPatternLabelHeight_PushButton,
2156 DeployFormula(
ui->patternLabelAngleFormula_LineEdit,
ui->showPatternLabelAngle_PushButton,
2175 QIcon icon(
":/icon/32x32/piece_label.png");
2176 ui->labels_TabWidget->setTabIcon(
ui->labels_TabWidget->indexOf(
ui->pieceLabel_Tab), icon);
2181 QIcon icon(
":/icon/32x32/pattern_label.png");
2182 ui->labels_TabWidget->setTabIcon(
ui->labels_TabWidget->indexOf(
ui->patternLabel_Tab), icon);
2191 const QString formula =
ui->widthFormula_PlainTextEdit->toPlainText();
2199 tr(
"Current seam allowance")));
2209 if (
ui->nodes_ComboBox->count() > 0)
2213 const QString formula =
ui->beforeWidthFormula_PlainTextEdit->toPlainText();
2225 if (
ui->nodes_ComboBox->count() > 0)
2229 const QString formula =
ui->afterWidthFormula_PlainTextEdit->toPlainText();
2242 dialog->setWindowTitle(tr(
"Edit seam allowance width"));
2246 if (dialog->exec() == QDialog::Accepted)
2257 dialog->setWindowTitle(tr(
"Edit seam allowance width before"));
2261 if (dialog->exec() == QDialog::Accepted)
2272 dialog->setWindowTitle(tr(
"Edit seam allowance width after"));
2276 if (dialog->exec() == QDialog::Accepted)
2321 DeployFormula(
ui->beforeWidthFormula_PlainTextEdit,
ui->beforeWidthGrow_PushButton,
2328 DeployFormula(
ui->afterWidthFormula_PlainTextEdit,
ui->afterWidthGrow_PushButton,
2338 if (topAnchorId !=
NULL_ID && bottomAnchorId !=
NULL_ID && topAnchorId != bottomAnchorId)
2367 if (topAnchorId !=
NULL_ID && bottomAnchorId !=
NULL_ID && topAnchorId != bottomAnchorId)
2375 QIcon icon(
":/icon/32x32/piece_label.png");
2376 ui->labels_TabWidget->setTabIcon(
ui->labels_TabWidget->indexOf(
ui->pieceLabel_Tab), icon);
2385 QIcon icon(
":/icons/win.icon.theme/16x16/status/dialog-warning.png");
2386 ui->labels_TabWidget->setTabIcon(
ui->labels_TabWidget->indexOf(
ui->pieceLabel_Tab), icon);
2400 if (topAnchorId !=
NULL_ID && bottomAnchorId !=
NULL_ID && topAnchorId != bottomAnchorId)
2408 QIcon icon(
":/icon/32x32/pattern_label.png");
2409 ui->labels_TabWidget->setTabIcon(
ui->labels_TabWidget->indexOf(
ui->patternLabel_Tab), icon);
2418 QIcon icon(
":/icons/win.icon.theme/16x16/status/dialog-warning.png");
2419 ui->labels_TabWidget->setTabIcon(
ui->labels_TabWidget->indexOf(
ui->patternLabel_Tab), icon);
2435 if (QDialog::Accepted == editor.exec())
2438 qApp->getCurrentDocument()->setPatternLabelTemplate(patternLabelLines);
2439 emit
qApp->getCurrentDocument()->UpdatePatternLabel();
2450 if (QDialog::Accepted == editor.exec())
2460 piece.
GetPath().
SetNodes(GetListInternals<VPieceNode>(
ui->mainPath_ListWidget));
2461 piece.
SetCustomSARecords(GetListInternals<CustomSARecord>(
ui->customSeamAllowance_ListWidget));
2463 piece.
setAnchors(GetListInternals<quint32>(
ui->anchorPoints_ListWidget));
2468 piece.
SetName(
ui->pieceName_LineEdit->text());
2517 const QRectF rect = QPolygonF(path.
PathPoints(
data)).boundingRect();
2521 qreal xPos = rect.center().x() + (rect.width()/2.0 - width)/2.0;
2522 qreal yPos = rect.center().y() - height/2.0;
2525 xPos = rect.left() + (rect.width()/2.0 - width)/2.0;
2526 yPos = rect.center().y() - height/2.0;
2529 xPos = rect.center().x();
2550 QListWidgetItem *item =
new QListWidgetItem(name);
2551 item->setData(Qt::UserRole, QVariant::fromValue(record));
2552 ui->customSeamAllowance_ListWidget->addItem(item);
2553 ui->customSeamAllowance_ListWidget->setCurrentRow(
ui->customSeamAllowance_ListWidget->count()-1);
2564 QListWidgetItem *item =
new QListWidgetItem(name);
2565 item->setData(Qt::UserRole, QVariant::fromValue(path));
2566 ui->internalPaths_ListWidget->addItem(item);
2567 ui->internalPaths_ListWidget->setCurrentRow(
ui->internalPaths_ListWidget->count()-1);
2578 QListWidgetItem *item =
new QListWidgetItem(anchor->name());
2579 item->setData(Qt::UserRole, QVariant::fromValue(anchorPoint));
2580 ui->anchorPoints_ListWidget->addItem(item);
2581 ui->anchorPoints_ListWidget->setCurrentRow(
ui->anchorPoints_ListWidget->count()-1);
2596 name = QLatin1String(
"- ") + name;
2606 QString color =
ui->color_Label->text();
2613 ui->color_Label->setText(color);
2614 ui->color_Label->setPalette(QPalette(color));
2661 warning += tr(
"You need more points!");
2662 ui->status_Label->setText(warning);
2669 warning += tr(
"You must choose points in a clockwise direction!");
2670 ui->status_Label->setText(warning);
2675 warning += tr(
"First point cannot be same as last point!");
2676 ui->status_Label->setText(warning);
2681 warning += tr(
"You have double points!");
2682 ui->status_Label->setText(warning);
2687 warning += tr(
"Each point in the path must be unique!");
2688 ui->status_Label->setText(warning);
2713 const quint32
id =
ui->nodes_ComboBox->currentData().toUInt();
2715 ui->nodes_GroupBox->setEnabled(
true);
2716 ui->nodes_ComboBox->blockSignals(
true);
2717 ui->nodes_ComboBox->clear();
2721 for (
int i = 0; i < nodes.size(); ++i)
2728 ui->nodes_ComboBox->addItem(info.
name, node.
GetId());
2734 const int index =
ui->nodes_ComboBox->findData(
id);
2737 ui->nodes_ComboBox->setCurrentIndex(index);
2744 ui->nodes_ComboBox->blockSignals(
false);
2748 ui->nodes_GroupBox->setEnabled(
false);
2755 const quint32
id =
ui->notches_ComboBox->currentData().toUInt();
2757 ui->notches_ComboBox->blockSignals(
true);
2758 ui->notches_ComboBox->clear();
2762 for (
int i = 0; i < nodes.size(); ++i)
2769 ui->notches_ComboBox->addItem(QIcon(info.
icon), info.
name, node.
GetId());
2772 ui->notches_ComboBox->blockSignals(
false);
2774 const int index =
ui->notches_ComboBox->findData(
id);
2777 ui->notches_ComboBox->setCurrentIndex(index);
2789 for (qint32 i = 0; i <
ui->mainPath_ListWidget->count(); ++i)
2791 QListWidgetItem *item =
ui->mainPath_ListWidget->item(i);
2792 const VPieceNode node = qvariant_cast<VPieceNode>(item->data(Qt::UserRole));
2794 if (node.
GetId() ==
id)
2805 const int count =
ui->mainPath_ListWidget->count();
2808 QListWidgetItem *item =
ui->mainPath_ListWidget->item(count-1);
2809 const VPieceNode node = qvariant_cast<VPieceNode>(item->data(Qt::UserRole));
2810 return node.
GetId();
2821 const int count =
ui->mainPath_ListWidget->count();
2824 QListWidgetItem *item =
ui->mainPath_ListWidget->item(count-1);
2825 const VPieceNode node = qvariant_cast<VPieceNode>(item->data(Qt::UserRole));
2838 for (
int i = 0; i < nodes.size(); ++i)
2843 qDebug() <<
"point nodes exist";
2847 qDebug() <<
"point nodes do not exist";
2868 const int index =
ui->nodes_ComboBox->currentIndex();
2871 QListWidgetItem *rowItem =
getItemById(
ui->nodes_ComboBox->currentData().toUInt());
2874 VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
2876 rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
2884 const int index =
ui->nodes_ComboBox->currentIndex();
2887 QListWidgetItem *rowItem =
getItemById(
ui->nodes_ComboBox->currentData().toUInt());
2890 VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
2892 rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
2900 ui->forbidFlipping_CheckBox->setChecked(
qApp->Settings()->getForbidPieceFlipping());
2901 ui->hideSeamLine_CheckBox->setChecked(
qApp->Settings()->isHideSeamLine());
2903 ui->mainPath_ListWidget->installEventFilter(
this);
2904 ui->mainPath_ListWidget->setContextMenuPolicy(Qt::CustomContextMenu);
2905 connect(
ui->mainPath_ListWidget, &QListWidget::customContextMenuRequested,
this,
2908 connect(
ui->mainPath_ListWidget->model(), &QAbstractItemModel::rowsMoved,
this, [
this]()
2911 validateObjects(isMainPathValid());
2914 connect(
ui->mainPath_ListWidget, &QListWidget::itemSelectionChanged,
2916 connect(
ui->moveTop_ToolButton,&QToolButton::clicked,
this, [
this]()
2918 moveListRowTop(ui->mainPath_ListWidget);
2919 validateObjects(isMainPathValid());
2921 connect(
ui->moveUp_ToolButton, &QToolButton::clicked,
this, [
this]()
2923 moveListRowUp(ui->mainPath_ListWidget);
2924 validateObjects(isMainPathValid());
2926 connect(
ui->moveDown_ToolButton, &QToolButton::clicked,
this, [
this]()
2928 moveListRowDown(ui->mainPath_ListWidget);
2929 validateObjects(isMainPathValid());
2931 connect(
ui->moveBottom_ToolButton, &QToolButton::clicked,
this, [
this]()
2933 moveListRowBottom(ui->mainPath_ListWidget);
2934 validateObjects(isMainPathValid());
2941 ui->seams_CheckBox->setChecked(
qApp->Settings()->getDefaultSeamAllowanceVisibilty());
2948 ui->widthFormula_PlainTextEdit->installEventFilter(
this);
2949 ui->beforeWidthFormula_PlainTextEdit->installEventFilter(
this);
2950 ui->afterWidthFormula_PlainTextEdit->installEventFilter(
this);
2968 ui->widthFormula_PlainTextEdit->setPlainText(
qApp->LocaleToString(
m_saWidth));
2971 connect(
ui->nodes_ComboBox,
static_cast<void (QComboBox::*)(
int)
>(&QComboBox::currentIndexChanged),
this,
2978 connect(
ui->angle_ComboBox,
static_cast<void (QComboBox::*)(
int)
>(&QComboBox::currentIndexChanged),
this,
2981 ui->customSeamAllowance_ListWidget->setContextMenuPolicy(Qt::CustomContextMenu);
2982 connect(
ui->customSeamAllowance_ListWidget, &QListWidget::customContextMenuRequested,
this,
2984 connect(
ui->customSeamAllowance_ListWidget, &QListWidget::currentRowChanged,
this,
2986 connect(
ui->startPoint_ComboBox,
static_cast<void (QComboBox::*)(
int)
>(&QComboBox::currentIndexChanged),
2988 connect(
ui->endPoint_ComboBox,
static_cast<void (QComboBox::*)(
int)
>(&QComboBox::currentIndexChanged),
this,
2990 connect(
ui->comboBoxIncludeType,
static_cast<void (QComboBox::*)(
int)
>(&QComboBox::currentIndexChanged),
2997 connect(
ui->widthFormula_PlainTextEdit, &QPlainTextEdit::textChanged,
this,
2999 connect(
ui->beforeWidthFormula_PlainTextEdit, &QPlainTextEdit::textChanged,
this,
3001 connect(
ui->afterWidthFormula_PlainTextEdit, &QPlainTextEdit::textChanged,
this,
3004 connect(
ui->widthGrow_PushButton, &QPushButton::clicked,
this,
3006 connect(
ui->beforeWidthGrow_PushButton, &QPushButton::clicked,
3008 connect(
ui->afterWidthGrow_PushButton, &QPushButton::clicked,
this,
3017 box->addItem(tr(
"Empty"),
NULL_ID);
3021 for (
int i = 0; i < nodes.size(); ++i)
3038 if (box->count() > 0)
3040 currentId = box->currentData().toUInt();
3044 box->addItem(QLatin1String(
"<") + tr(
"None") + QLatin1String(
">"),
NULL_ID);
3046 const QVector<quint32> anchorPoints = GetListInternals<quint32>(
ui->anchorPoints_ListWidget);
3048 for (
int i = 0; i < anchorPoints.size(); ++i)
3051 box->addItem(anchorPoint->name(), anchorPoints.at(i));
3054 const int index =
ui->nodes_ComboBox->findData(currentId);
3057 box->setCurrentIndex(index);
3064 ui->comboBoxIncludeType->clear();
3066 ui->comboBoxIncludeType->addItem(tr(
"main path"),
3068 ui->comboBoxIncludeType->addItem(tr(
"custom seam allowance"),
3075 ui->internalPaths_ListWidget->setContextMenuPolicy(Qt::CustomContextMenu);
3076 connect(
ui->internalPaths_ListWidget, &QListWidget::customContextMenuRequested,
this,
3083 ui->pieceName_LineEdit->setClearButtonEnabled(
true);
3084 ui->letter_LineEdit->setClearButtonEnabled(
true);
3085 ui->annotation_LineEdit->setClearButtonEnabled(
true);
3087 QColor color = QColor(Qt::white);
3088 ui->color_Label->setText(color.name());
3089 ui->color_Label->setPalette(QPalette(color));
3099 ui->pieceLabel_GroupBox->setChecked(
qApp->Settings()->showPieceLabels());
3101 ui->pieceLabelWidthFormula_LineEdit->setPlainText(QString::number(
qApp->Settings()->getDefaultLabelWidth()));
3102 ui->pieceLabelHeightFormula_LineEdit->setPlainText(QString::number(
qApp->Settings()->getDefaultLabelHeight()));
3113 connect(
ui->pieceLabelTopLeftAnchor_ComboBox, &QComboBox::currentTextChanged,
3116 connect(
ui->pieceLabelBottomRightAnchor_ComboBox, &QComboBox::currentTextChanged,
3119 connect(
ui->pieceLabelWidth_PushButton, &QPushButton::clicked,
3121 connect(
ui->pieceLabelHeght_PushButton, &QPushButton::clicked,
3123 connect(
ui->pieceLabelAngle_PushButton, &QPushButton::clicked,
3126 connect(
ui->pieceLabelWidthFormula_LineEdit, &QPlainTextEdit::textChanged,
this,
3128 connect(
ui->pieceLabelHeightFormula_LineEdit, &QPlainTextEdit::textChanged,
this,
3130 connect(
ui->pieceLabelAngleFormula_LineEdit, &QPlainTextEdit::textChanged,
this,
3133 connect(
ui->showPieceLabelWidth_PushButton, &QPushButton::clicked,
3135 connect(
ui->showPieceLabelHeight_PushButton, &QPushButton::clicked,
3137 connect(
ui->showPieceLabelAngle_PushButton, &QPushButton::clicked,
3145 QString filename =
qApp->Settings()->getDefaultPatternTemplate();
3146 if (QFileInfo(filename).exists())
3156 ui->patternLabel_GroupBox->setChecked(
qApp->Settings()->showPatternLabels());
3158 ui->patternLabelWidthFormula_LineEdit->setPlainText(QString::number(
qApp->Settings()->getDefaultLabelWidth()));
3159 ui->patternLabelHeightFormula_LineEdit->setPlainText(QString::number(
qApp->Settings()->getDefaultLabelHeight()));
3170 connect(
ui->patternLabelTopLeftAnchor_ComboBox, &QComboBox::currentTextChanged,
3173 connect(
ui->patternLabelBottomRightAnchor_ComboBox, &QComboBox::currentTextChanged,
3176 connect(
ui->patternLabelWidth_PushButton, &QPushButton::clicked,
3178 connect(
ui->patternLabelHeght_PushButton, &QPushButton::clicked,
3180 connect(
ui->patternLabelAngle_PushButton, &QPushButton::clicked,
3183 connect(
ui->patternLabelWidthFormula_LineEdit, &QPlainTextEdit::textChanged,
this,
3185 connect(
ui->patternLabelHeightFormula_LineEdit, &QPlainTextEdit::textChanged,
this,
3187 connect(
ui->patternLabelAngleFormula_LineEdit, &QPlainTextEdit::textChanged,
this,
3190 connect(
ui->showPatternLabelWidth_PushButton, &QPushButton::clicked,
3192 connect(
ui->showPatternLabelHeight_PushButton, &QPushButton::clicked,
3194 connect(
ui->showPatternLabelAngle_PushButton, &QPushButton::clicked,
3204 QString filename =
qApp->Settings()->getDefaultPatternTemplate();
3205 if (QFileInfo(filename).exists())
3221 ui->grainline_GroupBox->setChecked(
qApp->Settings()->getDefaultGrainlineVisibilty());
3223 ui->lengthFormula_LineEdit->setPlainText(QString::number(
qApp->Settings()->getDefaultGrainlineLength()));
3228 connect(
ui->lengthFormula_LineEdit, &QPlainTextEdit::textChanged,
this,
3231 connect(
ui->rotationFormula_LineEdit, &QPlainTextEdit::textChanged,
this,
3234 connect(
ui->showRotation_PushButton, &QPushButton::clicked,
this,
3237 connect(
ui->showLength_PushButton, &QPushButton::clicked,
this,
3242 ui->arrow_ComboBox->addItem(tr(
"Both"));
3243 ui->arrow_ComboBox->addItem(tr(
"Just front"));
3244 ui->arrow_ComboBox->addItem(tr(
"Just rear"));
3253 connect(
ui->grainlineTopAnchor_ComboBox, &QComboBox::currentTextChanged,
3256 connect(
ui->grainlineBottomAnchor_ComboBox, &QComboBox::currentTextChanged,
3263 ui->anchorPoints_ListWidget->setContextMenuPolicy(Qt::CustomContextMenu);
3264 connect(
ui->anchorPoints_ListWidget, &QListWidget::customContextMenuRequested,
this,
3273 ui->notchLength_DoubleSpinBox->setValue(
qApp->Settings()->getDefaultNotchLength());
3274 ui->notchWidth_DoubleSpinBox->setValue(
qApp->Settings()->getDefaultNotchWidth());
3275 ui->showNotch_CheckBox->setChecked(
qApp->Settings()->showSeamAllowanceNotch());
3276 ui->showSeamlineNotch_CheckBox->setChecked(
qApp->Settings()->showSeamlineNotch());
3278 connect(
ui->notches_ComboBox,
static_cast<void (QComboBox::*)(
int)
>(&QComboBox::currentIndexChanged),
3281 connect(
ui->notchType_ButtonGroup, &QButtonGroup::idClicked,
3284 connect(
ui->notchSubType_ButtonGroup, &QButtonGroup::idClicked,
3287 connect(
ui->showNotch_CheckBox, &QCheckBox::stateChanged,
this,
3290 connect(
ui->showSeamlineNotch_CheckBox, &QCheckBox::stateChanged,
this,
3293 connect(
ui->notchLength_DoubleSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
3298 connect(
ui->notchWidth_DoubleSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
3303 connect(
ui->notchAngle_DoubleSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
3308 connect(
ui->notchCount_SpinBox, QOverload<int>::of(&QSpinBox::valueChanged),
3331 QString width =
ui->widthFormula_PlainTextEdit->toPlainText();
3332 width.replace(
"\n",
" ");
3333 return qApp->TrVars()->TryFormulaFromUser(width,
qApp->Settings()->GetOsSeparator());
3339 const QString width =
qApp->TrVars()->FormulaToUser(formula,
qApp->Settings()->GetOsSeparator());
3341 if (width.length() > 80)
3345 ui->widthFormula_PlainTextEdit->setPlainText(width);
3358 const int row =
ui->customSeamAllowance_ListWidget->currentRow();
3359 if (
ui->customSeamAllowance_ListWidget->count() == 0 || row == -1)
3364 QListWidgetItem *item =
ui->customSeamAllowance_ListWidget->item(row);
3366 const CustomSARecord record = qvariant_cast<CustomSARecord>(item->data(Qt::UserRole));
3373 const int row =
ui->internalPaths_ListWidget->currentRow();
3374 if (
ui->internalPaths_ListWidget->count() == 0 || row == -1)
3379 QListWidgetItem *item =
ui->internalPaths_ListWidget->item(row);
3381 const quint32 path = qvariant_cast<quint32>(item->data(Qt::UserRole));
3388 if (angleFormula.isEmpty())
3390 angleFormula = QString(
"0");
3393 const QString formula =
qApp->TrVars()->FormulaToUser(angleFormula,
qApp->Settings()->GetOsSeparator());
3395 if (formula.length() > 80)
3399 ui->rotationFormula_LineEdit->setPlainText(formula);
3407 if (lengthFormula.isEmpty())
3412 const QString formula =
qApp->TrVars()->FormulaToUser(lengthFormula,
qApp->Settings()->GetOsSeparator());
3414 if (formula.length() > 80)
3419 ui->lengthFormula_LineEdit->setPlainText(formula);
3427 if (widthFormula.isEmpty())
3432 const QString formula =
qApp->TrVars()->FormulaToUser(widthFormula,
qApp->Settings()->GetOsSeparator());
3434 if (formula.length() > 80)
3439 ui->pieceLabelWidthFormula_LineEdit->setPlainText(formula);
3447 if (heightFormula.isEmpty())
3452 const QString formula =
qApp->TrVars()->FormulaToUser(heightFormula,
qApp->Settings()->GetOsSeparator());
3454 if (formula.length() > 80)
3459 ui->pieceLabelHeightFormula_LineEdit->setPlainText(formula);
3467 if (angleFormula.isEmpty())
3469 angleFormula = QString(
"0");
3472 const QString formula =
qApp->TrVars()->FormulaToUser(angleFormula,
qApp->Settings()->GetOsSeparator());
3474 if (formula.length() > 80)
3479 ui->pieceLabelAngleFormula_LineEdit->setPlainText(formula);
3487 if (widthFormula.isEmpty())
3492 const QString formula =
qApp->TrVars()->FormulaToUser(widthFormula,
qApp->Settings()->GetOsSeparator());
3494 if (formula.length() > 80)
3499 ui->patternLabelWidthFormula_LineEdit->setPlainText(formula);
3507 if (heightFormula.isEmpty())
3512 const QString formula =
qApp->TrVars()->FormulaToUser(heightFormula,
qApp->Settings()->GetOsSeparator());
3514 if (formula.length() > 80)
3519 ui->patternLabelHeightFormula_LineEdit->setPlainText(formula);
3527 if (angleFormula.isEmpty())
3529 angleFormula = QString(
"0");
3532 const QString formula =
qApp->TrVars()->FormulaToUser(angleFormula,
qApp->Settings()->GetOsSeparator());
3534 if (formula.length() > 80)
3539 ui->patternLabelAngleFormula_LineEdit->setPlainText(formula);
3552 m_anchorPoints->setAnchors(GetListInternals<quint32>(
ui->anchorPoints_ListWidget));
3571 ui->moveTop_ToolButton->setEnabled(
false);
3572 ui->moveUp_ToolButton->setEnabled(
false);
3573 ui->moveDown_ToolButton->setEnabled(
false);
3574 ui->moveBottom_ToolButton->setEnabled(
false);
3576 if (
ui->mainPath_ListWidget->count() > 1)
3578 if (
ui->mainPath_ListWidget->currentRow() == 0)
3580 ui->moveDown_ToolButton->setEnabled(
true);
3581 ui->moveBottom_ToolButton->setEnabled(
true);
3583 else if (
ui->mainPath_ListWidget->currentRow() ==
ui->mainPath_ListWidget->count() - 1)
3585 ui->moveTop_ToolButton->setEnabled(
true);
3586 ui->moveUp_ToolButton->setEnabled(
true);
3590 ui->moveTop_ToolButton->setEnabled(
true);
3591 ui->moveUp_ToolButton->setEnabled(
true);
3592 ui->moveDown_ToolButton->setEnabled(
true);
3593 ui->moveBottom_ToolButton->setEnabled(
true);
3602 QStringList pieceNames;
3604 for (
int i = 0; i < pieces.size(); ++i)
3606 pieceNames.append(pieces.at(i).GetName());
3609 const QString defaultName = tr(
"PatternPiece");
3610 QString pieceName = defaultName;
3613 while(pieceNames.contains(pieceName))
3615 pieceName = defaultName + QString(
"_%1").arg(++i);
3627 VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
3633 rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
3634 rowItem->setIcon(QIcon(info.
icon));
3635 rowItem->setText(info.
name);
3646 VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
3662 VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
3665 rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
3666 rowItem->setIcon(QIcon(info.
icon));
3667 rowItem->setText(info.
name);
3679 VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
3686 rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
3687 rowItem->setIcon(QIcon(info.
icon));
3688 rowItem->setText(info.
name);
3695 const qint32 index = box->findText(text);
3698 box->setCurrentIndex(index);
3702 box->setCurrentIndex(0);
3709 QString formula = text->toPlainText().simplified();
3710 formula.replace(
"\n",
" ");
3711 formula =
qApp->TrVars()->FormulaFromUser(formula,
qApp->Settings()->GetOsSeparator());
The Calculator class for calculation formula.
qreal EvalFormula(const QHash< QString, QSharedPointer< VInternalVariable > > *vars, const QString &formula)
eval calculate formula.
VPiecePath GetPiecePath() const
void SetTemplate(const QVector< VLabelTemplateLine > &lines)
QVector< VLabelTemplateLine > GetTemplate() const
void SetPiece(const VPiece &piece)
void updateNodeBeforeSeamAllowance(const QString &formula)
void expandPieceLabelHeight()
void notchLengthChanged(qreal value)
void expandPatternLabelWidth()
void setPieceLabelAngle(QString angleFormula)
virtual void CheckState() Q_DECL_FINAL
SaveData Put dialog data in local variables.
VPieceNode getLastNode() const
void initializePropertiesTab()
void setErrorText(TabOrder tab, QString text)
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE
closeEvent handle when dialog cloded
void setSeamAllowanceWidthFormula(const QString &formula)
int m_patternLabelHeightBaseHeight
void showAnchorsContextMenu(const QPoint &pos)
void initAnchorPointComboboxes()
void editGrainlineFormula()
void setPatternLabelHeight(QString heightFormula)
void customSAEndPointChanged(int index)
void evaluateBeforeWidth()
void setPieceLock(const bool &state)
void editPieceLabelFormula()
void setPieceColor(const QString &value)
void notchCountChanged(int value)
void setPieceLabelWidth(QString widthFormula)
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE
ChosenObject adds selected object of id and type to list of path items.
void customSAStartPointChanged(int index)
bool flagPatternLabelAnchor
QString getPathName(quint32 path, bool reverse=false) const
VPatternLabelData m_oldGeom
void setGrainlineLength(QString lengthFormula)
int m_pieceLabelWidthBaseHeight
void initAnchorPoint(QComboBox *box)
void defaultWidthChanged()
void notchTypeChanged(int id)
void expandGrainlineRotation()
QPointer< PieceAnchorPointVisual > m_anchorPoints
QPointer< DialogTool > m_dialog
QTimer * m_timerWidthBefore
QString getPieceColor() const
void initializeNotchesList()
void editDefaultSeamAllowanceWidth()
bool flagPatternLabelAngle
void setPatternLabelWidth(QString widthFormula)
virtual bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE
bool isMainPathClockwise() const
int m_patternLabelWidthBaseHeight
void updateNodeAfterSeamAllowance(const QString &formula)
void evaluateAfterWidth()
void initializeLabelsTab()
void setNotch(QListWidgetItem *rowItem, bool isNotch, NotchType notchType)
bool flagPieceLabelFormula
VPieceLabelData m_oldData
void expandWidthAfterFormulaTextEdit()
void enableApply(bool enable)
QVector< VLabelTemplateLine > m_pieceLabelLines
void expandPieceLabelWidth()
void enableBuiltIn(bool enable)
void setCurrentAfterSeamAllowance(const QString &formula)
void enableDefaultBeforeButton()
void setCurrentBeforeSeamAllowance(const QString &formula)
void patternLabelAnchorChanged()
void showCustomSAContextMenu(const QPoint &pos)
QString createPieceName() const
void customSeamAllowanceChanged(int row)
qreal getFormulaValue(QPlainTextEdit *text) const
virtual void SaveData() Q_DECL_OVERRIDE
SaveData Put dialog data in local variables.
void setPieceLabelHeight(QString heightFormula)
void duplicateNode(QListWidgetItem *rowItem)
bool flagPatternLabelFormula
Ui::PatternPieceDialog * ui
void enableSeamAllowance(bool enable)
void notchWidthChanged(qreal value)
void editPatternLabelFormula()
void setCurrentText(QComboBox *box, const QString &text) const
bool pointNodesExist() const
void initializeSeamAllowanceTab()
void initializeGrainlineTab()
void notchChanged(int index)
void editAfterSeamAllowanceWidth()
void expandWidthBeforeFormulaTextEdit()
void validateObjects(bool value)
bool flagPieceLabelAnchor
int m_patternLabelAngleBaseHeight
void beforeWidthChanged()
void showNotchChanged(int state)
int m_pieceLabelAngleBaseHeight
void initializeSAIncludeType()
void setPatternLabelAngle(QString angleFormula)
void setInLayout(const bool &state)
void initializeNotchesTab()
void clearErrorText(TabOrder tab, QString text)
VPiece CreatePiece() const
void updatePieceLabelValues()
void updateCurrentInternalPathRecord()
int m_pieceLabelHeightBaseHeight
void SetPiece(const VPiece &piece)
void newInternalPath(quint32 path)
QVector< VLabelTemplateLine > m_patternLabelLines
void newCustomSeamAllowance(const CustomSARecord &record)
QString getSeamAllowanceWidthFormula() const
void enabledPatternLabel()
void showInternalPathsContextMenu(const QPoint &pos)
void initializeInternalPathsTab()
void pieceLabelAnchorChanged()
void showSeamlineNotchChanged(int state)
void updateCurrentCustomSARecord()
void initializeCSAPoint(QComboBox *box)
PatternPieceDialog(const VContainer *data, const quint32 &toolId, QWidget *parent=nullptr)
void pathDialogClosed(int result)
void initializeNodesList()
void editBeforeSeamAllowanceWidth()
void newAnchorPoint(quint32 anchorPoint)
virtual void ShowDialog(bool click) Q_DECL_OVERRIDE
void notchSubTypeChanged(int id)
virtual ~PatternPieceDialog()
void expandPatternLabelAngle()
void newMainPathItem(const VPieceNode &node)
void grainlineAnchorChanged()
QListWidgetItem * getItemById(quint32 id)
void enableDefaultAfterButton()
void nodeAngleChanged(int index)
void resetLabelsWarning()
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE
showEvent handle when window show
QString getPieceFill() const
void updateGrainlineValues()
void expandWidthFormulaTextEdit()
void setPieceFill(const QString &value)
bool flagGrainlineFormula
void nodeChanged(int index)
void expandPieceLabelAngle()
void updatePatternLabelValues()
void reverseNode(QListWidgetItem *rowItem)
void pageChanged(QListWidgetItem *current, QListWidgetItem *previous)
void setGrainlineAngle(QString angleFormula)
quint32 getPreviousId() const
void evaluateDefaultWidth()
void excludeNode(QListWidgetItem *rowItem)
virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE
bool getPieceLock() const
void initializeMainPathTab()
void resetGrainlineWarning()
void initializeAnchorsTab()
void expandPatternLabelHeight()
void showMainPathContextMenu(const QPoint &pos)
void customSAIncludeTypeChanged(int index)
bool isMainPathValid() const
void expandGrainlineLength()
QTimer * m_timerWidthAfter
void notchAngleChanged(qreal value)
VGrainlineData m_oldGrainline
void SetPiece(const VPiece &piece)
void SetVisible(bool bVisible)
void SetPos(const QPointF &ptPos)
static VDataTool * getTool(quint32 id)
getTool return tool from tool list.
bool IsSeamAllowanceBuiltIn() const
bool IsSeamAllowance() const
bool isHideSeamLine() const
static bool isClockwise(const QVector< QPointF > &points)
void setFill(const QString &value)
void SetForbidFlipping(bool value)
void setColor(const QString &value)
void setHideSeamLine(bool value)
void SetName(const QString &value)
void SetSeamAllowanceBuiltIn(bool value)
void SetSeamAllowance(bool value)
bool IsForbidFlipping() const
The VContainer class container of all variables.
void AddVariable(const QString &name, T *var)
const QHash< quint32, VPiece > * DataPieces() const
const QHash< QString, QSharedPointer< VInternalVariable > > * DataVariables() const
const QSharedPointer< VGObject > GetGObject(quint32 id) const
GetGObject returns a point by id.
const QSharedPointer< T > GeometricObject(const quint32 &id) const
VPiecePath GetPiecePath(quint32 id) const
const Unit * GetPatternUnit() const
virtual void setXMLContent(const QString &fileName)
The VExceptionBadId class for exception bad id.
virtual QString ErrorMessage() const Q_DECL_OVERRIDE
ErrorMessage return main error message.
virtual QString DetailedInformation() const
DetailedInformation return detailed information about error.
ArrowType GetArrowType() const
void setBottomAnchorPoint(quint32 bottomAnchorPoint)
void SetRotation(const QString &qsRot)
quint32 centerAnchorPoint() const
QString GetRotation() const
void SetLength(const QString &qsLen)
void SetArrowType(ArrowType eAT)
quint32 bottomAnchorPoint() const
quint32 topAnchorPoint() const
void setCenterAnchorPoint(quint32 centerAnchor)
QString GetLength() const
void setTopAnchorPoint(quint32 topAnchorPoint)
The VIncrement class keep data row of increment table.
QVector< VLabelTemplateLine > ReadLines() const
void setBottomRightAnchorPoint(const quint32 &bottomRightAnchorPoint)
void setCenterAnchorPoint(const quint32 ¢erAnchorPoint)
void SetLabelHeight(const QString &dLabelH)
void SetFontSize(int iSize)
quint32 centerAnchorPoint() const
void SetRotation(const QString &dRot)
quint32 topLeftAnchorPoint() const
QString GetLabelWidth() const
void SetLabelWidth(const QString &dLabelW)
QString GetRotation() const
void setTopLeftAnchorPoint(const quint32 &topLeftAnchorPoint)
quint32 bottomRightAnchorPoint() const
QString GetLabelHeight() const
void SetAnnotation(const QString &val)
void SetOnFold(bool onFold)
void SetLabelTemplate(const QVector< VLabelTemplateLine > &lines)
QString GetOrientation() const
void SetTilt(const QString &val)
void SetRotationWay(const QString &val)
void SetFoldPosition(const QString &val)
QVector< VLabelTemplateLine > GetLabelTemplate() const
void SetQuantity(int val)
QString GetRotationWay() const
void SetOrientation(const QString &val)
void SetLetter(const QString &qsLetter)
QString GetAnnotation() const
QString GetLetter() const
QString GetFoldPosition() const
void setBeforeSAFormula(const QString &formula)
void setShowNotch(bool value)
void setNotchCount(int notchCount)
void SetExcluded(bool exclude)
void setNotch(bool notch)
void setNotchType(NotchType notchType)
void setAfterSAFormula(const QString &formula)
PieceNodeAngle GetAngleType() const
void setNotchLength(qreal notchLength)
NotchType getNotchType() const
QString GetFormulaSAAfter() const
void setNotchWidth(qreal notchWidth)
qreal getNotchAngle() const
QString GetFormulaSABefore() const
void setShowSeamlineNotch(bool value)
void SetAngleType(PieceNodeAngle type)
qreal getNotchLength() const
void SetReverse(bool reverse)
int getNotchCount() const
void setNotchAngle(qreal notchAngle)
NotchSubType getNotchSubType() const
qreal getNotchWidth() const
bool showSeamlineNotch() const
void setNotchSubType(NotchSubType notchSubType)
QVector< QPointF > PathPoints(const VContainer *data) const
qint32 CountNodes() const
void SetNodes(const QVector< VPieceNode > &nodes)
const VPieceNode & at(int indx) const
int indexOfNode(quint32 id) const
void setIsLocked(bool isLocked)
VPieceLabelData & GetPatternPieceData()
Returns full access to the pattern piece data object.
QVector< CustomSARecord > GetCustomSARecords() const
QString getSeamAllowanceWidthFormula() const
QVector< quint32 > GetInternalPaths() const
void SetInLayout(bool inLayout)
QVector< quint32 > getAnchors() const
void setAnchors(const QVector< quint32 > &anchors)
void SetCustomSARecords(const QVector< CustomSARecord > &records)
void setSeamAllowanceWidthFormula(const QString &formula, qreal value)
void SetInternalPaths(const QVector< quint32 > &iPaths)
QVector< QPointF > MainPathPoints(const VContainer *data) const
VGrainlineData & GetGrainlineGeometry()
VDetail::GetGrainlineGeometry full access to the grainline geometry object.
VPatternLabelData & GetPatternInfo()
Returns full access to the pattern info geometry object.
VPiecePath GetPath() const
The VPointF class keep data of point.
Error class of the parser.
const QString & GetMsg() const
Returns the message string for this error.
Unit StrToUnits(const QString &unit)
double ToPixel(double val, const Unit &unit)
const QString degreeSymbol
QString UnitsToStr(const Unit &unit, const bool translate)
UnitsToStr translate unit to string.
NotchType stringToNotchType(const QString &value)
qreal UnitConvertor(qreal value, const Unit &from, const Unit &to)
const QString currentSeamAllowance
QString getFormulaFromUser(QPlainTextEdit *textEdit)
void enableDefaultButton(QPushButton *defButton, const QString &formula)
The CustomSA struct contains record about custom seam allowanse (SA).
PiecePathIncludeType includeType