From 037d1daaaa6c2bf9b590a7b23560df8413413df1 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 15 Nov 2017 15:25:05 +0200 Subject: [PATCH] Fix bug in dialog Seam allowance tool. When create a piece and call a context menu Valentina blocks creating because of wrong formulas. --HG-- branch : develop --- .../tools/piece/dialogseamallowance.cpp | 60 +++++++++++-------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp index 2dc6f9f25..f0c5781a9 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp @@ -969,8 +969,8 @@ void DialogSeamAllowance::NodeChanged(int index) } else { - uiTabPaths->plainTextEditFormulaWidthBefore->setPlainText(""); - uiTabPaths->plainTextEditFormulaWidthAfter->setPlainText(""); + uiTabPaths->plainTextEditFormulaWidthBefore->setPlainText(currentSeamAllowance); + uiTabPaths->plainTextEditFormulaWidthAfter->setPlainText(currentSeamAllowance); uiTabPaths->comboBoxAngle->setCurrentIndex(-1); } uiTabPaths->comboBoxAngle->blockSignals(false); @@ -2038,27 +2038,33 @@ void DialogSeamAllowance::EvalWidth() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::EvalWidthBefore() { - labelEditFormula = uiTabPaths->labelEditBefore; - const QString postfix = UnitsToStr(qApp->patternUnit(), true); - const QString formula = uiTabPaths->plainTextEditFormulaWidthBefore->toPlainText(); - Eval(formula, flagFormulaBefore, uiTabPaths->labelResultBefore, postfix, false, true); + if (uiTabPaths->checkBoxSeams->isChecked()) + { + labelEditFormula = uiTabPaths->labelEditBefore; + const QString postfix = UnitsToStr(qApp->patternUnit(), true); + const QString formula = uiTabPaths->plainTextEditFormulaWidthBefore->toPlainText(); + Eval(formula, flagFormulaBefore, uiTabPaths->labelResultBefore, postfix, false, true); - const QString formulaSABefore = GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidthBefore); - UpdateNodeSABefore(formulaSABefore); - EnableDefButton(uiTabPaths->pushButtonDefBefore, formulaSABefore); + const QString formulaSABefore = GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidthBefore); + UpdateNodeSABefore(formulaSABefore); + EnableDefButton(uiTabPaths->pushButtonDefBefore, formulaSABefore); + } } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::EvalWidthAfter() { - labelEditFormula = uiTabPaths->labelEditAfter; - const QString postfix = UnitsToStr(qApp->patternUnit(), true); - const QString formula = uiTabPaths->plainTextEditFormulaWidthAfter->toPlainText(); - Eval(formula, flagFormulaAfter, uiTabPaths->labelResultAfter, postfix, false, true); + if (uiTabPaths->checkBoxSeams->isChecked()) + { + labelEditFormula = uiTabPaths->labelEditAfter; + const QString postfix = UnitsToStr(qApp->patternUnit(), true); + const QString formula = uiTabPaths->plainTextEditFormulaWidthAfter->toPlainText(); + Eval(formula, flagFormulaAfter, uiTabPaths->labelResultAfter, postfix, false, true); - const QString formulaSAAfter = GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidthAfter); - UpdateNodeSAAfter(formulaSAAfter); - EnableDefButton(uiTabPaths->pushButtonDefAfter, formulaSAAfter); + const QString formulaSAAfter = GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidthAfter); + UpdateNodeSAAfter(formulaSAAfter); + EnableDefButton(uiTabPaths->pushButtonDefAfter, formulaSAAfter); + } } //--------------------------------------------------------------------------------------------------------------------- @@ -2118,19 +2124,25 @@ void DialogSeamAllowance::WidthChanged() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::WidthBeforeChanged() { - labelEditFormula = uiTabPaths->labelEditBefore; - labelResultCalculation = uiTabPaths->labelResultBefore; - const QString postfix = UnitsToStr(qApp->patternUnit(), true); - ValFormulaChanged(flagFormulaBefore, uiTabPaths->plainTextEditFormulaWidthBefore, m_timerWidthBefore, postfix); + if (uiTabPaths->checkBoxSeams->isChecked()) + { + labelEditFormula = uiTabPaths->labelEditBefore; + labelResultCalculation = uiTabPaths->labelResultBefore; + const QString postfix = UnitsToStr(qApp->patternUnit(), true); + ValFormulaChanged(flagFormulaBefore, uiTabPaths->plainTextEditFormulaWidthBefore, m_timerWidthBefore, postfix); + } } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::WidthAfterChanged() { - labelEditFormula = uiTabPaths->labelEditAfter; - labelResultCalculation = uiTabPaths->labelResultAfter; - const QString postfix = UnitsToStr(qApp->patternUnit(), true); - ValFormulaChanged(flagFormulaAfter, uiTabPaths->plainTextEditFormulaWidthAfter, m_timerWidthAfter, postfix); + if (uiTabPaths->checkBoxSeams->isChecked()) + { + labelEditFormula = uiTabPaths->labelEditAfter; + labelResultCalculation = uiTabPaths->labelResultAfter; + const QString postfix = UnitsToStr(qApp->patternUnit(), true); + ValFormulaChanged(flagFormulaAfter, uiTabPaths->plainTextEditFormulaWidthAfter, m_timerWidthAfter, postfix); + } } //---------------------------------------------------------------------------------------------------------------------