From b36e4e2cf860b5ec1c9274a8dfe133e15b898811 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 20 Dec 2018 17:54:54 +0200 Subject: [PATCH] Fixed issue #913. Unable to save changes for piece path if it doesn't contain a point. --HG-- branch : release --- ChangeLog.txt | 1 + .../dialogs/tools/piece/dialogpiecepath.cpp | 54 ++++++++++++------- .../tools/piece/dialogseamallowance.cpp | 42 ++++++++++----- 3 files changed, 67 insertions(+), 30 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 8fce60202..b13fd9bae 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -3,6 +3,7 @@ - [#905] Valentina crashes with error: This id is not unique. - [#909] Valentina produces wrong united path. - [#912] Labels in inactive state return to initial color. +- [#913] Unable to save changes for piece path if it doesn't contain a point. # Version 0.6.1 October 23, 2018 - [#885] Regression. Broken support for multi size measurements. diff --git a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp index 933bc129b..747e773b3 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp @@ -748,34 +748,52 @@ void DialogPiecePath::EvalWidth() void DialogPiecePath::EvalWidthBefore() { labelEditFormula = ui->labelEditBefore; - const QString postfix = UnitsToStr(qApp->patternUnit(), true); - QString formula = ui->plainTextEditFormulaWidthBefore->toPlainText(); - Eval(formula, m_flagFormulaBefore, ui->labelResultBefore, postfix, false, true); - - formula = GetFormulaSAWidthBefore(); - if (formula != currentSeamAllowance) + if (ui->comboBoxNodes->count() > 0) { - ui->pushButtonDefBefore->setEnabled(true); - } + const QString postfix = UnitsToStr(qApp->patternUnit(), true); + QString formula = ui->plainTextEditFormulaWidthBefore->toPlainText(); + Eval(formula, m_flagFormulaBefore, ui->labelResultBefore, postfix, false, true); - UpdateNodeSABefore(formula); + formula = GetFormulaSAWidthBefore(); + if (formula != currentSeamAllowance) + { + ui->pushButtonDefBefore->setEnabled(true); + } + + UpdateNodeSABefore(formula); + } + else + { + ChangeColor(labelEditFormula, okColor); + ui->labelResultBefore->setText(tr("")); + m_flagFormulaBefore = true; + } } //--------------------------------------------------------------------------------------------------------------------- void DialogPiecePath::EvalWidthAfter() { labelEditFormula = ui->labelEditAfter; - const QString postfix = UnitsToStr(qApp->patternUnit(), true); - QString formula = ui->plainTextEditFormulaWidthAfter->toPlainText(); - Eval(formula, m_flagFormulaAfter, ui->labelResultAfter, postfix, false, true); - - formula = GetFormulaSAWidthAfter(); - if (formula != currentSeamAllowance) + if (ui->comboBoxNodes->count() > 0) { - ui->pushButtonDefAfter->setEnabled(true); - } + const QString postfix = UnitsToStr(qApp->patternUnit(), true); + QString formula = ui->plainTextEditFormulaWidthAfter->toPlainText(); + Eval(formula, m_flagFormulaAfter, ui->labelResultAfter, postfix, false, true); - UpdateNodeSAAfter(formula); + formula = GetFormulaSAWidthAfter(); + if (formula != currentSeamAllowance) + { + ui->pushButtonDefAfter->setEnabled(true); + } + + UpdateNodeSAAfter(formula); + } + else + { + ChangeColor(labelEditFormula, okColor); + ui->labelResultAfter->setText(tr("")); + m_flagFormulaAfter = true; + } } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp index c698a8b18..652900888 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp @@ -2079,13 +2079,22 @@ void DialogSeamAllowance::EvalWidthBefore() 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); + if (uiTabPaths->comboBoxNodes->count() > 0) + { + 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); + } + else + { + ChangeColor(labelEditFormula, okColor); + uiTabPaths->labelResultBefore->setText(tr("")); + flagFormulaBefore = true; + } } } @@ -2095,13 +2104,22 @@ void DialogSeamAllowance::EvalWidthAfter() 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); + if (uiTabPaths->comboBoxNodes->count() > 0) + { + 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); + } + else + { + ChangeColor(labelEditFormula, okColor); + uiTabPaths->labelResultAfter->setText(tr("")); + flagFormulaAfter = true; + } } }