diff --git a/src/libs/vtools/dialogs/dialogtoolbox.cpp b/src/libs/vtools/dialogs/dialogtoolbox.cpp index 8e74f2bb5..b3dbe282d 100644 --- a/src/libs/vtools/dialogs/dialogtoolbox.cpp +++ b/src/libs/vtools/dialogs/dialogtoolbox.cpp @@ -428,7 +428,7 @@ bool DoublePoints(QListWidget *listWidget, const VContainer *data) } //--------------------------------------------------------------------------------------------------------------------- -bool DoubleCurves(QListWidget *listWidget) +auto DoubleCurves(QListWidget *listWidget) -> bool { SCASSERT(listWidget != nullptr); for (int i=0, sz = listWidget->count()-1; i obj = data->GetGObject(node.GetId()); + QString name = obj->ObjectName(); + + if (node.GetTypeTool() != Tool::NodePoint) + { + if (node.GetReverse()) + { + name = QStringLiteral("- ") + name; + } + } + else + { + if (showPassmarkDetails && node.IsPassmark()) + { + switch(node.GetPassmarkLineType()) + { + case PassmarkLineType::OneLine: + name += QLatin1Char('|'); + break; + case PassmarkLineType::TwoLines: + name += QLatin1String("||"); + break; + case PassmarkLineType::ThreeLines: + name += QLatin1String("|||"); + break; + case PassmarkLineType::TMark: + name += QStringLiteral("┴"); + break; + case PassmarkLineType::VMark: + name += QStringLiteral("⊼"); + break; + case PassmarkLineType::VMark2: + name += QStringLiteral("⊽"); + break; + case PassmarkLineType::UMark: + name += QStringLiteral("⋃"); + break; + case PassmarkLineType::BoxMark: + name += QStringLiteral("⎕"); + break; + default: + break; + } + } + + if (not node.IsCheckUniqueness()) + { + name = QLatin1Char('[') + name + QLatin1Char(']'); + } + } + + return name; +} diff --git a/src/libs/vtools/dialogs/dialogtoolbox.h b/src/libs/vtools/dialogs/dialogtoolbox.h index bba25526b..3a8dfcdde 100644 --- a/src/libs/vtools/dialogs/dialogtoolbox.h +++ b/src/libs/vtools/dialogs/dialogtoolbox.h @@ -90,5 +90,6 @@ void CurrentCurveLength(vidtype curveId, VContainer *data); void SetTabStopDistance(QPlainTextEdit *edit, int tabWidthChar=4); QIcon LineColor(int size, const QString &color); auto SegmentAliases(GOType curveType, const QString &alias1, const QString &alias2) -> QPair; +QString GetNodeName(const VContainer *data, const VPieceNode &node, bool showPassmarkDetails = false); #endif // DIALOGTOOLBOX_H diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index 14dec01d0..0ba53a89b 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -391,63 +391,6 @@ quint32 DialogTool::DNumber(const QString &baseName) const return num; } -//--------------------------------------------------------------------------------------------------------------------- -QString DialogTool::GetNodeName(const VPieceNode &node, bool showPassmarkDetails) const -{ - const QSharedPointer obj = data->GetGObject(node.GetId()); - QString name = obj->ObjectName(); - - if (node.GetTypeTool() != Tool::NodePoint) - { - if (node.GetReverse()) - { - name = QStringLiteral("- ") + name; - } - } - else - { - if (showPassmarkDetails && node.IsPassmark()) - { - switch(node.GetPassmarkLineType()) - { - case PassmarkLineType::OneLine: - name += QLatin1Char('|'); - break; - case PassmarkLineType::TwoLines: - name += QLatin1String("||"); - break; - case PassmarkLineType::ThreeLines: - name += QLatin1String("|||"); - break; - case PassmarkLineType::TMark: - name += QStringLiteral("┴"); - break; - case PassmarkLineType::VMark: - name += QStringLiteral("⊼"); - break; - case PassmarkLineType::VMark2: - name += QStringLiteral("⊽"); - break; - case PassmarkLineType::UMark: - name += QStringLiteral("⋃"); - break; - case PassmarkLineType::BoxMark: - name += QStringLiteral("⎕"); - break; - default: - break; - } - } - - if (not node.IsCheckUniqueness()) - { - name = QLatin1Char('[') + name + QLatin1Char(']'); - } - } - - return name; -} - //--------------------------------------------------------------------------------------------------------------------- void DialogTool::NewNodeItem(QListWidget *listWidget, const VPieceNode &node, bool showPassmark, bool showExclusion) { @@ -461,7 +404,7 @@ void DialogTool::NewNodeItem(QListWidget *listWidget, const VPieceNode &node, bo case (Tool::NodeElArc): case (Tool::NodeSpline): case (Tool::NodeSplinePath): - name = GetNodeName(node, showPassmark); + name = GetNodeName(data, node, showPassmark); 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 8412d78ee..a31ae9f60 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.h +++ b/src/libs/vtools/dialogs/tools/dialogtool.h @@ -218,7 +218,6 @@ protected: */ virtual void SaveData() {} quint32 DNumber(const QString &baseName) const; - QString GetNodeName(const VPieceNode &node, bool showPassmarkDetails = false) const; void NewNodeItem(QListWidget *listWidget, const VPieceNode &node, bool showPassmark = true, bool showExclusion = true); diff --git a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp index fb6124b9e..95f3d0031 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp @@ -368,7 +368,7 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos) { rowNode.SetReverse(not rowNode.GetReverse()); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); - rowItem->setText(GetNodeName(rowNode, IsShowNotch())); + rowItem->setText(GetNodeName(data, rowNode, IsShowNotch())); } else if (m_showMode && rowNode.GetTypeTool() == Tool::NodePoint && selectedAction == actionPassmark && GetType() == PiecePathType::CustomSeamAllowance @@ -376,20 +376,20 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos) { rowNode.SetPassmark(not rowNode.IsPassmark()); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); - rowItem->setText(GetNodeName(rowNode, IsShowNotch())); + rowItem->setText(GetNodeName(data, rowNode, IsShowNotch())); } else if (selectedAction == actionExcluded) { rowNode.SetExcluded(not rowNode.IsExcluded()); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); - rowItem->setText(GetNodeName(rowNode, true)); + rowItem->setText(GetNodeName(data, rowNode, true)); rowItem->setFont(NodeFont(rowItem->font(), rowNode.IsExcluded())); } else if (rowNode.GetTypeTool() == Tool::NodePoint && selectedAction == actionUniqueness) { rowNode.SetCheckUniqueness(not rowNode.IsCheckUniqueness()); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); - rowItem->setText(GetNodeName(rowNode, IsShowNotch())); + rowItem->setText(GetNodeName(data, rowNode, IsShowNotch())); } ValidObjects(PathIsValid()); @@ -714,7 +714,7 @@ void DialogPiecePath::PassmarkLineTypeChanged(int id) rowNode.SetPassmarkLineType(lineType); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); - rowItem->setText(GetNodeName(rowNode, IsShowNotch())); + rowItem->setText(GetNodeName(data, rowNode, IsShowNotch())); ListChanged(); } @@ -768,7 +768,7 @@ void DialogPiecePath::PassmarkAngleTypeChanged(int id) rowNode.SetPassmarkAngleType(angleType); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); - rowItem->setText(GetNodeName(rowNode, IsShowNotch())); + rowItem->setText(GetNodeName(data, rowNode, IsShowNotch())); ListChanged(); } @@ -1226,7 +1226,7 @@ void DialogPiecePath::InitNodesList() const VPieceNode node = path.at(i); if (node.GetTypeTool() == Tool::NodePoint) { - const QString name = GetNodeName(node); + const QString name = GetNodeName(data, node); ui->comboBoxNodes->addItem(name, node.GetId()); } @@ -1259,7 +1259,7 @@ void DialogPiecePath::InitPassmarksList() { if (node.GetTypeTool() == Tool::NodePoint && node.IsPassmark()) { - const QString name = GetNodeName(node); + const QString name = GetNodeName(data, node); ui->comboBoxPassmarks->addItem(name, node.GetId()); } diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp index c7dce7e0d..f1299eacc 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp @@ -782,26 +782,26 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos) { rowNode.SetReverse(not rowNode.GetReverse()); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); - rowItem->setText(GetNodeName(rowNode, true)); + rowItem->setText(GetNodeName(data, rowNode, true)); } else if (selectedAction == actionExcluded) { rowNode.SetExcluded(not rowNode.IsExcluded()); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); - rowItem->setText(GetNodeName(rowNode, true)); + rowItem->setText(GetNodeName(data, rowNode, true)); rowItem->setFont(NodeFont(rowItem->font(), rowNode.IsExcluded())); } else if (applyAllowed && selectedAction == actionPassmark) { rowNode.SetPassmark(not rowNode.IsPassmark()); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); - rowItem->setText(GetNodeName(rowNode, true)); + rowItem->setText(GetNodeName(data, rowNode, true)); } else if (selectedAction == actionUniqueness) { rowNode.SetCheckUniqueness(not rowNode.IsCheckUniqueness()); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); - rowItem->setText(GetNodeName(rowNode, true)); + rowItem->setText(GetNodeName(data, rowNode, true)); } ValidObjects(MainPathIsValid()); @@ -1618,7 +1618,7 @@ void DialogSeamAllowance::PassmarkLineTypeChanged(int id) rowNode.SetPassmarkLineType(lineType); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); - rowItem->setText(GetNodeName(rowNode, true)); + rowItem->setText(GetNodeName(data, rowNode, true)); ListChanged(); } @@ -2771,7 +2771,7 @@ void DialogSeamAllowance::InitNodesList() { if (node.GetTypeTool() == Tool::NodePoint && not node.IsExcluded()) { - const QString name = GetNodeName(node); + const QString name = GetNodeName(data, node); uiTabPaths->comboBoxNodes->addItem(name, node.GetId()); } @@ -2804,7 +2804,7 @@ void DialogSeamAllowance::InitPassmarksList() { if (node.GetTypeTool() == Tool::NodePoint && node.IsPassmark()) { - const QString name = GetNodeName(node); + const QString name = GetNodeName(data, node); uiTabPassmarks->comboBoxPassmarks->addItem(name, node.GetId()); } @@ -3132,11 +3132,11 @@ void DialogSeamAllowance::InitCSAPoint(QComboBox *box) const QVector nodes = GetListInternals(uiTabPaths->listWidgetMainPath); - for (auto &node : nodes) + for (const auto &node : nodes) { if (node.GetTypeTool() == Tool::NodePoint && not node.IsExcluded()) { - const QString name = GetNodeName(node); + const QString name = GetNodeName(data, node); box->addItem(name, node.GetId()); } }