diff --git a/src/app/valentina/main.cpp b/src/app/valentina/main.cpp index 9dad7ebc1..51c1ce34c 100644 --- a/src/app/valentina/main.cpp +++ b/src/app/valentina/main.cpp @@ -54,8 +54,6 @@ int main(int argc, char *argv[]) qt_qhash_seed.store(0); // Lock producing random attribute order in XML - qRegisterMetaTypeStreamOperators("VPieceNode"); - #ifndef Q_OS_MAC // supports natively InitHighDpiScaling(argc, argv); #endif //Q_OS_MAC diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index 4d8d2215a..e1523976b 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -89,6 +89,19 @@ enum class PieceNodeAngle : unsigned char BySecondEdgeRightAngle }; +enum class PassmarkLineType : unsigned char +{ + OneLine = 0, + TwoLines, + ThreeLines +}; + +enum class PassmarkAngleType : unsigned char +{ + Straightforward = 0, + Bisector +}; + enum class PiecePathIncludeType : unsigned char { AsMainPath = 0, diff --git a/src/libs/vmisc/share/resources/icon.qrc b/src/libs/vmisc/share/resources/icon.qrc index 0eb3b135e..45ab2b772 100644 --- a/src/libs/vmisc/share/resources/icon.qrc +++ b/src/libs/vmisc/share/resources/icon.qrc @@ -74,5 +74,7 @@ icon/32x32/paths@2x.png icon/32x32/pins.png icon/32x32/pins@2x.png + icon/32x32/passmark.png + icon/32x32/passmark@2x.png diff --git a/src/libs/vmisc/share/resources/icon/32x32/passmark.png b/src/libs/vmisc/share/resources/icon/32x32/passmark.png new file mode 100644 index 000000000..c46b5ee65 Binary files /dev/null and b/src/libs/vmisc/share/resources/icon/32x32/passmark.png differ diff --git a/src/libs/vmisc/share/resources/icon/32x32/passmark@2x.png b/src/libs/vmisc/share/resources/icon/32x32/passmark@2x.png new file mode 100644 index 000000000..d0893799b Binary files /dev/null and b/src/libs/vmisc/share/resources/icon/32x32/passmark@2x.png differ diff --git a/src/libs/vmisc/share/resources/icon/svg/passmark.svg b/src/libs/vmisc/share/resources/icon/svg/passmark.svg new file mode 100644 index 000000000..e8baae972 --- /dev/null +++ b/src/libs/vmisc/share/resources/icon/svg/passmark.svg @@ -0,0 +1,73 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/src/libs/vpatterndb/vpiecenode.cpp b/src/libs/vpatterndb/vpiecenode.cpp index b83daa1df..36df0b31b 100644 --- a/src/libs/vpatterndb/vpiecenode.cpp +++ b/src/libs/vpatterndb/vpiecenode.cpp @@ -215,25 +215,43 @@ void VPieceNode::SetAngleType(PieceNodeAngle type) } } -// Friend functions //--------------------------------------------------------------------------------------------------------------------- -QDataStream& operator<<(QDataStream& out, const VPieceNode& p) +bool VPieceNode::IsPassmark() const { - out << p.d->m_id << static_cast(p.d->m_typeTool) << p.d->m_reverse; - return out; + return d->m_isPassmark; } //--------------------------------------------------------------------------------------------------------------------- -QDataStream& operator>>(QDataStream& in, VPieceNode& p) +void VPieceNode::SetPassmark(bool passmark) { - in >> p.d->m_id; + if (GetTypeTool() == Tool::NodePoint) + { + d->m_isPassmark = passmark; + } +} - int type = 0; - in >> type; - p.d->m_typeTool = static_cast(type); +//--------------------------------------------------------------------------------------------------------------------- +PassmarkLineType VPieceNode::GetPassmarkLineType() const +{ + return d->m_passmarkLineType; +} - in >> p.d->m_reverse; - return in; +//--------------------------------------------------------------------------------------------------------------------- +void VPieceNode::SetPassmarkLineType(PassmarkLineType lineType) +{ + d->m_passmarkLineType = lineType; +} + +//--------------------------------------------------------------------------------------------------------------------- +PassmarkAngleType VPieceNode::GetPassmarkAngleType() const +{ + return d->m_passmarkAngleType; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VPieceNode::SetPassmarkAngleType(PassmarkAngleType angleType) +{ + d->m_passmarkAngleType = angleType; } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vpatterndb/vpiecenode.h b/src/libs/vpatterndb/vpiecenode.h index d16616493..66684686f 100644 --- a/src/libs/vpatterndb/vpiecenode.h +++ b/src/libs/vpatterndb/vpiecenode.h @@ -47,9 +47,6 @@ public: VPieceNode &operator=(const VPieceNode &node); ~VPieceNode(); - friend QDataStream& operator<<(QDataStream& out, const VPieceNode& p); - friend QDataStream& operator>>(QDataStream& in, VPieceNode& p); - quint32 GetId() const; void SetId(quint32 id); @@ -76,6 +73,15 @@ public: PieceNodeAngle GetAngleType() const; void SetAngleType(PieceNodeAngle type); + + bool IsPassmark() const; + void SetPassmark(bool passmark); + + PassmarkLineType GetPassmarkLineType() const; + void SetPassmarkLineType(PassmarkLineType lineType); + + PassmarkAngleType GetPassmarkAngleType() const; + void SetPassmarkAngleType(PassmarkAngleType angleType); private: QSharedDataPointer d; }; diff --git a/src/libs/vpatterndb/vpiecenode_p.h b/src/libs/vpatterndb/vpiecenode_p.h index 0c6fb68ed..bd53c1ef3 100644 --- a/src/libs/vpatterndb/vpiecenode_p.h +++ b/src/libs/vpatterndb/vpiecenode_p.h @@ -44,11 +44,14 @@ public: m_typeTool(Tool::NodePoint), m_reverse(false), m_excluded(false), + m_isPassmark(false), m_saBefore(-1), m_saAfter(-1), m_formulaWidthBefore(currentSeamAllowance), m_formulaWidthAfter(currentSeamAllowance), - m_angleType(PieceNodeAngle::ByLength) + m_angleType(PieceNodeAngle::ByLength), + m_passmarkLineType(PassmarkLineType::OneLine), + m_passmarkAngleType(PassmarkAngleType::Straightforward) {} VPieceNodeData(quint32 id, Tool typeTool, bool reverse) @@ -56,11 +59,14 @@ public: m_typeTool(typeTool), m_reverse(reverse), m_excluded(false), + m_isPassmark(false), m_saBefore(-1), m_saAfter(-1), m_formulaWidthBefore(currentSeamAllowance), m_formulaWidthAfter(currentSeamAllowance), - m_angleType(PieceNodeAngle::ByLength) + m_angleType(PieceNodeAngle::ByLength), + m_passmarkLineType(PassmarkLineType::OneLine), + m_passmarkAngleType(PassmarkAngleType::Straightforward) { if (m_typeTool == Tool::NodePoint) { @@ -74,11 +80,14 @@ public: m_typeTool(node.m_typeTool), m_reverse(node.m_reverse), m_excluded(node.m_excluded), + m_isPassmark(node.m_isPassmark), m_saBefore(node.m_saBefore), m_saAfter(node.m_saAfter), m_formulaWidthBefore(node.m_formulaWidthBefore), m_formulaWidthAfter(node.m_formulaWidthAfter), - m_angleType(node.m_angleType) + m_angleType(node.m_angleType), + m_passmarkLineType(node.m_passmarkLineType), + m_passmarkAngleType(node.m_passmarkAngleType) {} ~VPieceNodeData(); @@ -96,6 +105,9 @@ public: * affect on main path. Also include to exist path items automatically setted excluded. */ bool m_excluded; + /** @brief m_isPassmark has sense only for points. If true to seam allowance should be added a passmark. */ + bool m_isPassmark; + qreal m_saBefore; qreal m_saAfter; @@ -104,6 +116,9 @@ public: PieceNodeAngle m_angleType; + PassmarkLineType m_passmarkLineType; + PassmarkAngleType m_passmarkAngleType; + private: VPieceNodeData &operator=(const VPieceNodeData &) Q_DECL_EQ_DELETE; }; diff --git a/src/libs/vtools/dialogs/dialogs.pri b/src/libs/vtools/dialogs/dialogs.pri index 94dbeb526..39720163e 100644 --- a/src/libs/vtools/dialogs/dialogs.pri +++ b/src/libs/vtools/dialogs/dialogs.pri @@ -138,4 +138,5 @@ FORMS += \ $$PWD/tools/piece/tabs/tablabels.ui \ $$PWD/tools/piece/tabs/tabgrainline.ui \ $$PWD/tools/piece/tabs/tabpins.ui \ - $$PWD/tools/dialoginsertnode.ui + $$PWD/tools/dialoginsertnode.ui \ + $$PWD/tools/piece/tabs/tabpassmarks.ui diff --git a/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp b/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp index 3aade7598..6f218628b 100644 --- a/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp @@ -244,7 +244,7 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos) { rowNode.SetReverse(not rowNode.GetReverse()); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); - rowItem->setText(GetNodeName(rowNode)); + rowItem->setText(GetNodeName(rowNode, true)); ValidObjects(PathIsValid()); } diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index 6783fb793..2019e1254 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -566,7 +566,7 @@ QFont DialogTool::NodeFont(bool nodeExcluded) } //--------------------------------------------------------------------------------------------------------------------- -QString DialogTool::GetNodeName(const VPieceNode &node) const +QString DialogTool::GetNodeName(const VPieceNode &node, bool showPassmark) const { const QSharedPointer obj = data->GetGObject(node.GetId()); QString name = obj->name(); @@ -581,6 +581,23 @@ QString DialogTool::GetNodeName(const VPieceNode &node) const name = QLatin1String("- ") + name; } } + else if (showPassmark && node.IsPassmark()) + { + switch(node.GetPassmarkLineType()) + { + case PassmarkLineType::OneLine: + name += QLatin1String("^"); + break; + case PassmarkLineType::TwoLines: + name += QLatin1String("^^"); + break; + case PassmarkLineType::ThreeLines: + name += QLatin1String("^^^"); + break; + default: + break; + } + } return name; } @@ -598,7 +615,7 @@ void DialogTool::NewNodeItem(QListWidget *listWidget, const VPieceNode &node) case (Tool::NodeElArc): case (Tool::NodeSpline): case (Tool::NodeSplinePath): - name = GetNodeName(node); + name = GetNodeName(node, true); break; default: qDebug()<<"Got wrong tools. Ignore."; diff --git a/src/libs/vtools/dialogs/tools/dialogtool.h b/src/libs/vtools/dialogs/tools/dialogtool.h index 4dd5f124b..38abeda24 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.h +++ b/src/libs/vtools/dialogs/tools/dialogtool.h @@ -274,7 +274,7 @@ protected: static QString DialogWarningIcon(); static QFont NodeFont(bool nodeExcluded); - QString GetNodeName(const VPieceNode &node) const; + QString GetNodeName(const VPieceNode &node, bool showPassmark = false) const; void NewNodeItem(QListWidget *listWidget, const VPieceNode &node); void InitNodeAngles(QComboBox *box); diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp index 1a14450f3..2a5b80c5b 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp @@ -32,6 +32,7 @@ #include "ui_tablabels.h" #include "ui_tabgrainline.h" #include "ui_tabpins.h" +#include "ui_tabpassmarks.h" #include "../vwidgets/fancytabbar/fancytabbar.h" #include "../vpatterndb/vpiecenode.h" #include "../vpatterndb/vpiecepath.h" @@ -46,7 +47,7 @@ #include #include -enum TabOrder {Paths=0, Labels=1, Grainline=2, Pins=3, Count=4}; +enum TabOrder {Paths=0, Labels=1, Grainline=2, Pins=3, Passmarks=4, Count=5}; namespace { @@ -80,10 +81,12 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 & uiTabLabels(new Ui::TabLabels), uiTabGrainline(new Ui::TabGrainline), uiTabPins(new Ui::TabPins), + uiTabPassmarks(new Ui::TabPassmarks), m_tabPaths(new QWidget), m_tabLabels(new QWidget), m_tabGrainline(new QWidget), m_tabPins(new QWidget), + m_tabPassmarks(new QWidget), m_ftb(new FancyTabBar(FancyTabBar::Left, this)), dialogIsInitialized(false), applyAllowed(false),// By default disabled @@ -135,6 +138,7 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 & InitLabelsTab(); InitGrainlineTab(); InitPinsTab(); + InitPassmarksTab(); flagName = true;//We have default name of piece. ChangeColor(uiTabLabels->labelEditName, okColor); @@ -153,10 +157,12 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 & DialogSeamAllowance::~DialogSeamAllowance() { delete m_visPins; + delete m_tabPassmarks; delete m_tabPins; delete m_tabGrainline; delete m_tabLabels; delete m_tabPaths; + delete uiTabPassmarks; delete uiTabPins; delete uiTabGrainline; delete uiTabLabels; @@ -176,6 +182,7 @@ void DialogSeamAllowance::EnableApply(bool enable) m_ftb->SetTabEnabled(TabOrder::Labels, applyAllowed); m_ftb->SetTabEnabled(TabOrder::Grainline, applyAllowed); m_ftb->SetTabEnabled(TabOrder::Pins, applyAllowed); + m_ftb->SetTabEnabled(TabOrder::Passmarks, applyAllowed); } //--------------------------------------------------------------------------------------------------------------------- @@ -579,6 +586,7 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos) SCASSERT(rowItem != nullptr); VPieceNode rowNode = qvariant_cast(rowItem->data(Qt::UserRole)); + QAction *actionPassmark = nullptr; QAction *actionReverse = nullptr; if (rowNode.GetTypeTool() != Tool::NodePoint) { @@ -586,6 +594,12 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos) actionReverse->setCheckable(true); actionReverse->setChecked(rowNode.GetReverse()); } + else + { + actionPassmark = menu->addAction(tr("Passmark")); + actionPassmark->setCheckable(true); + actionPassmark->setChecked(rowNode.IsPassmark()); + } QAction *actionExcluded = menu->addAction(tr("Excluded")); actionExcluded->setCheckable(true); @@ -597,24 +611,28 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos) if (selectedAction == actionDelete) { delete uiTabPaths->listWidgetMainPath->item(row); - ValidObjects(MainPathIsValid()); } else if (rowNode.GetTypeTool() != Tool::NodePoint && selectedAction == actionReverse) { rowNode.SetReverse(not rowNode.GetReverse()); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); - rowItem->setText(GetNodeName(rowNode)); - ValidObjects(MainPathIsValid()); + rowItem->setText(GetNodeName(rowNode, true)); } else if (selectedAction == actionExcluded) { rowNode.SetExcluded(not rowNode.IsExcluded()); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); - rowItem->setText(GetNodeName(rowNode)); + rowItem->setText(GetNodeName(rowNode, true)); rowItem->setFont(NodeFont(rowNode.IsExcluded())); - ValidObjects(MainPathIsValid()); + } + else if (selectedAction == actionPassmark) + { + rowNode.SetPassmark(not rowNode.IsPassmark()); + rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); + rowItem->setText(GetNodeName(rowNode, true)); } + ValidObjects(MainPathIsValid()); ListChanged(); } @@ -736,6 +754,7 @@ void DialogSeamAllowance::ListChanged() visPath->RefreshGeometry(); } InitNodesList(); + InitPassmarksList(); CustomSAChanged(uiTabPaths->listWidgetCustomSA->currentRow()); } @@ -820,6 +839,68 @@ void DialogSeamAllowance::NodeChanged(int index) uiTabPaths->comboBoxAngle->blockSignals(false); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::PassmarkChanged(int index) +{ + uiTabPassmarks->radioButtonOneLine->setDisabled(true); + uiTabPassmarks->radioButtonTwoLines->setDisabled(true); + uiTabPassmarks->radioButtonThreeLines->setDisabled(true); + + uiTabPassmarks->radioButtonStraightforward->setDisabled(true); + uiTabPassmarks->radioButtonBisector->setDisabled(true); + + uiTabPassmarks->groupBoxLineType->blockSignals(true); + uiTabPassmarks->groupBoxAngleType->blockSignals(true); + + if (index != -1) + { + const VPiece piece = CreatePiece(); + const int nodeIndex = piece.GetPath().indexOfNode(CURRENT_DATA(uiTabPassmarks->comboBoxPassmarks).toUInt()); + if (nodeIndex != -1) + { + const VPieceNode &node = piece.GetPath().at(nodeIndex); + + // Line type + uiTabPassmarks->radioButtonOneLine->setEnabled(true); + uiTabPassmarks->radioButtonTwoLines->setEnabled(true); + uiTabPassmarks->radioButtonThreeLines->setEnabled(true); + + switch(node.GetPassmarkLineType()) + { + case PassmarkLineType::OneLine: + uiTabPassmarks->radioButtonOneLine->setChecked(true); + break; + case PassmarkLineType::TwoLines: + uiTabPassmarks->radioButtonTwoLines->setChecked(true); + break; + case PassmarkLineType::ThreeLines: + uiTabPassmarks->radioButtonThreeLines->setChecked(true); + break; + default: + break; + } + + // Angle type + uiTabPassmarks->radioButtonStraightforward->setEnabled(true); + uiTabPassmarks->radioButtonBisector->setEnabled(true); + + switch(node.GetPassmarkAngleType()) + { + case PassmarkAngleType::Straightforward: + uiTabPassmarks->radioButtonStraightforward->setChecked(true); + break; + case PassmarkAngleType::Bisector: + uiTabPassmarks->radioButtonBisector->setChecked(true); + break; + default: + break; + } + } + } + uiTabPassmarks->groupBoxLineType->blockSignals(false); + uiTabPassmarks->groupBoxAngleType->blockSignals(false); +} + //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::CSAStartPointChanged(int index) { @@ -1010,6 +1091,7 @@ void DialogSeamAllowance::FancyTabChanged(int index) m_tabLabels->hide(); m_tabGrainline->hide(); m_tabPins->hide(); + m_tabPassmarks->hide(); QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wswitch-default") @@ -1027,6 +1109,9 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") case TabOrder::Pins: m_tabPins->show(); break; + case TabOrder::Passmarks: + m_tabPassmarks->show(); + break; } QT_WARNING_POP @@ -1061,6 +1146,70 @@ void DialogSeamAllowance::TabChanged(int index) } } +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::PassmarkLineTypeChanged(int id) +{ + const int i = uiTabPassmarks->comboBoxPassmarks->currentIndex(); + if (i != -1) + { + QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(uiTabPassmarks->comboBoxPassmarks).toUInt()); + if (rowItem) + { + VPieceNode rowNode = qvariant_cast(rowItem->data(Qt::UserRole)); + + PassmarkLineType lineType = PassmarkLineType::OneLine; + if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonOneLine)) + { + lineType = PassmarkLineType::OneLine; + } + else if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonTwoLines)) + { + lineType = PassmarkLineType::TwoLines; + } + else if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonThreeLines)) + { + lineType = PassmarkLineType::ThreeLines; + } + + rowNode.SetPassmarkLineType(lineType); + rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); + rowItem->setText(GetNodeName(rowNode, true)); + + ListChanged(); + } + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::PassmarkAngleTypeChanged(int id) +{ + const int i = uiTabPassmarks->comboBoxPassmarks->currentIndex(); + if (i != -1) + { + QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(uiTabPassmarks->comboBoxPassmarks).toUInt()); + if (rowItem) + { + VPieceNode rowNode = qvariant_cast(rowItem->data(Qt::UserRole)); + + PassmarkAngleType angleType = PassmarkAngleType::Straightforward; + if (id == uiTabPassmarks->buttonGroupAngleType->id(uiTabPassmarks->radioButtonStraightforward)) + { + angleType = PassmarkAngleType::Straightforward; + } + else if (id == uiTabPassmarks->buttonGroupAngleType->id(uiTabPassmarks->radioButtonBisector)) + { + angleType = PassmarkAngleType::Bisector; + } + + rowNode.SetPassmarkAngleType(angleType); + rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); + rowItem->setText(GetNodeName(rowNode, true)); + + ListChanged(); + } + } +} + //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::UpdateGrainlineValues() { @@ -2109,6 +2258,40 @@ void DialogSeamAllowance::InitNodesList() } } +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::InitPassmarksList() +{ + const quint32 id = CURRENT_DATA(uiTabPassmarks->comboBoxPassmarks).toUInt(); + + uiTabPassmarks->comboBoxPassmarks->blockSignals(true); + uiTabPassmarks->comboBoxPassmarks->clear(); + + const QVector nodes = GetPieceInternals(uiTabPaths->listWidgetMainPath); + + for (int i = 0; i < nodes.size(); ++i) + { + const VPieceNode node = nodes.at(i); + if (node.GetTypeTool() == Tool::NodePoint && node.IsPassmark()) + { + const QString name = GetNodeName(node); + + uiTabPassmarks->comboBoxPassmarks->addItem(name, node.GetId()); + } + } + uiTabPassmarks->comboBoxPassmarks->blockSignals(false); + + const int index = uiTabPassmarks->comboBoxPassmarks->findData(id); + if (index != -1) + { + uiTabPassmarks->comboBoxPassmarks->setCurrentIndex(index); + PassmarkChanged(index);// Need in case combox index was not changed + } + else + { + uiTabPassmarks->comboBoxPassmarks->count() > 0 ? PassmarkChanged(0) : PassmarkChanged(-1); + } +} + //--------------------------------------------------------------------------------------------------------------------- QListWidgetItem *DialogSeamAllowance::GetItemById(quint32 id) { @@ -2194,6 +2377,7 @@ void DialogSeamAllowance::InitFancyTabBar() m_ftb->InsertTab(TabOrder::Labels, QIcon("://icon/32x32/labels.png"), tr("Labels")); m_ftb->InsertTab(TabOrder::Grainline, QIcon("://icon/32x32/grainline.png"), tr("Grainline")); m_ftb->InsertTab(TabOrder::Pins, QIcon("://icon/32x32/pins.png"), tr("Pins")); + m_ftb->InsertTab(TabOrder::Passmarks, QIcon("://icon/32x32/passmark.png"), tr("Passmarks")); ui->horizontalLayout->addWidget(m_ftb, 0, Qt::AlignLeft); @@ -2215,6 +2399,10 @@ void DialogSeamAllowance::InitFancyTabBar() uiTabPins->setupUi(m_tabPins); ui->horizontalLayout->addWidget(m_tabPins, 1); + m_tabPassmarks->hide(); + uiTabPassmarks->setupUi(m_tabPassmarks); + ui->horizontalLayout->addWidget(m_tabPassmarks, 1); + connect(m_ftb, &FancyTabBar::CurrentChanged, this, &DialogSeamAllowance::FancyTabChanged); connect(uiTabLabels->tabWidget, &QTabWidget::currentChanged, this, &DialogSeamAllowance::TabChanged); } @@ -2521,6 +2709,19 @@ void DialogSeamAllowance::InitPinsTab() &DialogSeamAllowance::ShowPinsContextMenu); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::InitPassmarksTab() +{ + InitPassmarksList(); + connect(uiTabPassmarks->comboBoxPassmarks, static_cast(&QComboBox::currentIndexChanged), + this, &DialogSeamAllowance::PassmarkChanged); + + connect(uiTabPassmarks->buttonGroupLineType, static_cast(&QButtonGroup::buttonClicked), + this, &DialogSeamAllowance::PassmarkLineTypeChanged); + connect(uiTabPassmarks->buttonGroupAngleType, static_cast(&QButtonGroup::buttonClicked), + this, &DialogSeamAllowance::PassmarkAngleTypeChanged); +} + //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::InitAllPinComboboxes() { diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.h b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.h index f0967b597..98a8ee41e 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.h +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.h @@ -42,6 +42,7 @@ namespace Ui class TabLabels; class TabGrainline; class TabPins; + class TabPassmarks; } class VisPiecePins; @@ -90,6 +91,7 @@ private slots: void ListChanged(); void EnableSeamAllowance(bool enable); void NodeChanged(int index); + void PassmarkChanged(int index); void CSAStartPointChanged(int index); void CSAEndPointChanged(int index); void CSAIncludeTypeChanged(int index); @@ -100,6 +102,8 @@ private slots: void PathDialogClosed(int result); void FancyTabChanged(int index); void TabChanged(int index); + void PassmarkLineTypeChanged(int id); + void PassmarkAngleTypeChanged(int id); void UpdateGrainlineValues(); void UpdateDetailLabelValues(); @@ -158,11 +162,13 @@ private: Ui::TabLabels *uiTabLabels; Ui::TabGrainline *uiTabGrainline; Ui::TabPins *uiTabPins; + Ui::TabPassmarks *uiTabPassmarks; QWidget *m_tabPaths; QWidget *m_tabLabels; QWidget *m_tabGrainline; QWidget *m_tabPins; + QWidget *m_tabPassmarks; FancyTabBar* m_ftb; @@ -236,6 +242,7 @@ private: void InitMainPathTab(); void InitSeamAllowanceTab(); void InitNodesList(); + void InitPassmarksList(); void InitCSAPoint(QComboBox *box); void InitPinPoint(QComboBox *box); void InitSAIncludeType(); @@ -244,6 +251,7 @@ private: void InitLabelsTab(); void InitGrainlineTab(); void InitPinsTab(); + void InitPassmarksTab(); void InitAllPinComboboxes(); void SetFormulaSAWidth(const QString &formula); diff --git a/src/libs/vtools/dialogs/tools/piece/tabs/tabpassmarks.ui b/src/libs/vtools/dialogs/tools/piece/tabs/tabpassmarks.ui new file mode 100644 index 000000000..ee1f01f9b --- /dev/null +++ b/src/libs/vtools/dialogs/tools/piece/tabs/tabpassmarks.ui @@ -0,0 +1,141 @@ + + + TabPassmarks + + + + 0 + 0 + 208 + 285 + + + + Form + + + + + + QFormLayout::ExpandingFieldsGrow + + + + + Passmark: + + + + + + + + + + + + true + + + Lines + + + + + + false + + + One line + + + buttonGroupLineType + + + + + + + false + + + Two lines + + + buttonGroupLineType + + + + + + + false + + + Three lines + + + buttonGroupLineType + + + + + + + + + + Angle + + + + + + false + + + Straightforward + + + buttonGroupAngleType + + + + + + + false + + + Bisector + + + buttonGroupAngleType + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + +