Fix bug with Default button.
--HG-- branch : develop
This commit is contained in:
parent
b09cad8c42
commit
16871a0466
|
@ -40,6 +40,20 @@
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QtNumeric>
|
#include <QtNumeric>
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void EnableDefButton(QPushButton *defButton, const QString &formula)
|
||||||
|
{
|
||||||
|
SCASSERT(defButton != nullptr)
|
||||||
|
|
||||||
|
if (formula != currentSeamAllowance)
|
||||||
|
{
|
||||||
|
defButton->setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||||
: DialogTool(data, toolId, parent),
|
: DialogTool(data, toolId, parent),
|
||||||
|
@ -635,10 +649,7 @@ void DialogSeamAllowance::NodeChanged(int index)
|
||||||
ui->toolButtonExprBefore->setEnabled(true);
|
ui->toolButtonExprBefore->setEnabled(true);
|
||||||
|
|
||||||
QString w1Formula = node.GetFormulaSABefore();
|
QString w1Formula = node.GetFormulaSABefore();
|
||||||
if (w1Formula != currentSeamAllowance)
|
EnableDefButton(ui->pushButtonDefBefore, w1Formula);
|
||||||
{
|
|
||||||
ui->pushButtonDefBefore->setEnabled(true);
|
|
||||||
}
|
|
||||||
w1Formula = qApp->TrVars()->FormulaToUser(w1Formula, qApp->Settings()->GetOsSeparator());
|
w1Formula = qApp->TrVars()->FormulaToUser(w1Formula, qApp->Settings()->GetOsSeparator());
|
||||||
if (w1Formula.length() > 80)// increase height if needed.
|
if (w1Formula.length() > 80)// increase height if needed.
|
||||||
{
|
{
|
||||||
|
@ -652,10 +663,7 @@ void DialogSeamAllowance::NodeChanged(int index)
|
||||||
ui->toolButtonExprAfter->setEnabled(true);
|
ui->toolButtonExprAfter->setEnabled(true);
|
||||||
|
|
||||||
QString w2Formula = node.GetFormulaSAAfter();
|
QString w2Formula = node.GetFormulaSAAfter();
|
||||||
if (w2Formula != currentSeamAllowance)
|
EnableDefButton(ui->pushButtonDefAfter, w2Formula);
|
||||||
{
|
|
||||||
ui->pushButtonDefAfter->setEnabled(true);
|
|
||||||
}
|
|
||||||
w2Formula = qApp->TrVars()->FormulaToUser(w2Formula, qApp->Settings()->GetOsSeparator());
|
w2Formula = qApp->TrVars()->FormulaToUser(w2Formula, qApp->Settings()->GetOsSeparator());
|
||||||
if (w2Formula.length() > 80)// increase height if needed.
|
if (w2Formula.length() > 80)// increase height if needed.
|
||||||
{
|
{
|
||||||
|
@ -787,12 +795,20 @@ void DialogSeamAllowance::NodeAngleChanged(int index)
|
||||||
void DialogSeamAllowance::ReturnDefBefore()
|
void DialogSeamAllowance::ReturnDefBefore()
|
||||||
{
|
{
|
||||||
ui->plainTextEditFormulaWidthBefore->setPlainText(currentSeamAllowance);
|
ui->plainTextEditFormulaWidthBefore->setPlainText(currentSeamAllowance);
|
||||||
|
if (QPushButton* button = qobject_cast<QPushButton*>(sender()))
|
||||||
|
{
|
||||||
|
button->setEnabled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::ReturnDefAfter()
|
void DialogSeamAllowance::ReturnDefAfter()
|
||||||
{
|
{
|
||||||
ui->plainTextEditFormulaWidthAfter->setPlainText(currentSeamAllowance);
|
ui->plainTextEditFormulaWidthAfter->setPlainText(currentSeamAllowance);
|
||||||
|
if (QPushButton* button = qobject_cast<QPushButton*>(sender()))
|
||||||
|
{
|
||||||
|
button->setEnabled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1111,7 +1127,9 @@ void DialogSeamAllowance::EvalWidthBefore()
|
||||||
bool flagFormula = false; // fake flag
|
bool flagFormula = false; // fake flag
|
||||||
Eval(formula, flagFormula, ui->labelResultBefore, postfix, false, true);
|
Eval(formula, flagFormula, ui->labelResultBefore, postfix, false, true);
|
||||||
|
|
||||||
UpdateNodeSABefore(GetFormulaSAWidthBefore());
|
const QString formulaSABefore = GetFormulaSAWidthBefore();
|
||||||
|
UpdateNodeSABefore(formulaSABefore);
|
||||||
|
EnableDefButton(ui->pushButtonDefBefore, formulaSABefore);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1123,7 +1141,9 @@ void DialogSeamAllowance::EvalWidthAfter()
|
||||||
bool flagFormula = false; // fake flag
|
bool flagFormula = false; // fake flag
|
||||||
Eval(formula, flagFormula, ui->labelResultAfter, postfix, false, true);
|
Eval(formula, flagFormula, ui->labelResultAfter, postfix, false, true);
|
||||||
|
|
||||||
UpdateNodeSAAfter(GetFormulaSAWidthAfter());
|
const QString formulaSAAfter = GetFormulaSAWidthAfter();
|
||||||
|
UpdateNodeSAAfter(formulaSAAfter);
|
||||||
|
EnableDefButton(ui->pushButtonDefAfter, formulaSAAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue
Block a user