If formula is empty set to default value.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-03-13 15:00:32 +02:00
parent c6d19c3b9b
commit ce1c96528e
2 changed files with 63 additions and 16 deletions

View File

@ -2461,8 +2461,13 @@ QVector<T> DialogSeamAllowance::GetPieceInternals(const QListWidget *list) const
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::SetGrainlineAngle(const QString &angleFormula)
void DialogSeamAllowance::SetGrainlineAngle(QString angleFormula)
{
if (angleFormula.isEmpty())
{
angleFormula = QString("0");
}
const QString formula = qApp->TrVars()->FormulaToUser(angleFormula, qApp->Settings()->GetOsSeparator());
// increase height if needed.
if (formula.length() > 80)
@ -2475,98 +2480,140 @@ void DialogSeamAllowance::SetGrainlineAngle(const QString &angleFormula)
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::SetGrainlineLength(const QString &lengthFormula)
void DialogSeamAllowance::SetGrainlineLength(QString lengthFormula)
{
if (lengthFormula.isEmpty())
{
lengthFormula = QString().setNum(UnitConvertor(1, Unit::Cm, *data->GetPatternUnit()));
}
const QString formula = qApp->TrVars()->FormulaToUser(lengthFormula, qApp->Settings()->GetOsSeparator());
// increase height if needed.
if (formula.length() > 80)
{
this->DeployGrainlineLength();
}
ui->lineEditLenFormula->setPlainText(formula);
MoveCursorToEnd(ui->lineEditLenFormula);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::SetDLWidth(const QString &widthFormula)
void DialogSeamAllowance::SetDLWidth(QString widthFormula)
{
if (widthFormula.isEmpty())
{
widthFormula = QString().setNum(UnitConvertor(1, Unit::Cm, *data->GetPatternUnit()));
}
const QString formula = qApp->TrVars()->FormulaToUser(widthFormula, qApp->Settings()->GetOsSeparator());
// increase height if needed.
if (formula.length() > 80)
{
this->DeployDLWidth();
}
ui->lineEditDLWidthFormula->setPlainText(formula);
MoveCursorToEnd(ui->lineEditDLWidthFormula);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::SetDLHeight(const QString &heightFormula)
void DialogSeamAllowance::SetDLHeight(QString heightFormula)
{
if (heightFormula.isEmpty())
{
heightFormula = QString().setNum(UnitConvertor(1, Unit::Cm, *data->GetPatternUnit()));
}
const QString formula = qApp->TrVars()->FormulaToUser(heightFormula, qApp->Settings()->GetOsSeparator());
// increase height if needed.
if (formula.length() > 80)
{
this->DeployDLHeight();
}
ui->lineEditDLHeightFormula->setPlainText(formula);
MoveCursorToEnd(ui->lineEditDLHeightFormula);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::SetDLAngle(const QString &angleFormula)
void DialogSeamAllowance::SetDLAngle(QString angleFormula)
{
if (angleFormula.isEmpty())
{
angleFormula = QString("0");
}
const QString formula = qApp->TrVars()->FormulaToUser(angleFormula, qApp->Settings()->GetOsSeparator());
// increase height if needed.
if (formula.length() > 80)
{
this->DeployDLAngle();
}
ui->lineEditDLAngleFormula->setPlainText(formula);
MoveCursorToEnd(ui->lineEditDLAngleFormula);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::SetPLWidth(const QString &widthFormula)
void DialogSeamAllowance::SetPLWidth(QString widthFormula)
{
if (widthFormula.isEmpty())
{
widthFormula = QString().setNum(UnitConvertor(1, Unit::Cm, *data->GetPatternUnit()));
}
const QString formula = qApp->TrVars()->FormulaToUser(widthFormula, qApp->Settings()->GetOsSeparator());
// increase height if needed.
if (formula.length() > 80)
{
this->DeployPLWidth();
}
ui->lineEditPLWidthFormula->setPlainText(formula);
MoveCursorToEnd(ui->lineEditPLWidthFormula);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::SetPLHeight(const QString &heightFormula)
void DialogSeamAllowance::SetPLHeight(QString heightFormula)
{
if (heightFormula.isEmpty())
{
heightFormula = QString().setNum(UnitConvertor(1, Unit::Cm, *data->GetPatternUnit()));
}
const QString formula = qApp->TrVars()->FormulaToUser(heightFormula, qApp->Settings()->GetOsSeparator());
// increase height if needed.
if (formula.length() > 80)
{
this->DeployPLHeight();
}
ui->lineEditPLHeightFormula->setPlainText(formula);
MoveCursorToEnd(ui->lineEditPLHeightFormula);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::SetPLAngle(const QString &angleFormula)
void DialogSeamAllowance::SetPLAngle(QString angleFormula)
{
if (angleFormula.isEmpty())
{
angleFormula = QString("0");
}
const QString formula = qApp->TrVars()->FormulaToUser(angleFormula, qApp->Settings()->GetOsSeparator());
// increase height if needed.
if (formula.length() > 80)
{
this->DeployPLAngle();
}
ui->lineEditPLAngleFormula->setPlainText(formula);
MoveCursorToEnd(ui->lineEditPLAngleFormula);

View File

@ -230,16 +230,16 @@ private:
template <typename T>
QVector<T> GetPieceInternals(const QListWidget *list) const;
void SetGrainlineAngle(const QString &angleFormula);
void SetGrainlineLength(const QString &lengthFormula);
void SetGrainlineAngle(QString angleFormula);
void SetGrainlineLength(QString lengthFormula);
void SetDLWidth(const QString &widthFormula);
void SetDLHeight(const QString &heightFormula);
void SetDLAngle(const QString &angleFormula);
void SetDLWidth(QString widthFormula);
void SetDLHeight(QString heightFormula);
void SetDLAngle(QString angleFormula);
void SetPLWidth(const QString &widthFormula);
void SetPLHeight(const QString &heightFormula);
void SetPLAngle(const QString &angleFormula);
void SetPLWidth(QString widthFormula);
void SetPLHeight(QString heightFormula);
void SetPLAngle(QString angleFormula);
};
#endif // DIALOGSEAMALLOWANCE_H