Fixed issue "Rotation tool - Cannot edit formula after creation".

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-05-24 13:29:13 +03:00
parent b7b1ea3db7
commit 66cc34ed64
2 changed files with 20 additions and 11 deletions

View File

@ -48,7 +48,8 @@ DialogRotation::DialogRotation(const VContainer *data, const quint32 &toolId, QW
formulaAngle(), formulaAngle(),
formulaBaseHeightAngle(0), formulaBaseHeightAngle(0),
objects(), objects(),
stage1(true) stage1(true),
m_suffix()
{ {
ui->setupUi(this); ui->setupUi(this);
@ -126,12 +127,13 @@ void DialogRotation::SetAngle(const QString &value)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString DialogRotation::GetSuffix() const QString DialogRotation::GetSuffix() const
{ {
return ui->lineEditSuffix->text(); return m_suffix;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogRotation::SetSuffix(const QString &value) void DialogRotation::SetSuffix(const QString &value)
{ {
m_suffix = value;
ui->lineEditSuffix->setText(value); ui->lineEditSuffix->setText(value);
} }
@ -289,17 +291,20 @@ void DialogRotation::SuffixChanged()
} }
else else
{ {
QRegularExpression rx(NameRegExp()); if (m_suffix != suffix)
const QStringList uniqueNames = data->AllUniqueNames();
for (int i=0; i < uniqueNames.size(); ++i)
{ {
const QString name = uniqueNames.at(i) + suffix; QRegularExpression rx(NameRegExp());
if (not rx.match(name).hasMatch() || not data->IsUnique(name)) const QStringList uniqueNames = data->AllUniqueNames();
for (int i=0; i < uniqueNames.size(); ++i)
{ {
flagName = false; const QString name = uniqueNames.at(i) + suffix;
ChangeColor(ui->labelSuffix, Qt::red); if (not rx.match(name).hasMatch() || not data->IsUnique(name))
CheckState(); {
return; flagName = false;
ChangeColor(ui->labelSuffix, Qt::red);
CheckState();
return;
}
} }
} }
} }
@ -328,6 +333,8 @@ void DialogRotation::ShowVisualization()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogRotation::SaveData() void DialogRotation::SaveData()
{ {
m_suffix = ui->lineEditSuffix->text();
formulaAngle = ui->plainTextEditFormula->toPlainText(); formulaAngle = ui->plainTextEditFormula->toPlainText();
formulaAngle.replace("\n", " "); formulaAngle.replace("\n", " ");

View File

@ -98,6 +98,8 @@ private:
bool stage1; bool stage1;
QString m_suffix;
void EvalAngle(); void EvalAngle();
}; };