Fix checking double curve.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-04-20 19:04:03 +03:00
parent 527d45daba
commit 1fe7223096
4 changed files with 7 additions and 7 deletions

View File

@ -129,13 +129,13 @@ bool DoublePoint(const VPieceNode &firstNode, const VPieceNode &secondNode, cons
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool DoubleCurve(const VPieceNode &firstNode, const VPieceNode &secondNode, const VContainer *data) bool DoubleCurve(const VPieceNode &firstNode, const VPieceNode &secondNode)
{ {
if (firstNode.GetTypeTool() != Tool::NodePoint && not (firstNode.GetId() == NULL_ID) if (firstNode.GetTypeTool() != Tool::NodePoint && not (firstNode.GetId() == NULL_ID)
&& secondNode.GetTypeTool() != Tool::NodePoint && not (secondNode.GetId() == NULL_ID)) && secondNode.GetTypeTool() != Tool::NodePoint && not (secondNode.GetId() == NULL_ID))
{ {
// don't ignore the same curve twice // don't ignore the same curve twice
if (data->GetGObject(firstNode.GetId())->getIdObject() == data->GetGObject(secondNode.GetId())->getIdObject()) if (firstNode.GetId() == secondNode.GetId())
{ {
return true; return true;
} }
@ -556,7 +556,7 @@ bool DialogTool::DoublePoints(QListWidget *listWidget, const VContainer *data)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool DialogTool::DoubleCurves(QListWidget *listWidget, const VContainer *data) bool DialogTool::DoubleCurves(QListWidget *listWidget)
{ {
SCASSERT(listWidget != nullptr); SCASSERT(listWidget != nullptr);
for (int i=0, sz = listWidget->count()-1; i<sz; ++i) for (int i=0, sz = listWidget->count()-1; i<sz; ++i)
@ -565,7 +565,7 @@ bool DialogTool::DoubleCurves(QListWidget *listWidget, const VContainer *data)
const VPieceNode firstNode = RowNode(listWidget, firstIndex); const VPieceNode firstNode = RowNode(listWidget, firstIndex);
const VPieceNode secondNode = RowNode(listWidget, FindNotExcludedNodeDown(listWidget, firstIndex+1)); const VPieceNode secondNode = RowNode(listWidget, FindNotExcludedNodeDown(listWidget, firstIndex+1));
if (DoubleCurve(firstNode, secondNode, data)) if (DoubleCurve(firstNode, secondNode))
{ {
return true; return true;
} }

View File

@ -214,7 +214,7 @@ protected:
static int FindNotExcludedNodeUp(QListWidget *listWidget, int candidate); static int FindNotExcludedNodeUp(QListWidget *listWidget, int candidate);
static bool FirstPointEqualLast(QListWidget *listWidget, const VContainer *data); static bool FirstPointEqualLast(QListWidget *listWidget, const VContainer *data);
static bool DoublePoints(QListWidget *listWidget, const VContainer *data); static bool DoublePoints(QListWidget *listWidget, const VContainer *data);
static bool DoubleCurves(QListWidget *listWidget, const VContainer *data); static bool DoubleCurves(QListWidget *listWidget);
static bool EachPointLabelIsUnique(QListWidget *listWidget); static bool EachPointLabelIsUnique(QListWidget *listWidget);
static QString DialogWarningIcon(); static QString DialogWarningIcon();
static QFont NodeFont(QFont font, bool nodeExcluded = false); static QFont NodeFont(QFont font, bool nodeExcluded = false);

View File

@ -1598,7 +1598,7 @@ bool DialogPiecePath::PathIsValid() const
ui->helpLabel->setText(url); ui->helpLabel->setText(url);
return false; return false;
} }
else if (DoubleCurves(ui->listWidget, data)) else if (DoubleCurves(ui->listWidget))
{ {
url += tr("The same curve repeats twice!"); url += tr("The same curve repeats twice!");
ui->helpLabel->setText(url); ui->helpLabel->setText(url);

View File

@ -2563,7 +2563,7 @@ bool DialogSeamAllowance::MainPathIsValid() const
uiTabPaths->helpLabel->setText(url); uiTabPaths->helpLabel->setText(url);
valid = false; valid = false;
} }
else if (DoubleCurves(uiTabPaths->listWidgetMainPath, data)) else if (DoubleCurves(uiTabPaths->listWidgetMainPath))
{ {
url += tr("The same curve repeats twice!"); url += tr("The same curve repeats twice!");
uiTabPaths->helpLabel->setText(url); uiTabPaths->helpLabel->setText(url);