From efb4b58b8da3a9bc353c58cf88fca0e84fc31a72 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 19 Nov 2017 17:08:50 +0200 Subject: [PATCH] Fix bug with Increments. After creating they know more than should. --HG-- branch : develop --- src/app/valentina/xml/vpattern.cpp | 1 + src/libs/vpatterndb/variables/vincrement_p.h | 12 +++++++++++- src/libs/vpatterndb/vcontainer.cpp | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 43c79c857..ffff375a5 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -4151,6 +4151,7 @@ void VPattern::PrepareForParse(const Document &parse) else if (parse == Document::LiteParse) { VContainer::ClearUniqueNames(); + Q_STATIC_ASSERT_X(static_cast(VarType::Unknown) == 8, "Check that you used all types"); data->ClearVariables(VarType::Increment); data->ClearVariables(VarType::LineAngle); data->ClearVariables(VarType::LineLength); diff --git a/src/libs/vpatterndb/variables/vincrement_p.h b/src/libs/vpatterndb/variables/vincrement_p.h index 77d78a71e..441a76460 100644 --- a/src/libs/vpatterndb/variables/vincrement_p.h +++ b/src/libs/vpatterndb/variables/vincrement_p.h @@ -57,7 +57,17 @@ public: formulaOk(ok), previewCalculation(false), data(*data) - {} + { + // When we create an increment in the dialog it will get neccesary data. Such data must be removed because will + // confuse a user. Increment should not know nothing about internal variables. + Q_STATIC_ASSERT_X(static_cast(VarType::Unknown) == 8, "Check that you used all types"); + this->data.ClearVariables(VarType::LineAngle); + this->data.ClearVariables(VarType::LineLength); + this->data.ClearVariables(VarType::CurveLength); + this->data.ClearVariables(VarType::CurveCLength); + this->data.ClearVariables(VarType::ArcRadius); + this->data.ClearVariables(VarType::CurveAngle); + } VIncrementData(const VIncrementData &incr) : QSharedData(incr), diff --git a/src/libs/vpatterndb/vcontainer.cpp b/src/libs/vpatterndb/vcontainer.cpp index 1e2820220..749e64e3e 100644 --- a/src/libs/vpatterndb/vcontainer.cpp +++ b/src/libs/vpatterndb/vcontainer.cpp @@ -280,6 +280,7 @@ void VContainer::ClearForFullParse() d->pieces->clear(); d->piecePaths->clear(); + Q_STATIC_ASSERT_X(static_cast(VarType::Unknown) == 8, "Check that you used all types"); ClearVariables(VarType::Increment); ClearVariables(VarType::LineAngle); ClearVariables(VarType::LineLength);