Fix incorrect saving grainline angle and length.
--HG-- branch : feature
This commit is contained in:
parent
93a59b9371
commit
38740f7ef8
|
@ -238,16 +238,12 @@ void VLayoutPiece::SetGrainline(const VGrainlineData& geom, const VContainer& rP
|
|||
|
||||
try
|
||||
{
|
||||
QString qsFormula = geom.GetRotation().replace("\n", " ");
|
||||
qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator());
|
||||
Calculator cal1;
|
||||
dAng = cal1.EvalFormula(rPattern.PlainVariables(), qsFormula);
|
||||
dAng = cal1.EvalFormula(rPattern.PlainVariables(), geom.GetRotation());
|
||||
dAng = qDegreesToRadians(dAng);
|
||||
|
||||
qsFormula = geom.GetLength().replace("\n", " ");
|
||||
qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator());
|
||||
Calculator cal2;
|
||||
dLen = cal2.EvalFormula(rPattern.PlainVariables(), qsFormula);
|
||||
dLen = cal2.EvalFormula(rPattern.PlainVariables(), geom.GetLength());
|
||||
dLen = ToPixel(dLen, *rPattern.GetPatternUnit());
|
||||
}
|
||||
catch(qmu::QmuParserError &e)
|
||||
|
|
|
@ -213,8 +213,8 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
|||
UpdateList();
|
||||
|
||||
ui->groupBoxGrainline->setChecked(piece.GetGrainlineGeometry().IsVisible());
|
||||
ui->lineEditRotFormula->setPlainText(piece.GetGrainlineGeometry().GetRotation());
|
||||
ui->lineEditLenFormula->setPlainText(piece.GetGrainlineGeometry().GetLength());
|
||||
SetGrainlineAngle(piece.GetGrainlineGeometry());
|
||||
SetGrainlineLength(piece.GetGrainlineGeometry());
|
||||
ui->comboBoxArrow->setCurrentIndex(int(piece.GetGrainlineGeometry().GetArrowType()));
|
||||
|
||||
m_oldData = piece.GetPatternPieceData();
|
||||
|
@ -1989,3 +1989,31 @@ QVector<T> DialogSeamAllowance::GetPieceInternals(const QListWidget *list) const
|
|||
}
|
||||
return internals;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::SetGrainlineAngle(const VGrainlineData &data)
|
||||
{
|
||||
const QString formula = qApp->TrVars()->FormulaToUser(data.GetRotation(), qApp->Settings()->GetOsSeparator());
|
||||
// increase height if needed.
|
||||
if (formula.length() > 80)
|
||||
{
|
||||
this->DeployRotation();
|
||||
}
|
||||
ui->lineEditRotFormula->setPlainText(formula);
|
||||
|
||||
MoveCursorToEnd(ui->lineEditRotFormula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::SetGrainlineLength(const VGrainlineData &data)
|
||||
{
|
||||
const QString formula = qApp->TrVars()->FormulaToUser(data.GetLength(), qApp->Settings()->GetOsSeparator());
|
||||
// increase height if needed.
|
||||
if (formula.length() > 80)
|
||||
{
|
||||
this->DeployLength();
|
||||
}
|
||||
ui->lineEditLenFormula->setPlainText(formula);
|
||||
|
||||
MoveCursorToEnd(ui->lineEditLenFormula);
|
||||
}
|
||||
|
|
|
@ -198,6 +198,8 @@ private:
|
|||
|
||||
template <typename T>
|
||||
QVector<T> GetPieceInternals(const QListWidget *list) const;
|
||||
void SetGrainlineAngle(const VGrainlineData &data);
|
||||
void SetGrainlineLength(const VGrainlineData &data);
|
||||
};
|
||||
|
||||
#endif // DIALOGSEAMALLOWANCE_H
|
||||
|
|
|
@ -353,7 +353,7 @@ void DialogTool::ChangeCurrentData(QComboBox *box, const QVariant &value) const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogTool::MoveCursorToEnd(QPlainTextEdit *plainTextEdit)
|
||||
void DialogTool::MoveCursorToEnd(QPlainTextEdit *plainTextEdit) const
|
||||
{
|
||||
SCASSERT(plainTextEdit != nullptr)
|
||||
QTextCursor cursor = plainTextEdit->textCursor();
|
||||
|
|
|
@ -262,7 +262,7 @@ protected:
|
|||
* @brief SaveData Put dialog data in local variables
|
||||
*/
|
||||
virtual void SaveData() {}
|
||||
void MoveCursorToEnd(QPlainTextEdit *plainTextEdit);
|
||||
void MoveCursorToEnd(QPlainTextEdit *plainTextEdit) const;
|
||||
virtual bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
|
||||
quint32 DNumber(const QString &baseName) const;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user