Fix bug with Increments. After creating they know more than should.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-11-19 17:08:50 +02:00
parent 8dbcfb4874
commit efb4b58b8d
3 changed files with 13 additions and 1 deletions

View file

@ -4151,6 +4151,7 @@ void VPattern::PrepareForParse(const Document &parse)
else if (parse == Document::LiteParse)
{
VContainer::ClearUniqueNames();
Q_STATIC_ASSERT_X(static_cast<int>(VarType::Unknown) == 8, "Check that you used all types");
data->ClearVariables(VarType::Increment);
data->ClearVariables(VarType::LineAngle);
data->ClearVariables(VarType::LineLength);

View file

@ -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<int>(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),

View file

@ -280,6 +280,7 @@ void VContainer::ClearForFullParse()
d->pieces->clear();
d->piecePaths->clear();
Q_STATIC_ASSERT_X(static_cast<int>(VarType::Unknown) == 8, "Check that you used all types");
ClearVariables(VarType::Increment);
ClearVariables(VarType::LineAngle);
ClearVariables(VarType::LineLength);