diff --git a/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp b/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp index 4ba8ed87f..3aade7598 100644 --- a/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp @@ -889,6 +889,12 @@ bool DialogPiecePath::PathIsValid() const ui->helpLabel->setText(url); return false; } + else if (not EachPointLabelIsUnique(ui->listWidget)) + { + url += tr("Each point in the path must be unique!"); + ui->helpLabel->setText(url); + return false; + } } if (not m_showMode && ui->comboBoxPiece->count() <= 0) diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index 25d4b5348..6783fb793 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -522,6 +522,27 @@ bool DialogTool::DoublePoints(QListWidget *listWidget) return false; } +//--------------------------------------------------------------------------------------------------------------------- +bool DialogTool::EachPointLabelIsUnique(QListWidget *listWidget) +{ + SCASSERT(listWidget != nullptr); + QSet pointLabels; + int countPoints = 0; + for (int i=0; i < listWidget->count(); ++i) + { + const QListWidgetItem *rowItem = listWidget->item(i); + SCASSERT(rowItem != nullptr); + const VPieceNode rowNode = qvariant_cast(rowItem->data(Qt::UserRole)); + if (rowNode.GetTypeTool() == Tool::NodePoint) + { + ++countPoints; + pointLabels.insert(rowNode.GetId()); + } + } + + return countPoints == pointLabels.size(); +} + //--------------------------------------------------------------------------------------------------------------------- QString DialogTool::DialogWarningIcon() { diff --git a/src/libs/vtools/dialogs/tools/dialogtool.h b/src/libs/vtools/dialogs/tools/dialogtool.h index a60ca0fff..4dd5f124b 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.h +++ b/src/libs/vtools/dialogs/tools/dialogtool.h @@ -270,6 +270,7 @@ protected: static int FindNotExcludedNodeUp(QListWidget *listWidget, int candidate); static bool FirstPointEqualLast(QListWidget *listWidget); static bool DoublePoints(QListWidget *listWidget); + static bool EachPointLabelIsUnique(QListWidget *listWidget); static QString DialogWarningIcon(); static QFont NodeFont(bool nodeExcluded); diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp index b1060eb01..1a14450f3 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp @@ -2029,6 +2029,12 @@ bool DialogSeamAllowance::MainPathIsValid() const uiTabPaths->helpLabel->setText(url); valid = false; } + else if (not EachPointLabelIsUnique(uiTabPaths->listWidgetMainPath)) + { + url += tr("Each point in the path must be unique!"); + uiTabPaths->helpLabel->setText(url); + valid = false; + } } if (valid)