From 3999ebd82ed120577d11510323cb5c89a3a5b1e2 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 4 Aug 2017 20:29:43 +0300 Subject: [PATCH] Fixed bug in Tape. Each Window should has own size and height values. --HG-- branch : develop --- src/app/tape/tmainwindow.cpp | 40 +++--- src/app/tape/tmainwindow.h | 2 + .../valentina/dialogs/dialogincrements.cpp | 2 +- src/app/valentina/mainwindow.cpp | 10 +- src/app/valentina/xml/vpattern.cpp | 2 +- src/libs/vformat/vmeasurements.cpp | 42 ++++-- src/libs/vformat/vmeasurements.h | 9 +- src/libs/vlayout/vlayoutpiece.cpp | 10 +- src/libs/vpatterndb/calculator.cpp | 11 +- src/libs/vpatterndb/calculator.h | 7 +- src/libs/vpatterndb/variables/vincrement.cpp | 3 +- .../variables/vinternalvariable.cpp | 1 + .../vpatterndb/variables/vinternalvariable.h | 7 +- .../vpatterndb/variables/vmeasurement.cpp | 127 ++++++++++++++++-- src/libs/vpatterndb/variables/vmeasurement.h | 20 +++ .../vpatterndb/variables/vmeasurement_p.h | 69 +++++++++- src/libs/vpatterndb/variables/vvariable.cpp | 99 +------------- src/libs/vpatterndb/variables/vvariable.h | 16 +-- src/libs/vpatterndb/variables/vvariable_p.h | 28 +--- src/libs/vpatterndb/vcontainer.cpp | 33 ----- src/libs/vpatterndb/vcontainer.h | 3 - src/libs/vpatterndb/vformula.cpp | 2 +- src/libs/vpatterndb/vpiecenode.cpp | 2 +- .../support/dialogeditwrongformula.cpp | 4 +- .../vtools/dialogs/tools/dialogspline.cpp | 2 +- .../vtools/dialogs/tools/dialogsplinepath.cpp | 8 +- src/libs/vtools/dialogs/tools/dialogtool.cpp | 2 +- .../tools/piece/dialogseamallowance.cpp | 6 +- src/libs/vtools/tools/vabstracttool.cpp | 4 +- src/libs/vtools/tools/vtoolseamallowance.cpp | 10 +- .../line/operation/vistoolmove.cpp | 4 +- .../line/operation/vistoolrotation.cpp | 2 +- .../visualization/line/vistoolalongline.cpp | 2 +- .../visualization/line/vistoolbisector.cpp | 2 +- .../line/vistoolcurveintersectaxis.cpp | 2 +- .../visualization/line/vistoolendline.cpp | 4 +- .../line/vistoollineintersectaxis.cpp | 2 +- .../visualization/line/vistoolnormal.cpp | 2 +- .../line/vistoolpointfromcircleandtangent.cpp | 2 +- .../line/vistoolpointofcontact.cpp | 2 +- .../vistoolpointofintersectioncircles.cpp | 4 +- .../line/vistoolshoulderpoint.cpp | 2 +- .../vtools/visualization/path/vistoolarc.cpp | 6 +- .../path/vistoolarcwithlength.cpp | 6 +- .../visualization/path/vistoolcutarc.cpp | 2 +- .../visualization/path/vistoolcutspline.cpp | 2 +- .../path/vistoolcutsplinepath.cpp | 2 +- .../path/vistoolellipticalarc.cpp | 10 +- .../vtools/visualization/visualization.cpp | 6 +- src/libs/vtools/visualization/visualization.h | 5 +- src/test/ValentinaTest/tst_vmeasurements.cpp | 4 + 51 files changed, 364 insertions(+), 290 deletions(-) diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index 8a3bb929f..294e7c523 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -83,6 +83,8 @@ TMainWindow::TMainWindow(QWidget *parent) mUnit(Unit::Cm), pUnit(Unit::Cm), mType(MeasurementsType::Individual), + currentSize(0), + currentHeight(0), curFile(), gradationHeights(nullptr), gradationSizes(nullptr), @@ -179,7 +181,7 @@ void TMainWindow::SetBaseMHeight(int height) if (mType == MeasurementsType::Multisize) { const int row = ui->tableWidget->currentRow(); - VContainer::SetHeight(UnitConvertor(height, Unit::Cm, mUnit)); + currentHeight = UnitConvertor(height, Unit::Cm, mUnit); RefreshData(); ui->tableWidget->selectRow(row); } @@ -194,7 +196,7 @@ void TMainWindow::SetBaseMSize(int size) if (mType == MeasurementsType::Multisize) { const int row = ui->tableWidget->currentRow(); - VContainer::SetSize(UnitConvertor(size, Unit::Cm, mUnit)); + currentSize = UnitConvertor(size, Unit::Cm, mUnit); RefreshData(); ui->tableWidget->selectRow(row); } @@ -250,6 +252,8 @@ bool TMainWindow::LoadFile(const QString &path) data = new VContainer(qApp->TrVars(), &mUnit); m = new VMeasurements(data); + m->SetSize(¤tSize); + m->SetHeight(¤tHeight); m->setXMLContent(path); mType = m->Type(); @@ -284,8 +288,8 @@ bool TMainWindow::LoadFile(const QString &path) mUnit = m->MUnit(); pUnit = mUnit; - VContainer::SetHeight(m->BaseHeight()); - VContainer::SetSize(m->BaseSize()); + currentSize = m->BaseSize(); + currentHeight = m->BaseHeight(); ui->labelToolTip->setVisible(false); ui->tabWidget->setVisible(true); @@ -358,12 +362,14 @@ void TMainWindow::FileNew() mType = measurements.Type(); data = new VContainer(qApp->TrVars(), &mUnit); - VContainer::SetHeight(measurements.BaseHeight()); - VContainer::SetSize(measurements.BaseSize()); + currentHeight = measurements.BaseHeight(); + currentSize = measurements.BaseSize(); if (mType == MeasurementsType::Multisize) { m = new VMeasurements(mUnit, measurements.BaseSize(), measurements.BaseHeight(), data); + m->SetSize(¤tSize); + m->SetHeight(¤tHeight); m_curFileFormatVersion = VVSTConverter::MeasurementMaxVer; m_curFileFormatVersionStr = VVSTConverter::MeasurementMaxVerStr; } @@ -1416,7 +1422,7 @@ void TMainWindow::ImportFromPattern() void TMainWindow::ChangedSize(const QString &text) { const int row = ui->tableWidget->currentRow(); - VContainer::SetSize(text.toInt()); + currentSize = text.toInt(); RefreshData(); search->RefreshList(ui->lineEditFind->text()); ui->tableWidget->selectRow(row); @@ -1426,7 +1432,7 @@ void TMainWindow::ChangedSize(const QString &text) void TMainWindow::ChangedHeight(const QString &text) { const int row = ui->tableWidget->currentRow(); - VContainer::SetHeight(text.toInt()); + currentHeight = text.toInt(); RefreshData(); search->RefreshList(ui->lineEditFind->text()); ui->tableWidget->selectRow(row); @@ -1489,7 +1495,8 @@ void TMainWindow::ShowNewMData(bool fresh) ui->doubleSpinBoxInHeights->blockSignals(true); const QString postfix = UnitsToStr(pUnit);//Show unit in dialog lable (cm, mm or inch) - const qreal value = UnitConvertor(data->GetTableValue(meash->GetName(), mType), mUnit, pUnit); + const qreal value = UnitConvertor(*data->DataVariables()->value(meash->GetName())->GetValue(), mUnit, + pUnit); ui->labelCalculatedValue->setText(qApp->LocaleToString(value) + " " +postfix); if (fresh) @@ -2353,7 +2360,7 @@ void TMainWindow::SetDefaultHeight(int value) } else { - VContainer::SetHeight(gradationHeights->currentText().toInt()); + currentHeight = gradationHeights->currentText().toInt(); } } @@ -2367,7 +2374,7 @@ void TMainWindow::SetDefaultSize(int value) } else { - VContainer::SetSize(gradationSizes->currentText().toInt()); + currentSize = gradationSizes->currentText().toInt(); } } @@ -2453,7 +2460,8 @@ void TMainWindow::RefreshTable(bool freshCall) AddCell(qApp->TrVars()->GuiText(meash->GetName()), currentRow, ColumnFullName, Qt::AlignVCenter); } - const qreal value = UnitConvertor(data->GetTableValue(meash->GetName(), mType), mUnit, pUnit); + const qreal value = UnitConvertor(*data->DataVariables()->value(meash->GetName())->GetValue(), mUnit, + pUnit); AddCell(locale().toString(value), currentRow, ColumnCalcValue, Qt::AlignHCenter | Qt::AlignVCenter, meash->IsFormulaOk()); // calculated value @@ -2669,7 +2677,7 @@ bool TMainWindow::EvalFormula(const QString &formula, bool fromUser, VContainer } f.replace("\n", " "); QScopedPointer cal(new Calculator()); - qreal result = cal->EvalFormula(data->PlainVariables(), f); + qreal result = cal->EvalFormula(data->DataVariables(), f); if (qIsInf(result) || qIsNaN(result)) { @@ -2836,6 +2844,8 @@ bool TMainWindow::LoadFromExistingFile(const QString &path) data = new VContainer(qApp->TrVars(), &mUnit); m = new VMeasurements(data); + m->SetSize(¤tSize); + m->SetHeight(¤tHeight); m->setXMLContent(path); mType = m->Type(); @@ -2868,8 +2878,8 @@ bool TMainWindow::LoadFromExistingFile(const QString &path) mUnit = m->MUnit(); pUnit = mUnit; - VContainer::SetHeight(m->BaseHeight()); - VContainer::SetSize(m->BaseSize()); + currentHeight = m->BaseHeight(); + currentSize = m->BaseSize(); ui->labelToolTip->setVisible(false); ui->tabWidget->setVisible(true); diff --git a/src/app/tape/tmainwindow.h b/src/app/tape/tmainwindow.h index adbc9b0cf..fa580db88 100644 --- a/src/app/tape/tmainwindow.h +++ b/src/app/tape/tmainwindow.h @@ -135,6 +135,8 @@ private: Unit mUnit; Unit pUnit; MeasurementsType mType; + qreal currentSize; + qreal currentHeight; QString curFile; QComboBox *gradationHeights; QComboBox *gradationSizes; diff --git a/src/app/valentina/dialogs/dialogincrements.cpp b/src/app/valentina/dialogs/dialogincrements.cpp index 1da4f4d41..559aea1a0 100644 --- a/src/app/valentina/dialogs/dialogincrements.cpp +++ b/src/app/valentina/dialogs/dialogincrements.cpp @@ -352,7 +352,7 @@ bool DialogIncrements::EvalIncrementFormula(const QString &formula, bool fromUse } f.replace("\n", " "); QScopedPointer cal(new Calculator()); - const qreal result = cal->EvalFormula(data->PlainVariables(), f); + const qreal result = cal->EvalFormula(data->DataVariables(), f); if (qIsInf(result) || qIsNaN(result)) { diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 2075eb685..6a071c5ad 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -377,6 +377,8 @@ QSharedPointer MainWindow::OpenMeasurementFile(const QString &pat try { m = QSharedPointer(new VMeasurements(pattern)); + m->SetSize(VContainer::rsize()); + m->SetHeight(VContainer::rheight()); m->setXMLContent(path); if (m->Type() == MeasurementsType::Unknown) @@ -451,8 +453,8 @@ bool MainWindow::LoadMeasurements(const QString &path) if (m->Type() == MeasurementsType::Multisize) { - m->SetDataSize(); - m->SetDataHeight(); + VContainer::SetSize(UnitConvertor(m->BaseSize(), m->MUnit(), *m->GetData()->GetPatternUnit())); + VContainer::SetHeight(UnitConvertor(m->BaseHeight(), m->MUnit(), *m->GetData()->GetPatternUnit())); } try @@ -4127,6 +4129,8 @@ bool MainWindow::LoadPattern(const QString &fileName, const QString& customMeasu // Here comes undocumented Valentina's feature. // Because app bundle in Mac OS X doesn't allow setup assosiation for Tape we must do this through Valentina VMeasurements m(pattern); + m.SetSize(VContainer::rsize()); + m.SetHeight(VContainer::rheight()); m.setXMLContent(fileName); if (m.Type() == MeasurementsType::Multisize || m.Type() == MeasurementsType::Individual) @@ -4626,6 +4630,8 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS else { QScopedPointer m(new VMeasurements(pattern)); + m->SetSize(VContainer::rsize()); + m->SetHeight(VContainer::rheight()); m->setXMLContent(mPath); patternType = m->Type(); diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 767921375..02538aa87 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -3015,7 +3015,7 @@ qreal VPattern::EvalFormula(VContainer *data, const QString &formula, bool *ok) QString f = formula; f.replace("\n", " "); QScopedPointer cal(new Calculator()); - const qreal result = cal->EvalFormula(data->PlainVariables(), f); + const qreal result = cal->EvalFormula(data->DataVariables(), f); (qIsInf(result) || qIsNaN(result)) ? *ok = false : *ok = true; return result; diff --git a/src/libs/vformat/vmeasurements.cpp b/src/libs/vformat/vmeasurements.cpp index 7faaa6f07..8b144e274 100644 --- a/src/libs/vformat/vmeasurements.cpp +++ b/src/libs/vformat/vmeasurements.cpp @@ -98,7 +98,9 @@ QString FileComment() VMeasurements::VMeasurements(VContainer *data) :VDomDocument(), data(data), - type(MeasurementsType::Unknown) + type(MeasurementsType::Unknown), + m_currentSize(nullptr), + m_currentHeight(nullptr) { SCASSERT(data != nullptr) } @@ -107,7 +109,9 @@ VMeasurements::VMeasurements(VContainer *data) VMeasurements::VMeasurements(Unit unit, VContainer *data) :VDomDocument(), data(data), - type(MeasurementsType::Individual) + type(MeasurementsType::Individual), + m_currentSize(nullptr), + m_currentHeight(nullptr) { SCASSERT(data != nullptr) @@ -118,7 +122,9 @@ VMeasurements::VMeasurements(Unit unit, VContainer *data) VMeasurements::VMeasurements(Unit unit, int baseSize, int baseHeight, VContainer *data) :VDomDocument(), data(data), - type(MeasurementsType::Multisize) + type(MeasurementsType::Multisize), + m_currentSize(nullptr), + m_currentHeight(nullptr) { SCASSERT(data != nullptr) @@ -294,6 +300,9 @@ void VMeasurements::ReadMeasurements() const tempMeash = QSharedPointer(new VMeasurement(static_cast(i), name, BaseSize(), BaseHeight(), base, ksize, kheight)); + tempMeash->SetSize(m_currentSize); + tempMeash->SetHeight(m_currentHeight); + tempMeash->SetUnit(data->GetPatternUnit()); base = UnitConvertor(base, MUnit(), *data->GetPatternUnit()); ksize = UnitConvertor(ksize, MUnit(), *data->GetPatternUnit()); @@ -304,6 +313,9 @@ void VMeasurements::ReadMeasurements() const meash = QSharedPointer(new VMeasurement(static_cast(i), name, baseSize, baseHeight, base, ksize, kheight, fullName, description)); + meash->SetSize(m_currentSize); + meash->SetHeight(m_currentHeight); + meash->SetUnit(data->GetPatternUnit()); } else { @@ -497,6 +509,18 @@ void VMeasurements::SetReadOnly(bool ro) } } +//--------------------------------------------------------------------------------------------------------------------- +void VMeasurements::SetSize(qreal *size) +{ + m_currentSize = size; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VMeasurements::SetHeight(qreal *height) +{ + m_currentHeight = height; +} + //--------------------------------------------------------------------------------------------------------------------- void VMeasurements::SetMName(const QString &name, const QString &text) { @@ -684,15 +708,9 @@ bool VMeasurements::IsDefinedKnownNamesValid() const } //--------------------------------------------------------------------------------------------------------------------- -void VMeasurements::SetDataSize() +VContainer *VMeasurements::GetData() const { - VContainer::SetSize(UnitConvertor(BaseSize(), MUnit(), *data->GetPatternUnit())); -} - -//--------------------------------------------------------------------------------------------------------------------- -void VMeasurements::SetDataHeight() -{ - VContainer::SetHeight(UnitConvertor(BaseHeight(), MUnit(), *data->GetPatternUnit())); + return data; } //--------------------------------------------------------------------------------------------------------------------- @@ -901,7 +919,7 @@ qreal VMeasurements::EvalFormula(VContainer *data, const QString &formula, bool QString f = formula; f.replace("\n", " "); QScopedPointer cal(new Calculator()); - const qreal result = cal->EvalFormula(data->PlainVariables(), f); + const qreal result = cal->EvalFormula(data->DataVariables(), f); (qIsInf(result) || qIsNaN(result)) ? *ok = false : *ok = true; return result; diff --git a/src/libs/vformat/vmeasurements.h b/src/libs/vformat/vmeasurements.h index d621ff469..f451e1f0a 100644 --- a/src/libs/vformat/vmeasurements.h +++ b/src/libs/vformat/vmeasurements.h @@ -93,6 +93,9 @@ public: bool IsReadOnly() const; void SetReadOnly(bool ro); + void SetSize(qreal *size); + void SetHeight(qreal *height); + void SetMName(const QString &name, const QString &text); void SetMValue(const QString &name, const QString &text); void SetMBaseValue(const QString &name, double value); @@ -137,8 +140,7 @@ public: bool IsDefinedKnownNamesValid() const; - void SetDataSize(); - void SetDataHeight(); + VContainer *GetData() const; private: Q_DISABLE_COPY(VMeasurements) @@ -147,6 +149,9 @@ private: VContainer *data; MeasurementsType type; + qreal *m_currentSize; + qreal *m_currentHeight; + void CreateEmptyMultisizeFile(Unit unit, int baseSize, int baseHeight); void CreateEmptyIndividualFile(Unit unit); diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index bace202ea..65b6c713f 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -83,7 +83,7 @@ bool FindLabelGeometry(const VPatternLabelData &labelData, const VContainer *pat try { Calculator cal1; - rotationAngle = cal1.EvalFormula(pattern->PlainVariables(), labelData.GetRotation()); + rotationAngle = cal1.EvalFormula(pattern->DataVariables(), labelData.GetRotation()); } catch(qmu::QmuParserError &e) { @@ -119,10 +119,10 @@ bool FindLabelGeometry(const VPatternLabelData &labelData, const VContainer *pat try { Calculator cal1; - labelWidth = cal1.EvalFormula(pattern->PlainVariables(), labelData.GetLabelWidth()); + labelWidth = cal1.EvalFormula(pattern->DataVariables(), labelData.GetLabelWidth()); Calculator cal2; - labelHeight = cal2.EvalFormula(pattern->PlainVariables(), labelData.GetLabelHeight()); + labelHeight = cal2.EvalFormula(pattern->DataVariables(), labelData.GetLabelHeight()); } catch(qmu::QmuParserError &e) { @@ -194,11 +194,11 @@ bool FindGrainlineGeometry(const VGrainlineData& geom, const VContainer *pattern try { Calculator cal1; - rotationAngle = cal1.EvalFormula(pattern->PlainVariables(), geom.GetRotation()); + rotationAngle = cal1.EvalFormula(pattern->DataVariables(), geom.GetRotation()); rotationAngle = qDegreesToRadians(rotationAngle); Calculator cal2; - length = cal2.EvalFormula(pattern->PlainVariables(), geom.GetLength()); + length = cal2.EvalFormula(pattern->DataVariables(), geom.GetLength()); length = ToPixel(length, *pattern->GetPatternUnit()); } catch(qmu::QmuParserError &e) diff --git a/src/libs/vpatterndb/calculator.cpp b/src/libs/vpatterndb/calculator.cpp index 4dcf10795..1dcae88ad 100644 --- a/src/libs/vpatterndb/calculator.cpp +++ b/src/libs/vpatterndb/calculator.cpp @@ -35,6 +35,7 @@ #include "../vmisc/def.h" #include "../qmuparser/qmuparsererror.h" +#include "variables/vinternalvariable.h" //--------------------------------------------------------------------------------------------------------------------- /** @@ -69,7 +70,7 @@ Calculator::Calculator() * @param formula string of formula. * @return value of formula. */ -qreal Calculator::EvalFormula(const QHash &vars, const QString &formula) +qreal Calculator::EvalFormula(const QHash> *vars, const QString &formula) { // Parser doesn't know any variable on this stage. So, we just use variable factory that for each unknown variable // set value to 0. @@ -115,16 +116,16 @@ qreal Calculator::EvalFormula(const QHash &vars, const QString * @param tokens all tokens (measurements names, variables with lengths) that parser have found in expression. * @param formula expression, need for throwing better error message. */ -void Calculator::InitVariables(const QHash &vars, const QMap &tokens, - const QString &formula) +void Calculator::InitVariables(const QHash > *vars, + const QMap &tokens, const QString &formula) { QMap::const_iterator i = tokens.constBegin(); while (i != tokens.constEnd()) { bool found = false; - if (vars.contains(i.value())) + if (vars->contains(i.value())) { - DefineVar(i.value(), vars.value(i.value())); + DefineVar(i.value(), vars->value(i.value())->GetValue()); found = true; } diff --git a/src/libs/vpatterndb/calculator.h b/src/libs/vpatterndb/calculator.h index 10eddeca8..242f8494e 100644 --- a/src/libs/vpatterndb/calculator.h +++ b/src/libs/vpatterndb/calculator.h @@ -37,6 +37,8 @@ #include "../qmuparser/qmuformulabase.h" +class VInternalVariable; + /** * @brief The Calculator class for calculation formula. * @@ -61,11 +63,12 @@ public: Calculator(); virtual ~Calculator() Q_DECL_EQ_DEFAULT; - qreal EvalFormula(const QHash &vars, const QString &formula); + qreal EvalFormula(const QHash > *vars, const QString &formula); private: Q_DISABLE_COPY(Calculator) - void InitVariables(const QHash &vars, const QMap &tokens, const QString &formula); + void InitVariables(const QHash > *vars, const QMap &tokens, + const QString &formula); }; #endif // CALCULATOR_H diff --git a/src/libs/vpatterndb/variables/vincrement.cpp b/src/libs/vpatterndb/variables/vincrement.cpp index 83a962547..535d968cd 100644 --- a/src/libs/vpatterndb/variables/vincrement.cpp +++ b/src/libs/vpatterndb/variables/vincrement.cpp @@ -51,9 +51,10 @@ VIncrement::VIncrement() */ VIncrement::VIncrement(VContainer *data, const QString &name, quint32 index, qreal base, const QString &formula, bool ok, const QString &description) - :VVariable(name, base, description), d(new VIncrementData(data, index, formula, ok)) + :VVariable(name, description), d(new VIncrementData(data, index, formula, ok)) { SetType(VarType::Increment); + VInternalVariable::SetValue(base); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vpatterndb/variables/vinternalvariable.cpp b/src/libs/vpatterndb/variables/vinternalvariable.cpp index d22cfa9bd..647e3e81f 100644 --- a/src/libs/vpatterndb/variables/vinternalvariable.cpp +++ b/src/libs/vpatterndb/variables/vinternalvariable.cpp @@ -79,6 +79,7 @@ qreal *VInternalVariable::GetValue() return &d->value; } +//--------------------------------------------------------------------------------------------------------------------- void VInternalVariable::SetValue(const qreal &value) { d->value = value; diff --git a/src/libs/vpatterndb/variables/vinternalvariable.h b/src/libs/vpatterndb/variables/vinternalvariable.h index a60f296a9..4fa7717ef 100644 --- a/src/libs/vpatterndb/variables/vinternalvariable.h +++ b/src/libs/vpatterndb/variables/vinternalvariable.h @@ -54,9 +54,8 @@ public: void Swap(VInternalVariable &var) Q_DECL_NOTHROW { std::swap(d, var.d); } - qreal GetValue() const; - qreal* GetValue(); - void SetValue(const qreal &value); + virtual qreal GetValue() const; + virtual qreal* GetValue(); QString GetName() const; void SetName(const QString &name); @@ -67,6 +66,8 @@ public: virtual bool Filter(quint32 id); virtual bool IsNotUsed() const; +protected: + void SetValue(const qreal &value); private: QSharedDataPointer d; }; diff --git a/src/libs/vpatterndb/variables/vmeasurement.cpp b/src/libs/vpatterndb/variables/vmeasurement.cpp index 1a3de487c..04ca53630 100644 --- a/src/libs/vpatterndb/variables/vmeasurement.cpp +++ b/src/libs/vpatterndb/variables/vmeasurement.cpp @@ -50,10 +50,11 @@ VMeasurement::VMeasurement(quint32 index, const QString &name, qreal baseSize, qreal baseHeight, const qreal &base, const qreal &ksize, const qreal &kheight, const QString &gui_text, const QString &description, const QString &tagName) - :VVariable(name, baseSize, baseHeight, base, ksize, kheight, description), - d(new VMeasurementData(index, gui_text, tagName)) + :VVariable(name, description), + d(new VMeasurementData(index, gui_text, tagName, baseSize, baseHeight, base, ksize, kheight)) { SetType(VarType::Measurement); + VInternalVariable::SetValue(d->base); } //--------------------------------------------------------------------------------------------------------------------- @@ -68,9 +69,10 @@ VMeasurement::VMeasurement(quint32 index, const QString &name, qreal baseSize, q VMeasurement::VMeasurement(VContainer *data, quint32 index, const QString &name, const qreal &base, const QString &formula, bool ok, const QString &gui_text, const QString &description, const QString &tagName) - :VVariable(name, base, description), d(new VMeasurementData(data, index, formula, ok, gui_text, tagName)) + :VVariable(name, description), d(new VMeasurementData(data, index, formula, ok, gui_text, tagName, base)) { SetType(VarType::Measurement); + VInternalVariable::SetValue(base); } //--------------------------------------------------------------------------------------------------------------------- @@ -212,6 +214,29 @@ bool VMeasurement::IsGradationHeightValid(const QString &height) } } +//--------------------------------------------------------------------------------------------------------------------- +qreal VMeasurement::CalcValue() const +{ + if (d->currentUnit == nullptr || d->currentSize == nullptr || d->currentHeight == nullptr) + { + return VInternalVariable::GetValue(); + } + + if (*d->currentUnit == Unit::Inch) + { + qWarning("Gradation doesn't support inches"); + return 0; + } + + const qreal sizeIncrement = UnitConvertor(2.0, Unit::Cm, *d->currentUnit); + const qreal heightIncrement = UnitConvertor(6.0, Unit::Cm, *d->currentUnit); + + // Formula for calculation gradation + const qreal k_size = ( *d->currentSize - d->baseSize ) / sizeIncrement; + const qreal k_height = ( *d->currentHeight - d->baseHeight ) / heightIncrement; + return d->base + k_size * d->ksize + k_height * d->kheight; +} + //--------------------------------------------------------------------------------------------------------------------- void VMeasurement::ListValue(QStringList &list, qreal value, Unit patternUnit) { @@ -251,14 +276,7 @@ QString VMeasurement::GetFormula() const //--------------------------------------------------------------------------------------------------------------------- bool VMeasurement::IsCustom() const { - if (GetName().indexOf(CustomMSign) == 0) - { - return true; - } - else - { - return false; - } + return GetName().indexOf(CustomMSign) == 0; } //--------------------------------------------------------------------------------------------------------------------- @@ -273,8 +291,95 @@ bool VMeasurement::IsFormulaOk() const return d->formulaOk; } +//--------------------------------------------------------------------------------------------------------------------- +bool VMeasurement::IsNotUsed() const +{ + return qFuzzyIsNull(d->base) && qFuzzyIsNull(d->ksize) && qFuzzyIsNull(d->kheight); +} + +//--------------------------------------------------------------------------------------------------------------------- +qreal VMeasurement::GetValue() const +{ + return CalcValue(); +} + +//--------------------------------------------------------------------------------------------------------------------- +qreal *VMeasurement::GetValue() +{ + VInternalVariable::SetValue(CalcValue()); + return VInternalVariable::GetValue(); +} + //--------------------------------------------------------------------------------------------------------------------- VContainer *VMeasurement::GetData() { return &d->data; } + +//--------------------------------------------------------------------------------------------------------------------- +void VMeasurement::SetSize(qreal *size) +{ + d->currentSize = size; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VMeasurement::SetHeight(qreal *height) +{ + d->currentHeight = height; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VMeasurement::SetUnit(const Unit *unit) +{ + d->currentUnit = unit; +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetBase return value in base size and height + * @return value + */ +qreal VMeasurement::GetBase() const +{ + return d->base; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VMeasurement::SetBase(const qreal &value) +{ + d->base = value; +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetKsize return increment in sizes + * @return increment + */ +qreal VMeasurement::GetKsize() const +{ + return d->ksize; +} + +//--------------------------------------------------------------------------------------------------------------------- +// cppcheck-suppress unusedFunction +void VMeasurement::SetKsize(const qreal &value) +{ + d->ksize = value; +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetKheight return increment in heights + * @return increment + */ +qreal VMeasurement::GetKheight() const +{ + return d->kheight; +} + +//--------------------------------------------------------------------------------------------------------------------- +// cppcheck-suppress unusedFunction +void VMeasurement::SetKheight(const qreal &value) +{ + d->kheight = value; +} diff --git a/src/libs/vpatterndb/variables/vmeasurement.h b/src/libs/vpatterndb/variables/vmeasurement.h index fa02e29d7..7c7ed07c2 100644 --- a/src/libs/vpatterndb/variables/vmeasurement.h +++ b/src/libs/vpatterndb/variables/vmeasurement.h @@ -80,8 +80,26 @@ public: int Index() const; bool IsFormulaOk() const; + virtual bool IsNotUsed() const Q_DECL_OVERRIDE; + + virtual qreal GetValue() const Q_DECL_OVERRIDE; + virtual qreal* GetValue() Q_DECL_OVERRIDE; + VContainer *GetData(); + void SetSize(qreal *size); + void SetHeight(qreal *height); + void SetUnit(const Unit *unit); + + qreal GetBase() const; + void SetBase(const qreal &value); + + qreal GetKsize() const; + void SetKsize(const qreal &value); + + qreal GetKheight() const; + void SetKheight(const qreal &value); + static QStringList ListHeights(QMap heights, Unit patternUnit); static QStringList ListSizes(QMap sizes, Unit patternUnit); static QStringList WholeListHeights(Unit patternUnit); @@ -91,6 +109,8 @@ public: private: QSharedDataPointer d; + qreal CalcValue() const; + static void ListValue(QStringList &list, qreal value, Unit patternUnit); }; diff --git a/src/libs/vpatterndb/variables/vmeasurement_p.h b/src/libs/vpatterndb/variables/vmeasurement_p.h index f8191116f..bb3057c41 100644 --- a/src/libs/vpatterndb/variables/vmeasurement_p.h +++ b/src/libs/vpatterndb/variables/vmeasurement_p.h @@ -42,19 +42,58 @@ class VMeasurementData : public QSharedData { public: - VMeasurementData(quint32 index, const QString &gui_text, const QString &tagName) - :data(VContainer(nullptr, nullptr)), index(index), formula(), gui_text(gui_text), _tagName(tagName), - formulaOk(true) + VMeasurementData(quint32 index, const QString &gui_text, const QString &tagName, qreal baseSize, qreal baseHeight, + qreal base, qreal ksize, qreal kheight ) + : data(VContainer(nullptr, nullptr)), + index(index), + formula(), + gui_text(gui_text), + _tagName(tagName), + formulaOk(true), + currentSize(nullptr), + currentHeight(nullptr), + currentUnit(nullptr), + base(base), + ksize(ksize), + kheight(kheight), + baseSize(baseSize), + baseHeight(baseHeight) {} VMeasurementData(VContainer *data, quint32 index, const QString &formula, bool ok, const QString &gui_text, - const QString &tagName) - :data(*data), index(index), formula(formula), gui_text(gui_text), _tagName(tagName), formulaOk(ok) + const QString &tagName, qreal base) + : data(*data), + index(index), + formula(formula), + gui_text(gui_text), + _tagName(tagName), + formulaOk(ok), + currentSize(nullptr), + currentHeight(nullptr), + currentUnit(nullptr), + base(base), + ksize(0), + kheight(0), + baseSize(0), + baseHeight(0) {} VMeasurementData(const VMeasurementData &m) - :QSharedData(m), data(m.data), index(m.index), formula(m.formula), gui_text(m.gui_text), _tagName(m._tagName), - formulaOk(m.formulaOk) + : QSharedData(m), + data(m.data), + index(m.index), + formula(m.formula), + gui_text(m.gui_text), + _tagName(m._tagName), + formulaOk(m.formulaOk), + currentSize(m.currentSize), + currentHeight(m.currentHeight), + currentUnit(m.currentUnit), + base(m.base), + ksize(m.ksize), + kheight(m.kheight), + baseSize(m.baseSize), + baseHeight(m.baseHeight) {} virtual ~VMeasurementData(); @@ -66,6 +105,22 @@ public: QString _tagName; bool formulaOk; + qreal *currentSize; + qreal *currentHeight; + const Unit *currentUnit; + + /** @brief base value in base size and height */ + qreal base; + + /** @brief ksize increment in sizes */ + qreal ksize; + + /** @brief kgrowth increment in heights */ + qreal kheight; + + qreal baseSize; + qreal baseHeight; + private: VMeasurementData &operator=(const VMeasurementData &) Q_DECL_EQ_DELETE; }; diff --git a/src/libs/vpatterndb/variables/vvariable.cpp b/src/libs/vpatterndb/variables/vvariable.cpp index b4f1172f7..502caf20d 100644 --- a/src/libs/vpatterndb/variables/vvariable.cpp +++ b/src/libs/vpatterndb/variables/vvariable.cpp @@ -37,24 +37,12 @@ //--------------------------------------------------------------------------------------------------------------------- VVariable::VVariable() :VInternalVariable(), d(new VVariableData) -{ - VInternalVariable::SetValue(d->base); -} +{} //--------------------------------------------------------------------------------------------------------------------- -VVariable::VVariable(const QString &name, qreal baseSize, qreal baseHeight, const qreal &base, const qreal &ksize, - const qreal &kheight, const QString &description) - :VInternalVariable(), d(new VVariableData(baseSize, baseHeight, base, ksize, kheight, description)) +VVariable::VVariable(const QString &name, const QString &description) + :VInternalVariable(), d(new VVariableData(description)) { - VInternalVariable::SetValue(d->base); - SetName(name); -} - -//--------------------------------------------------------------------------------------------------------------------- -VVariable::VVariable(const QString &name, const qreal &base, const QString &description) - :d(new VVariableData(base, description)) -{ - VInternalVariable::SetValue(base); SetName(name); } @@ -79,87 +67,6 @@ VVariable &VVariable::operator=(const VVariable &var) VVariable::~VVariable() {} -//--------------------------------------------------------------------------------------------------------------------- -void VVariable::SetValue(const qreal &size, const qreal &height, Unit patternUnit) -{ - if (patternUnit == Unit::Inch) - { - qWarning("Gradation doesn't support inches"); - return; - } - const qreal sizeIncrement = UnitConvertor(2.0, Unit::Cm, patternUnit); - const qreal heightIncrement = UnitConvertor(6.0, Unit::Cm, patternUnit); - - // Formula for calculation gradation - const qreal k_size = ( size - d->baseSize ) / sizeIncrement; - const qreal k_height = ( height - d->baseHeight ) / heightIncrement; - VInternalVariable::SetValue(d->base + k_size * d->ksize + k_height * d->kheight); -} - -//--------------------------------------------------------------------------------------------------------------------- -bool VVariable::IsNotUsed() const -{ - if (qFuzzyIsNull(d->base) && qFuzzyIsNull(d->ksize) && qFuzzyIsNull(d->kheight)) - { - return true; - } - else - { - return false; - } -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief GetBase return value in base size and height - * @return value - */ -qreal VVariable::GetBase() const -{ - return d->base; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VVariable::SetBase(const qreal &value) -{ - d->base = value; -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief GetKsize return increment in sizes - * @return increment - */ -qreal VVariable::GetKsize() const -{ - return d->ksize; -} - -//--------------------------------------------------------------------------------------------------------------------- -// cppcheck-suppress unusedFunction -void VVariable::SetKsize(const qreal &value) -{ - d->ksize = value; -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief GetKheight return increment in heights - * @return increment - */ -qreal VVariable::GetKheight() const -{ - return d->kheight; -} - - -//--------------------------------------------------------------------------------------------------------------------- -// cppcheck-suppress unusedFunction -void VVariable::SetKheight(const qreal &value) -{ - d->kheight = value; -} - //--------------------------------------------------------------------------------------------------------------------- QString VVariable::GetDescription() const { diff --git a/src/libs/vpatterndb/variables/vvariable.h b/src/libs/vpatterndb/variables/vvariable.h index 02c41d395..4bd078086 100644 --- a/src/libs/vpatterndb/variables/vvariable.h +++ b/src/libs/vpatterndb/variables/vvariable.h @@ -45,9 +45,7 @@ class VVariable :public VInternalVariable { public: VVariable(); - VVariable(const QString &name, qreal baseSize, qreal baseHeight, const qreal &base, const qreal &ksize = 0, - const qreal &kheight = 0, const QString &description = QString()); - VVariable(const QString &name, const qreal &base, const QString &description = QString()); + VVariable(const QString &name, const QString &description = QString()); VVariable(const VVariable &var); virtual ~VVariable() Q_DECL_OVERRIDE; @@ -60,21 +58,9 @@ public: void Swap(VVariable &var) Q_DECL_NOTHROW { VInternalVariable::Swap(var); std::swap(d, var.d); } - qreal GetBase() const; - void SetBase(const qreal &value); - - qreal GetKsize() const; - void SetKsize(const qreal &value); - - qreal GetKheight() const; - void SetKheight(const qreal &value); - QString GetDescription() const; void SetDescription(const QString &desc); - void SetValue(const qreal &size, const qreal &height, Unit patternUnit); - - virtual bool IsNotUsed() const Q_DECL_OVERRIDE; private: QSharedDataPointer d; }; diff --git a/src/libs/vpatterndb/variables/vvariable_p.h b/src/libs/vpatterndb/variables/vvariable_p.h index 31168dea1..0d85a9af6 100644 --- a/src/libs/vpatterndb/variables/vvariable_p.h +++ b/src/libs/vpatterndb/variables/vvariable_p.h @@ -42,41 +42,23 @@ class VVariableData : public QSharedData public: VVariableData() - :base(0), ksize(0), kheight(0), description(QString()), baseSize(0), baseHeight(0) + : description() {} - VVariableData(qreal baseSize, qreal baseHeight, const qreal &base, const qreal &ksize, const qreal &kheight, - const QString &description) - :base(base), ksize(ksize), kheight(kheight), description(description), baseSize(baseSize), - baseHeight(baseHeight) - {} - - VVariableData(const qreal &base, const QString &description) - :base(base), ksize(0), kheight(0), description(description), baseSize(0), baseHeight(0) + VVariableData(const QString &description) + : description(description) {} VVariableData(const VVariableData &var) - :QSharedData(var), base(var.base), ksize(var.ksize), kheight(var.kheight), description(var.description), - baseSize(var.baseSize), baseHeight(var.baseHeight) + : QSharedData(var), + description(var.description) {} virtual ~VVariableData(); - /** @brief base value in base size and height */ - qreal base; - - /** @brief ksize increment in sizes */ - qreal ksize; - - /** @brief kgrowth increment in heights */ - qreal kheight; - /** @brief description description of increment */ QString description; - qreal baseSize; - qreal baseHeight; - private: VVariableData &operator=(const VVariableData &) Q_DECL_EQ_DELETE; }; diff --git a/src/libs/vpatterndb/vcontainer.cpp b/src/libs/vpatterndb/vcontainer.cpp index 60b4ebf2a..744e25e16 100644 --- a/src/libs/vpatterndb/vcontainer.cpp +++ b/src/libs/vpatterndb/vcontainer.cpp @@ -538,17 +538,6 @@ void VContainer::UpdatePiecePath(quint32 id, const VPiecePath &path) UpdateId(id); } -//--------------------------------------------------------------------------------------------------------------------- -qreal VContainer::GetTableValue(const QString &name, MeasurementsType patternType) const -{ - QSharedPointer m = GetVariable(name); - if (patternType == MeasurementsType::Multisize) - { - m->SetValue(size(), height(), *GetPatternUnit()); - } - return *m->GetValue(); -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief RemoveIncrement remove increment by name from increment table @@ -608,28 +597,6 @@ const QMap > VContainer::DataAnglesCurves() return DataVar(VarType::CurveAngle); } -//--------------------------------------------------------------------------------------------------------------------- -const QHash VContainer::PlainVariables() const -{ - QHash vars; - - auto i = d->variables.constBegin(); - while (i != d->variables.constEnd()) - { - QSharedPointer var = i.value(); - if (qApp->patternType() == MeasurementsType::Multisize && var->GetType() == VarType::Measurement) - { - QSharedPointer m = GetVariable(i.key()); - m->SetValue(size(), height(), qApp->patternUnit()); - } - vars.insert(i.key(), var->GetValue()); - - ++i; - } - - return vars; -} - //--------------------------------------------------------------------------------------------------------------------- bool VContainer::IsUnique(const QString &name) { diff --git a/src/libs/vpatterndb/vcontainer.h b/src/libs/vpatterndb/vcontainer.h index b02b8c405..4311e92f0 100644 --- a/src/libs/vpatterndb/vcontainer.h +++ b/src/libs/vpatterndb/vcontainer.h @@ -136,7 +136,6 @@ public: static const QSharedPointer GetFakeGObject(quint32 id); VPiece GetPiece(quint32 id) const; VPiecePath GetPiecePath(quint32 id) const; - qreal GetTableValue(const QString& name, MeasurementsType patternType) const; template QSharedPointer GetVariable(QString name) const; static quint32 getId(); @@ -196,8 +195,6 @@ public: const QMap > DataRadiusesArcs() const; const QMap > DataAnglesCurves() const; - const QHash PlainVariables() const; - static bool IsUnique(const QString &name); static QStringList AllUniqueNames(); diff --git a/src/libs/vpatterndb/vformula.cpp b/src/libs/vpatterndb/vformula.cpp index e754549eb..af698752a 100644 --- a/src/libs/vpatterndb/vformula.cpp +++ b/src/libs/vpatterndb/vformula.cpp @@ -242,7 +242,7 @@ void VFormula::Eval() { QScopedPointer cal(new Calculator()); QString expression = qApp->TrVars()->FormulaFromUser(formula, qApp->Settings()->GetOsSeparator()); - const qreal result = cal->EvalFormula(data->PlainVariables(), expression); + const qreal result = cal->EvalFormula(data->DataVariables(), expression); if (qIsInf(result) || qIsNaN(result)) { diff --git a/src/libs/vpatterndb/vpiecenode.cpp b/src/libs/vpatterndb/vpiecenode.cpp index eafe29ee3..d5a312301 100644 --- a/src/libs/vpatterndb/vpiecenode.cpp +++ b/src/libs/vpatterndb/vpiecenode.cpp @@ -50,7 +50,7 @@ qreal EvalFormula(const VContainer *data, QString formula) // Replace line return character with spaces for calc if exist formula.replace("\n", " "); QScopedPointer cal(new Calculator()); - const qreal result = cal->EvalFormula(data->PlainVariables(), formula); + const qreal result = cal->EvalFormula(data->DataVariables(), formula); if (qIsInf(result) || qIsNaN(result)) { diff --git a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp index 744aeb3e1..94e9b8048 100644 --- a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp +++ b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp @@ -173,14 +173,14 @@ void DialogEditWrongFormula::ValChanged(int row) { const QString name = qApp->TrVars()->VarFromUser(item->text()); const QSharedPointer stable = data->GetVariable(name); - SetDescription(item->text(), data->GetTableValue(name, qApp->patternType()), + SetDescription(item->text(), *data->DataVariables()->value(name)->GetValue(), UnitsToStr(qApp->patternUnit(), true), stable->GetGuiText()); return; } if (ui->radioButtonIncrements->isChecked()) { const QSharedPointer incr = data->GetVariable(item->text()); - SetDescription(item->text(), data->GetTableValue(item->text(), qApp->patternType()), + SetDescription(item->text(), *data->DataVariables()->value(item->text())->GetValue(), UnitsToStr(qApp->patternUnit(), true), incr->GetDescription()); return; } diff --git a/src/libs/vtools/dialogs/tools/dialogspline.cpp b/src/libs/vtools/dialogs/tools/dialogspline.cpp index 14ce9e136..9376c204f 100644 --- a/src/libs/vtools/dialogs/tools/dialogspline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogspline.cpp @@ -452,7 +452,7 @@ VSpline DialogSpline::CurrentSpline() const QString length2F = ui->plainTextEditLength2F->toPlainText(); length2F.replace("\n", " "); - const QHash vars = data->PlainVariables(); + const QHash > *vars = data->DataVariables(); const qreal angle1 = Visualization::FindVal(angle1F, vars); const qreal angle2 = Visualization::FindVal(angle2F, vars); diff --git a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp index c001648ef..3cbff396e 100644 --- a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp @@ -325,7 +325,7 @@ void DialogSplinePath::Angle1Changed() VSplinePoint p = qvariant_cast(item->data(Qt::UserRole)); const QString angle1F = ui->plainTextEditAngle1F->toPlainText().replace("\n", " "); - const qreal angle1 = Visualization::FindVal(angle1F, data->PlainVariables()); + const qreal angle1 = Visualization::FindVal(angle1F, data->DataVariables()); try { @@ -368,7 +368,7 @@ void DialogSplinePath::Angle2Changed() VSplinePoint p = qvariant_cast(item->data(Qt::UserRole)); const QString angle2F = ui->plainTextEditAngle2F->toPlainText().replace("\n", " "); - const qreal angle2 = Visualization::FindVal(angle2F, data->PlainVariables()); + const qreal angle2 = Visualization::FindVal(angle2F, data->DataVariables()); try { @@ -411,7 +411,7 @@ void DialogSplinePath::Length1Changed() VSplinePoint p = qvariant_cast(item->data(Qt::UserRole)); const QString length1F = ui->plainTextEditLength1F->toPlainText().replace("\n", " "); - const qreal length1 = Visualization::FindLength(length1F, data->PlainVariables()); + const qreal length1 = Visualization::FindLength(length1F, data->DataVariables()); try { @@ -445,7 +445,7 @@ void DialogSplinePath::Length2Changed() VSplinePoint p = qvariant_cast(item->data(Qt::UserRole)); const QString length2F = ui->plainTextEditLength2F->toPlainText().replace("\n", " "); - const qreal length2 = Visualization::FindLength(length2F, data->PlainVariables()); + const qreal length2 = Visualization::FindLength(length2F, data->DataVariables()); try { diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index ee7e0d01e..2d1caa328 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -781,7 +781,7 @@ qreal DialogTool::Eval(const QString &text, bool &flag, QLabel *label, const QSt // Translate to internal look. formula = qApp->TrVars()->FormulaFromUser(formula, qApp->Settings()->GetOsSeparator()); QScopedPointer cal(new Calculator()); - result = cal->EvalFormula(data->PlainVariables(), formula); + result = cal->EvalFormula(data->DataVariables(), formula); if (qIsInf(result) || qIsNaN(result)) { diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp index 97431f1af..38074d721 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp @@ -1317,7 +1317,7 @@ void DialogSeamAllowance::UpdateGrainlineValues() qsFormula.replace("\n", " "); qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator()); Calculator cal; - qreal dVal = cal.EvalFormula(data->PlainVariables(), qsFormula); + qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula); if (qIsInf(dVal) == true || qIsNaN(dVal) == true) { throw qmu::QmuParserError(tr("Infinite/undefined result")); @@ -1399,7 +1399,7 @@ void DialogSeamAllowance::UpdateDetailLabelValues() qsFormula.replace("\n", " "); qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator()); Calculator cal; - qreal dVal = cal.EvalFormula(data->PlainVariables(), qsFormula); + qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula); if (qIsInf(dVal) == true || qIsNaN(dVal) == true) { throw qmu::QmuParserError(tr("Infinite/undefined result")); @@ -1484,7 +1484,7 @@ void DialogSeamAllowance::UpdatePatternLabelValues() qsFormula.replace("\n", " "); qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator()); Calculator cal; - qreal dVal = cal.EvalFormula(data->PlainVariables(), qsFormula); + qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula); if (qIsInf(dVal) == true || qIsNaN(dVal) == true) { throw qmu::QmuParserError(tr("Infinite/undefined result")); diff --git a/src/libs/vtools/tools/vabstracttool.cpp b/src/libs/vtools/tools/vabstracttool.cpp index 6219647dd..2a14a9350 100644 --- a/src/libs/vtools/tools/vabstracttool.cpp +++ b/src/libs/vtools/tools/vabstracttool.cpp @@ -162,7 +162,7 @@ qreal VAbstractTool::CheckFormula(const quint32 &toolId, QString &formula, VCont try { QScopedPointer cal(new Calculator()); - result = cal->EvalFormula(data->PlainVariables(), formula); + result = cal->EvalFormula(data->DataVariables(), formula); if (qIsInf(result) || qIsNaN(result)) { @@ -198,7 +198,7 @@ qreal VAbstractTool::CheckFormula(const quint32 &toolId, QString &formula, VCont * parsing here. */ delete dialog; QScopedPointer cal1(new Calculator()); - result = cal1->EvalFormula(data->PlainVariables(), formula); + result = cal1->EvalFormula(data->DataVariables(), formula); if (qIsInf(result) || qIsNaN(result)) { diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index d6845bd1f..9fcbf2a85 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -1254,7 +1254,7 @@ VPieceItem::MoveTypes VToolSeamAllowance::FindLabelGeometry(const VPatternLabelD } Calculator cal1; - rotationAngle = cal1.EvalFormula(VAbstractTool::data.PlainVariables(), labelData.GetRotation()); + rotationAngle = cal1.EvalFormula(VAbstractTool::data.DataVariables(), labelData.GetRotation()); } catch(qmu::QmuParserError &e) { @@ -1295,12 +1295,12 @@ VPieceItem::MoveTypes VToolSeamAllowance::FindLabelGeometry(const VPatternLabelD const bool widthIsSingle = qmu::QmuTokenParser::IsSingle(labelData.GetLabelWidth()); Calculator cal1; - labelWidth = cal1.EvalFormula(VAbstractTool::data.PlainVariables(), labelData.GetLabelWidth()); + labelWidth = cal1.EvalFormula(VAbstractTool::data.DataVariables(), labelData.GetLabelWidth()); const bool heightIsSingle = qmu::QmuTokenParser::IsSingle(labelData.GetLabelHeight()); Calculator cal2; - labelHeight = cal2.EvalFormula(VAbstractTool::data.PlainVariables(), labelData.GetLabelHeight()); + labelHeight = cal2.EvalFormula(VAbstractTool::data.DataVariables(), labelData.GetLabelHeight()); if (not widthIsSingle || not heightIsSingle) { @@ -1381,7 +1381,7 @@ VPieceItem::MoveTypes VToolSeamAllowance::FindGrainlineGeometry(const VGrainline } Calculator cal1; - rotationAngle = cal1.EvalFormula(VAbstractTool::data.PlainVariables(), geom.GetRotation()); + rotationAngle = cal1.EvalFormula(VAbstractTool::data.DataVariables(), geom.GetRotation()); if (not qmu::QmuTokenParser::IsSingle(geom.GetLength())) { @@ -1389,7 +1389,7 @@ VPieceItem::MoveTypes VToolSeamAllowance::FindGrainlineGeometry(const VGrainline } Calculator cal2; - length = cal2.EvalFormula(VAbstractTool::data.PlainVariables(), geom.GetLength()); + length = cal2.EvalFormula(VAbstractTool::data.DataVariables(), geom.GetLength()); } catch(qmu::QmuParserError &e) { diff --git a/src/libs/vtools/visualization/line/operation/vistoolmove.cpp b/src/libs/vtools/visualization/line/operation/vistoolmove.cpp index 3a62544fc..34f8a3333 100644 --- a/src/libs/vtools/visualization/line/operation/vistoolmove.cpp +++ b/src/libs/vtools/visualization/line/operation/vistoolmove.cpp @@ -137,7 +137,7 @@ QString VisToolMove::Angle() const //--------------------------------------------------------------------------------------------------------------------- void VisToolMove::SetAngle(const QString &expression) { - angle = FindVal(expression, Visualization::data->PlainVariables()); + angle = FindVal(expression, Visualization::data->DataVariables()); } //--------------------------------------------------------------------------------------------------------------------- @@ -155,7 +155,7 @@ qreal VisToolMove::LengthValue() const //--------------------------------------------------------------------------------------------------------------------- void VisToolMove::SetLength(const QString &expression) { - length = FindLength(expression, Visualization::data->PlainVariables()); + length = FindLength(expression, Visualization::data->DataVariables()); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/visualization/line/operation/vistoolrotation.cpp b/src/libs/vtools/visualization/line/operation/vistoolrotation.cpp index 8393bf5c3..75b3cac4a 100644 --- a/src/libs/vtools/visualization/line/operation/vistoolrotation.cpp +++ b/src/libs/vtools/visualization/line/operation/vistoolrotation.cpp @@ -205,7 +205,7 @@ QString VisToolRotation::Angle() const //--------------------------------------------------------------------------------------------------------------------- void VisToolRotation::SetAngle(const QString &expression) { - angle = FindVal(expression, Visualization::data->PlainVariables()); + angle = FindVal(expression, Visualization::data->DataVariables()); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/visualization/line/vistoolalongline.cpp b/src/libs/vtools/visualization/line/vistoolalongline.cpp index eeb3e72b1..52800b171 100644 --- a/src/libs/vtools/visualization/line/vistoolalongline.cpp +++ b/src/libs/vtools/visualization/line/vistoolalongline.cpp @@ -66,7 +66,7 @@ void VisToolAlongLine::setObject2Id(const quint32 &value) //--------------------------------------------------------------------------------------------------------------------- void VisToolAlongLine::setLength(const QString &expression) { - length = FindLength(expression, Visualization::data->PlainVariables()); + length = FindLength(expression, Visualization::data->DataVariables()); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/visualization/line/vistoolbisector.cpp b/src/libs/vtools/visualization/line/vistoolbisector.cpp index 6d12d3366..dca41e367 100644 --- a/src/libs/vtools/visualization/line/vistoolbisector.cpp +++ b/src/libs/vtools/visualization/line/vistoolbisector.cpp @@ -72,7 +72,7 @@ void VisToolBisector::setObject3Id(const quint32 &value) //--------------------------------------------------------------------------------------------------------------------- void VisToolBisector::setLength(const QString &expression) { - length = FindLength(expression, Visualization::data->PlainVariables()); + length = FindLength(expression, Visualization::data->DataVariables()); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/visualization/line/vistoolcurveintersectaxis.cpp b/src/libs/vtools/visualization/line/vistoolcurveintersectaxis.cpp index fdc0ee213..1f595998a 100644 --- a/src/libs/vtools/visualization/line/vistoolcurveintersectaxis.cpp +++ b/src/libs/vtools/visualization/line/vistoolcurveintersectaxis.cpp @@ -105,7 +105,7 @@ QString VisToolCurveIntersectAxis::Angle() const //--------------------------------------------------------------------------------------------------------------------- void VisToolCurveIntersectAxis::SetAngle(const QString &expression) { - angle = FindVal(expression, Visualization::data->PlainVariables()); + angle = FindVal(expression, Visualization::data->DataVariables()); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/visualization/line/vistoolendline.cpp b/src/libs/vtools/visualization/line/vistoolendline.cpp index 561b9ab20..ef1448980 100644 --- a/src/libs/vtools/visualization/line/vistoolendline.cpp +++ b/src/libs/vtools/visualization/line/vistoolendline.cpp @@ -96,7 +96,7 @@ QString VisToolEndLine::Angle() const //--------------------------------------------------------------------------------------------------------------------- void VisToolEndLine::SetAngle(const QString &expression) { - angle = FindVal(expression, Visualization::data->PlainVariables()); + angle = FindVal(expression, Visualization::data->DataVariables()); } //--------------------------------------------------------------------------------------------------------------------- @@ -108,5 +108,5 @@ QString VisToolEndLine::Length() const //--------------------------------------------------------------------------------------------------------------------- void VisToolEndLine::setLength(const QString &expression) { - length = FindLength(expression, Visualization::data->PlainVariables()); + length = FindLength(expression, Visualization::data->DataVariables()); } diff --git a/src/libs/vtools/visualization/line/vistoollineintersectaxis.cpp b/src/libs/vtools/visualization/line/vistoollineintersectaxis.cpp index 01e2b451f..784e487e5 100644 --- a/src/libs/vtools/visualization/line/vistoollineintersectaxis.cpp +++ b/src/libs/vtools/visualization/line/vistoollineintersectaxis.cpp @@ -118,7 +118,7 @@ QString VisToolLineIntersectAxis::Angle() const //--------------------------------------------------------------------------------------------------------------------- void VisToolLineIntersectAxis::SetAngle(const QString &expression) { - angle = FindVal(expression, Visualization::data->PlainVariables()); + angle = FindVal(expression, Visualization::data->DataVariables()); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/visualization/line/vistoolnormal.cpp b/src/libs/vtools/visualization/line/vistoolnormal.cpp index 4efa76db3..3103149bb 100644 --- a/src/libs/vtools/visualization/line/vistoolnormal.cpp +++ b/src/libs/vtools/visualization/line/vistoolnormal.cpp @@ -110,7 +110,7 @@ void VisToolNormal::setObject2Id(const quint32 &value) //--------------------------------------------------------------------------------------------------------------------- void VisToolNormal::setLength(const QString &expression) { - length = FindLength(expression, Visualization::data->PlainVariables()); + length = FindLength(expression, Visualization::data->DataVariables()); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/visualization/line/vistoolpointfromcircleandtangent.cpp b/src/libs/vtools/visualization/line/vistoolpointfromcircleandtangent.cpp index c44834439..e250f75ae 100644 --- a/src/libs/vtools/visualization/line/vistoolpointfromcircleandtangent.cpp +++ b/src/libs/vtools/visualization/line/vistoolpointfromcircleandtangent.cpp @@ -92,7 +92,7 @@ void VisToolPointFromCircleAndTangent::setObject2Id(const quint32 &value) //--------------------------------------------------------------------------------------------------------------------- void VisToolPointFromCircleAndTangent::setCRadius(const QString &value) { - cRadius = FindLength(value, Visualization::data->PlainVariables()); + cRadius = FindLength(value, Visualization::data->DataVariables()); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/visualization/line/vistoolpointofcontact.cpp b/src/libs/vtools/visualization/line/vistoolpointofcontact.cpp index 5190f2e06..650d8fe41 100644 --- a/src/libs/vtools/visualization/line/vistoolpointofcontact.cpp +++ b/src/libs/vtools/visualization/line/vistoolpointofcontact.cpp @@ -112,5 +112,5 @@ void VisToolPointOfContact::setRadiusId(const quint32 &value) //--------------------------------------------------------------------------------------------------------------------- void VisToolPointOfContact::setRadius(const QString &expression) { - radius = FindLength(expression, Visualization::data->PlainVariables()); + radius = FindLength(expression, Visualization::data->DataVariables()); } diff --git a/src/libs/vtools/visualization/line/vistoolpointofintersectioncircles.cpp b/src/libs/vtools/visualization/line/vistoolpointofintersectioncircles.cpp index 43db7d61a..72d796fb4 100644 --- a/src/libs/vtools/visualization/line/vistoolpointofintersectioncircles.cpp +++ b/src/libs/vtools/visualization/line/vistoolpointofintersectioncircles.cpp @@ -111,13 +111,13 @@ void VisToolPointOfIntersectionCircles::setObject2Id(const quint32 &value) //--------------------------------------------------------------------------------------------------------------------- void VisToolPointOfIntersectionCircles::setC1Radius(const QString &value) { - c1Radius = FindLength(value, Visualization::data->PlainVariables()); + c1Radius = FindLength(value, Visualization::data->DataVariables()); } //--------------------------------------------------------------------------------------------------------------------- void VisToolPointOfIntersectionCircles::setC2Radius(const QString &value) { - c2Radius = FindLength(value, Visualization::data->PlainVariables()); + c2Radius = FindLength(value, Visualization::data->DataVariables()); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/visualization/line/vistoolshoulderpoint.cpp b/src/libs/vtools/visualization/line/vistoolshoulderpoint.cpp index ac59f125f..7b0fa2fbd 100644 --- a/src/libs/vtools/visualization/line/vistoolshoulderpoint.cpp +++ b/src/libs/vtools/visualization/line/vistoolshoulderpoint.cpp @@ -129,5 +129,5 @@ void VisToolShoulderPoint::setLineP2Id(const quint32 &value) //--------------------------------------------------------------------------------------------------------------------- void VisToolShoulderPoint::setLength(const QString &expression) { - length = FindLength(expression, Visualization::data->PlainVariables()); + length = FindLength(expression, Visualization::data->DataVariables()); } diff --git a/src/libs/vtools/visualization/path/vistoolarc.cpp b/src/libs/vtools/visualization/path/vistoolarc.cpp index e9ac816c5..df9ca46d0 100644 --- a/src/libs/vtools/visualization/path/vistoolarc.cpp +++ b/src/libs/vtools/visualization/path/vistoolarc.cpp @@ -69,17 +69,17 @@ void VisToolArc::RefreshGeometry() //--------------------------------------------------------------------------------------------------------------------- void VisToolArc::setRadius(const QString &expression) { - radius = FindLength(expression, Visualization::data->PlainVariables()); + radius = FindLength(expression, Visualization::data->DataVariables()); } //--------------------------------------------------------------------------------------------------------------------- void VisToolArc::setF1(const QString &expression) { - f1 = FindVal(expression, Visualization::data->PlainVariables()); + f1 = FindVal(expression, Visualization::data->DataVariables()); } //--------------------------------------------------------------------------------------------------------------------- void VisToolArc::setF2(const QString &expression) { - f2 = FindVal(expression, Visualization::data->PlainVariables()); + f2 = FindVal(expression, Visualization::data->DataVariables()); } diff --git a/src/libs/vtools/visualization/path/vistoolarcwithlength.cpp b/src/libs/vtools/visualization/path/vistoolarcwithlength.cpp index bf975ab5c..622c08272 100644 --- a/src/libs/vtools/visualization/path/vistoolarcwithlength.cpp +++ b/src/libs/vtools/visualization/path/vistoolarcwithlength.cpp @@ -68,17 +68,17 @@ void VisToolArcWithLength::RefreshGeometry() //--------------------------------------------------------------------------------------------------------------------- void VisToolArcWithLength::setRadius(const QString &expression) { - radius = FindLength(expression, Visualization::data->PlainVariables()); + radius = FindLength(expression, Visualization::data->DataVariables()); } //--------------------------------------------------------------------------------------------------------------------- void VisToolArcWithLength::setF1(const QString &expression) { - f1 = FindVal(expression, Visualization::data->PlainVariables()); + f1 = FindVal(expression, Visualization::data->DataVariables()); } //--------------------------------------------------------------------------------------------------------------------- void VisToolArcWithLength::setLength(const QString &expression) { - length = FindLength(expression, Visualization::data->PlainVariables()); + length = FindLength(expression, Visualization::data->DataVariables()); } diff --git a/src/libs/vtools/visualization/path/vistoolcutarc.cpp b/src/libs/vtools/visualization/path/vistoolcutarc.cpp index aefcc26e6..0e6b0472a 100644 --- a/src/libs/vtools/visualization/path/vistoolcutarc.cpp +++ b/src/libs/vtools/visualization/path/vistoolcutarc.cpp @@ -82,5 +82,5 @@ void VisToolCutArc::RefreshGeometry() //--------------------------------------------------------------------------------------------------------------------- void VisToolCutArc::setLength(const QString &expression) { - length = FindLength(expression, Visualization::data->PlainVariables()); + length = FindLength(expression, Visualization::data->DataVariables()); } diff --git a/src/libs/vtools/visualization/path/vistoolcutspline.cpp b/src/libs/vtools/visualization/path/vistoolcutspline.cpp index 818190292..fed4fd8d3 100644 --- a/src/libs/vtools/visualization/path/vistoolcutspline.cpp +++ b/src/libs/vtools/visualization/path/vistoolcutspline.cpp @@ -90,5 +90,5 @@ void VisToolCutSpline::RefreshGeometry() //--------------------------------------------------------------------------------------------------------------------- void VisToolCutSpline::setLength(const QString &expression) { - length = FindLength(expression, Visualization::data->PlainVariables()); + length = FindLength(expression, Visualization::data->DataVariables()); } diff --git a/src/libs/vtools/visualization/path/vistoolcutsplinepath.cpp b/src/libs/vtools/visualization/path/vistoolcutsplinepath.cpp index 5722aef32..3219f3b3a 100644 --- a/src/libs/vtools/visualization/path/vistoolcutsplinepath.cpp +++ b/src/libs/vtools/visualization/path/vistoolcutsplinepath.cpp @@ -91,5 +91,5 @@ void VisToolCutSplinePath::RefreshGeometry() //--------------------------------------------------------------------------------------------------------------------- void VisToolCutSplinePath::setLength(const QString &expression) { - length = FindLength(expression, Visualization::data->PlainVariables()); + length = FindLength(expression, Visualization::data->DataVariables()); } diff --git a/src/libs/vtools/visualization/path/vistoolellipticalarc.cpp b/src/libs/vtools/visualization/path/vistoolellipticalarc.cpp index 3f07a4d50..6d7b1e342 100644 --- a/src/libs/vtools/visualization/path/vistoolellipticalarc.cpp +++ b/src/libs/vtools/visualization/path/vistoolellipticalarc.cpp @@ -65,29 +65,29 @@ void VisToolEllipticalArc::RefreshGeometry() //--------------------------------------------------------------------------------------------------------------------- void VisToolEllipticalArc::setRadius1(const QString &expression) { - radius1 = FindLength(expression, Visualization::data->PlainVariables()); + radius1 = FindLength(expression, Visualization::data->DataVariables()); } //--------------------------------------------------------------------------------------------------------------------- void VisToolEllipticalArc::setRadius2(const QString &expression) { - radius2 = FindLength(expression, Visualization::data->PlainVariables()); + radius2 = FindLength(expression, Visualization::data->DataVariables()); } //--------------------------------------------------------------------------------------------------------------------- void VisToolEllipticalArc::setF1(const QString &expression) { - f1 = FindVal(expression, Visualization::data->PlainVariables()); + f1 = FindVal(expression, Visualization::data->DataVariables()); } //--------------------------------------------------------------------------------------------------------------------- void VisToolEllipticalArc::setF2(const QString &expression) { - f2 = FindVal(expression, Visualization::data->PlainVariables()); + f2 = FindVal(expression, Visualization::data->DataVariables()); } //--------------------------------------------------------------------------------------------------------------------- void VisToolEllipticalArc::setRotationAngle(const QString &expression) { - rotationAngle = FindVal(expression, Visualization::data->PlainVariables()); + rotationAngle = FindVal(expression, Visualization::data->DataVariables()); } diff --git a/src/libs/vtools/visualization/visualization.cpp b/src/libs/vtools/visualization/visualization.cpp index 031025a24..db672f8d0 100644 --- a/src/libs/vtools/visualization/visualization.cpp +++ b/src/libs/vtools/visualization/visualization.cpp @@ -143,13 +143,15 @@ VScaledEllipse *Visualization::InitPoint(const QColor &color, QGraphicsItem *par } //--------------------------------------------------------------------------------------------------------------------- -qreal Visualization::FindLength(const QString &expression, const QHash &vars) +qreal Visualization::FindLength(const QString &expression, + const QHash > *vars) { return qApp->toPixel(FindVal(expression, vars)); } //--------------------------------------------------------------------------------------------------------------------- -qreal Visualization::FindVal(const QString &expression, const QHash &vars) +qreal Visualization::FindVal(const QString &expression, + const QHash > *vars) { qreal val = 0; if (expression.isEmpty()) diff --git a/src/libs/vtools/visualization/visualization.h b/src/libs/vtools/visualization/visualization.h index 523221735..a466e4c8e 100644 --- a/src/libs/vtools/visualization/visualization.h +++ b/src/libs/vtools/visualization/visualization.h @@ -47,6 +47,7 @@ Q_DECLARE_LOGGING_CATEGORY(vVis) class VScaledEllipse; class VScaledLine; class VContainer; +class VInternalVariable; enum class Mode : char {Creation, Show}; @@ -71,8 +72,8 @@ public: Mode GetMode() const; void SetMode(const Mode &value); - static qreal FindLength(const QString &expression, const QHash &vars); - static qreal FindVal(const QString &expression, const QHash &vars); + static qreal FindLength(const QString &expression, const QHash > *vars); + static qreal FindVal(const QString &expression, const QHash > *vars); signals: void ToolTip(const QString &toolTip); public slots: diff --git a/src/test/ValentinaTest/tst_vmeasurements.cpp b/src/test/ValentinaTest/tst_vmeasurements.cpp index 470842c2a..afe75caa2 100644 --- a/src/test/ValentinaTest/tst_vmeasurements.cpp +++ b/src/test/ValentinaTest/tst_vmeasurements.cpp @@ -56,6 +56,8 @@ void TST_VMeasurements::CreateEmptyMultisizeFile() QSharedPointer m = QSharedPointer(new VMeasurements(mUnit, size, height, data.data())); + m->SetSize(VContainer::rsize()); + m->SetHeight(VContainer::rheight()); QTemporaryFile file; QString fileName; @@ -144,6 +146,8 @@ void TST_VMeasurements::ValidPMCodesMultisizeFile() QSharedPointer m = QSharedPointer(new VMeasurements(mUnit, size, height, data.data())); + m->SetSize(VContainer::rsize()); + m->SetHeight(VContainer::rheight()); const QStringList listSystems = ListPMSystems(); for (int i = 0; i < listSystems.size(); ++i)