Code style.
This commit is contained in:
parent
4bf0571dc0
commit
b8872a0319
|
@ -208,7 +208,7 @@ void DialogEndLine::FXLength()
|
||||||
*/
|
*/
|
||||||
void DialogEndLine::ChosenObject(quint32 id, const SceneObject &type)
|
void DialogEndLine::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
{
|
{
|
||||||
if (prepare == false)// After first choose we ignore all objects
|
if (not prepare)// After first choose we ignore all objects
|
||||||
{
|
{
|
||||||
if (type == SceneObject::Point)
|
if (type == SceneObject::Point)
|
||||||
{
|
{
|
||||||
|
@ -218,8 +218,7 @@ void DialogEndLine::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
{
|
{
|
||||||
vis->VisualMode(id);
|
vis->VisualMode(id);
|
||||||
}
|
}
|
||||||
VAbstractMainWindow *window =
|
auto *window = qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||||
qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
|
||||||
SCASSERT(window != nullptr)
|
SCASSERT(window != nullptr)
|
||||||
connect(vis.data(), &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
connect(vis.data(), &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
||||||
prepare = true;
|
prepare = true;
|
||||||
|
@ -267,7 +266,7 @@ void DialogEndLine::SetFormula(const QString &value)
|
||||||
}
|
}
|
||||||
ui->plainTextEditFormula->setPlainText(formulaLength);
|
ui->plainTextEditFormula->setPlainText(formulaLength);
|
||||||
|
|
||||||
VisToolEndLine *line = qobject_cast<VisToolEndLine *>(vis);
|
auto *line = qobject_cast<VisToolEndLine *>(vis);
|
||||||
SCASSERT(line != nullptr)
|
SCASSERT(line != nullptr)
|
||||||
line->setLength(formulaLength);
|
line->setLength(formulaLength);
|
||||||
|
|
||||||
|
@ -291,7 +290,7 @@ void DialogEndLine::SetAngle(const QString &value)
|
||||||
}
|
}
|
||||||
ui->plainTextEditAngle->setPlainText(formulaAngle);
|
ui->plainTextEditAngle->setPlainText(formulaAngle);
|
||||||
|
|
||||||
VisToolEndLine *line = qobject_cast<VisToolEndLine *>(vis);
|
auto *line = qobject_cast<VisToolEndLine *>(vis);
|
||||||
SCASSERT(line != nullptr)
|
SCASSERT(line != nullptr)
|
||||||
line->SetAngle(formulaAngle);
|
line->SetAngle(formulaAngle);
|
||||||
|
|
||||||
|
@ -307,13 +306,13 @@ void DialogEndLine::SetBasePointId(const quint32 &value)
|
||||||
{
|
{
|
||||||
setCurrentPointId(ui->comboBoxBasePoint, value);
|
setCurrentPointId(ui->comboBoxBasePoint, value);
|
||||||
|
|
||||||
VisToolEndLine *line = qobject_cast<VisToolEndLine *>(vis);
|
auto *line = qobject_cast<VisToolEndLine *>(vis);
|
||||||
SCASSERT(line != nullptr)
|
SCASSERT(line != nullptr)
|
||||||
line->setObject1Id(value);
|
line->setObject1Id(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DialogEndLine::GetLineColor() const
|
auto DialogEndLine::GetLineColor() const -> QString
|
||||||
{
|
{
|
||||||
return GetComboBoxCurrentData(ui->comboBoxLineColor, ColorBlack);
|
return GetComboBoxCurrentData(ui->comboBoxLineColor, ColorBlack);
|
||||||
}
|
}
|
||||||
|
@ -344,8 +343,7 @@ void DialogEndLine::ShowDialog(bool click)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*We will ignore click if pointer is in point circle*/
|
/*We will ignore click if pointer is in point circle*/
|
||||||
VMainGraphicsScene *scene =
|
auto *scene = qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
|
||||||
qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
|
|
||||||
SCASSERT(scene != nullptr)
|
SCASSERT(scene != nullptr)
|
||||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
||||||
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
|
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
|
||||||
|
@ -358,7 +356,7 @@ void DialogEndLine::ShowDialog(bool click)
|
||||||
}
|
}
|
||||||
this->setModal(true);
|
this->setModal(true);
|
||||||
|
|
||||||
VisToolEndLine *line = qobject_cast<VisToolEndLine *>(vis);
|
auto *line = qobject_cast<VisToolEndLine *>(vis);
|
||||||
SCASSERT(line != nullptr)
|
SCASSERT(line != nullptr)
|
||||||
|
|
||||||
this->SetAngle(line->Angle());//Show in dialog angle what user choose
|
this->SetAngle(line->Angle());//Show in dialog angle what user choose
|
||||||
|
|
|
@ -327,18 +327,16 @@ void DialogMove::ShowDialog(bool click)
|
||||||
stage1 = false;
|
stage1 = false;
|
||||||
prepare = true;
|
prepare = true;
|
||||||
|
|
||||||
VMainGraphicsScene *scene =
|
auto *scene = qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
|
||||||
qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
|
|
||||||
SCASSERT(scene != nullptr)
|
SCASSERT(scene != nullptr)
|
||||||
scene->clearSelection();
|
scene->clearSelection();
|
||||||
|
|
||||||
VisToolMove *operation = qobject_cast<VisToolMove *>(vis);
|
auto *operation = qobject_cast<VisToolMove *>(vis);
|
||||||
SCASSERT(operation != nullptr)
|
SCASSERT(operation != nullptr)
|
||||||
operation->SetObjects(SourceToObjects(sourceObjects));
|
operation->SetObjects(SourceToObjects(sourceObjects));
|
||||||
operation->VisualMode();
|
operation->VisualMode();
|
||||||
|
|
||||||
VAbstractMainWindow *window =
|
auto *window = qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||||
qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
|
||||||
SCASSERT(window != nullptr)
|
SCASSERT(window != nullptr)
|
||||||
connect(operation, &VisToolMove::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
connect(operation, &VisToolMove::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
||||||
|
|
||||||
|
@ -358,7 +356,7 @@ void DialogMove::ShowDialog(bool click)
|
||||||
}
|
}
|
||||||
else if (not stage2 && not stage1 && prepare && click)
|
else if (not stage2 && not stage1 && prepare && click)
|
||||||
{
|
{
|
||||||
VisToolMove *operation = qobject_cast<VisToolMove *>(vis);
|
auto *operation = qobject_cast<VisToolMove *>(vis);
|
||||||
SCASSERT(operation != nullptr)
|
SCASSERT(operation != nullptr)
|
||||||
|
|
||||||
if (operation->LengthValue() > 0)
|
if (operation->LengthValue() > 0)
|
||||||
|
@ -376,7 +374,7 @@ void DialogMove::ShowDialog(bool click)
|
||||||
}
|
}
|
||||||
else if (not stage1 && stage2 && prepare && click)
|
else if (not stage1 && stage2 && prepare && click)
|
||||||
{
|
{
|
||||||
VisToolMove *operation = qobject_cast<VisToolMove *>(vis);
|
auto *operation = qobject_cast<VisToolMove *>(vis);
|
||||||
SCASSERT(operation != nullptr)
|
SCASSERT(operation != nullptr)
|
||||||
|
|
||||||
if (QGuiApplication::keyboardModifiers() == Qt::ControlModifier)
|
if (QGuiApplication::keyboardModifiers() == Qt::ControlModifier)
|
||||||
|
@ -415,7 +413,7 @@ void DialogMove::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
{
|
{
|
||||||
if (SetObject(id, ui->comboBoxRotationOriginPoint, QString()))
|
if (SetObject(id, ui->comboBoxRotationOriginPoint, QString()))
|
||||||
{
|
{
|
||||||
VisToolMove *operation = qobject_cast<VisToolMove *>(vis);
|
auto *operation = qobject_cast<VisToolMove *>(vis);
|
||||||
SCASSERT(operation != nullptr)
|
SCASSERT(operation != nullptr)
|
||||||
|
|
||||||
operation->SetRotationOriginPointId(id);
|
operation->SetRotationOriginPointId(id);
|
||||||
|
@ -432,7 +430,7 @@ void DialogMove::SelectedObject(bool selected, quint32 object, quint32 tool)
|
||||||
Q_UNUSED(tool)
|
Q_UNUSED(tool)
|
||||||
if (stage1)
|
if (stage1)
|
||||||
{
|
{
|
||||||
auto obj = std::find_if(sourceObjects.begin(), sourceObjects.end(),
|
auto *obj = std::find_if(sourceObjects.begin(), sourceObjects.end(),
|
||||||
[object](const SourceItem &sItem) { return sItem.id == object; });
|
[object](const SourceItem &sItem) { return sItem.id == object; });
|
||||||
if (selected)
|
if (selected)
|
||||||
{
|
{
|
||||||
|
@ -445,7 +443,7 @@ void DialogMove::SelectedObject(bool selected, quint32 object, quint32 tool)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (obj != sourceObjects.end())
|
if (obj != sourceObjects.cend())
|
||||||
{
|
{
|
||||||
sourceObjects.erase(obj);
|
sourceObjects.erase(obj);
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,7 +161,7 @@ void DialogRotation::SetAngle(const QString &value)
|
||||||
}
|
}
|
||||||
ui->plainTextEditFormula->setPlainText(formulaAngle);
|
ui->plainTextEditFormula->setPlainText(formulaAngle);
|
||||||
|
|
||||||
VisToolRotation *operation = qobject_cast<VisToolRotation *>(vis);
|
auto *operation = qobject_cast<VisToolRotation *>(vis);
|
||||||
SCASSERT(operation != nullptr)
|
SCASSERT(operation != nullptr)
|
||||||
operation->SetAngle(formulaAngle);
|
operation->SetAngle(formulaAngle);
|
||||||
|
|
||||||
|
@ -236,12 +236,11 @@ void DialogRotation::ShowDialog(bool click)
|
||||||
|
|
||||||
stage1 = false;
|
stage1 = false;
|
||||||
|
|
||||||
VMainGraphicsScene *scene =
|
auto *scene = qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
|
||||||
qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
|
|
||||||
SCASSERT(scene != nullptr)
|
SCASSERT(scene != nullptr)
|
||||||
scene->clearSelection();
|
scene->clearSelection();
|
||||||
|
|
||||||
VisToolRotation *operation = qobject_cast<VisToolRotation *>(vis);
|
auto *operation = qobject_cast<VisToolRotation *>(vis);
|
||||||
SCASSERT(operation != nullptr)
|
SCASSERT(operation != nullptr)
|
||||||
operation->SetObjects(SourceToObjects(sourceObjects));
|
operation->SetObjects(SourceToObjects(sourceObjects));
|
||||||
operation->VisualMode();
|
operation->VisualMode();
|
||||||
|
@ -273,8 +272,7 @@ void DialogRotation::ShowDialog(bool click)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*We will ignore click if pointer is in point circle*/
|
/*We will ignore click if pointer is in point circle*/
|
||||||
VMainGraphicsScene *scene =
|
auto *scene = qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
|
||||||
qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
|
|
||||||
SCASSERT(scene != nullptr)
|
SCASSERT(scene != nullptr)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -292,7 +290,7 @@ void DialogRotation::ShowDialog(bool click)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VisToolRotation *operation = qobject_cast<VisToolRotation *>(vis);
|
auto *operation = qobject_cast<VisToolRotation *>(vis);
|
||||||
SCASSERT(operation != nullptr)
|
SCASSERT(operation != nullptr)
|
||||||
|
|
||||||
SetAngle(operation->Angle());//Show in dialog angle that a user choose
|
SetAngle(operation->Angle());//Show in dialog angle that a user choose
|
||||||
|
@ -315,7 +313,7 @@ void DialogRotation::SetSourceObjects(const QVector<SourceItem> &value)
|
||||||
sourceObjects = value;
|
sourceObjects = value;
|
||||||
FillSourceList();
|
FillSourceList();
|
||||||
|
|
||||||
VisToolRotation *operation = qobject_cast<VisToolRotation *>(vis);
|
auto *operation = qobject_cast<VisToolRotation *>(vis);
|
||||||
SCASSERT(operation != nullptr)
|
SCASSERT(operation != nullptr)
|
||||||
operation->SetObjects(SourceToObjects(sourceObjects));
|
operation->SetObjects(SourceToObjects(sourceObjects));
|
||||||
}
|
}
|
||||||
|
@ -327,13 +325,13 @@ void DialogRotation::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
{
|
{
|
||||||
if (type == SceneObject::Point)
|
if (type == SceneObject::Point)
|
||||||
{
|
{
|
||||||
VisToolRotation *operation = qobject_cast<VisToolRotation *>(vis);
|
auto *operation = qobject_cast<VisToolRotation *>(vis);
|
||||||
SCASSERT(operation != nullptr)
|
SCASSERT(operation != nullptr)
|
||||||
|
|
||||||
auto obj = std::find_if(sourceObjects.begin(), sourceObjects.end(),
|
auto *obj = std::find_if(sourceObjects.begin(), sourceObjects.end(),
|
||||||
[id](const SourceItem &sItem) { return sItem.id == id; });
|
[id](const SourceItem &sItem) { return sItem.id == id; });
|
||||||
|
|
||||||
if (obj != sourceObjects.end())
|
if (obj != sourceObjects.cend())
|
||||||
{
|
{
|
||||||
if (sourceObjects.size() > 1)
|
if (sourceObjects.size() > 1)
|
||||||
{
|
{
|
||||||
|
@ -351,8 +349,7 @@ void DialogRotation::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
|
|
||||||
if (SetObject(id, ui->comboBoxOriginPoint, QString()))
|
if (SetObject(id, ui->comboBoxOriginPoint, QString()))
|
||||||
{
|
{
|
||||||
VAbstractMainWindow *window =
|
auto *window = qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||||
qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
|
||||||
SCASSERT(window != nullptr)
|
SCASSERT(window != nullptr)
|
||||||
connect(operation, &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
connect(operation, &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
||||||
|
|
||||||
|
@ -371,7 +368,7 @@ void DialogRotation::SelectedObject(bool selected, quint32 object, quint32 tool)
|
||||||
Q_UNUSED(tool)
|
Q_UNUSED(tool)
|
||||||
if (stage1)
|
if (stage1)
|
||||||
{
|
{
|
||||||
auto obj = std::find_if(sourceObjects.begin(), sourceObjects.end(),
|
auto *obj = std::find_if(sourceObjects.begin(), sourceObjects.end(),
|
||||||
[object](const SourceItem &sItem) { return sItem.id == object; });
|
[object](const SourceItem &sItem) { return sItem.id == object; });
|
||||||
if (selected)
|
if (selected)
|
||||||
{
|
{
|
||||||
|
@ -384,7 +381,7 @@ void DialogRotation::SelectedObject(bool selected, quint32 object, quint32 tool)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (obj != sourceObjects.end())
|
if (obj != sourceObjects.cend())
|
||||||
{
|
{
|
||||||
sourceObjects.erase(obj);
|
sourceObjects.erase(obj);
|
||||||
}
|
}
|
||||||
|
@ -401,7 +398,7 @@ void DialogRotation::DeployAngleTextEdit()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogRotation::FXAngle()
|
void DialogRotation::FXAngle()
|
||||||
{
|
{
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
auto *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit angle"));
|
dialog->setWindowTitle(tr("Edit angle"));
|
||||||
dialog->SetFormula(GetAngle());
|
dialog->SetFormula(GetAngle());
|
||||||
dialog->setPostfix(degreeSymbol);
|
dialog->setPostfix(degreeSymbol);
|
||||||
|
@ -415,7 +412,7 @@ void DialogRotation::FXAngle()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogRotation::SuffixChanged()
|
void DialogRotation::SuffixChanged()
|
||||||
{
|
{
|
||||||
QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
|
auto* edit = qobject_cast<QLineEdit*>(sender());
|
||||||
if (edit)
|
if (edit)
|
||||||
{
|
{
|
||||||
const QString suffix = edit->text();
|
const QString suffix = edit->text();
|
||||||
|
@ -433,7 +430,7 @@ void DialogRotation::SuffixChanged()
|
||||||
{
|
{
|
||||||
QRegularExpression rx(NameRegExp());
|
QRegularExpression rx(NameRegExp());
|
||||||
const QStringList uniqueNames = data->AllUniqueNames();
|
const QStringList uniqueNames = data->AllUniqueNames();
|
||||||
for (auto &uniqueName : uniqueNames)
|
for (const auto &uniqueName : uniqueNames)
|
||||||
{
|
{
|
||||||
const QString name = uniqueName + suffix;
|
const QString name = uniqueName + suffix;
|
||||||
if (not rx.match(name).hasMatch() || not data->IsUnique(name))
|
if (not rx.match(name).hasMatch() || not data->IsUnique(name))
|
||||||
|
@ -457,7 +454,7 @@ void DialogRotation::SuffixChanged()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogRotation::GroupNameChanged()
|
void DialogRotation::GroupNameChanged()
|
||||||
{
|
{
|
||||||
QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
|
auto* edit = qobject_cast<QLineEdit*>(sender());
|
||||||
if (edit)
|
if (edit)
|
||||||
{
|
{
|
||||||
const QString name = edit->text();
|
const QString name = edit->text();
|
||||||
|
@ -500,7 +497,7 @@ void DialogRotation::SaveData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VisToolRotation *operation = qobject_cast<VisToolRotation *>(vis);
|
auto *operation = qobject_cast<VisToolRotation *>(vis);
|
||||||
SCASSERT(operation != nullptr)
|
SCASSERT(operation != nullptr)
|
||||||
|
|
||||||
operation->SetObjects(SourceToObjects(sourceObjects));
|
operation->SetObjects(SourceToObjects(sourceObjects));
|
||||||
|
@ -533,11 +530,11 @@ void DialogRotation::PointChanged()
|
||||||
{
|
{
|
||||||
quint32 id = getCurrentObjectId(ui->comboBoxOriginPoint);
|
quint32 id = getCurrentObjectId(ui->comboBoxOriginPoint);
|
||||||
|
|
||||||
auto obj = std::find_if(sourceObjects.begin(), sourceObjects.end(),
|
auto *obj = std::find_if(sourceObjects.begin(), sourceObjects.end(),
|
||||||
[id](const SourceItem &sItem) { return sItem.id == id; });
|
[id](const SourceItem &sItem) { return sItem.id == id; });
|
||||||
|
|
||||||
QColor color;
|
QColor color;
|
||||||
if (obj != sourceObjects.end())
|
if (obj != sourceObjects.cend())
|
||||||
{
|
{
|
||||||
flagError = false;
|
flagError = false;
|
||||||
color = errorColor;
|
color = errorColor;
|
||||||
|
@ -601,12 +598,10 @@ void DialogRotation::ValidateSourceAliases()
|
||||||
CheckState();
|
CheckState();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
SetAliasValid(sourceItem.id, true);
|
SetAliasValid(sourceItem.id, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
flagAlias = true;
|
flagAlias = true;
|
||||||
CheckState();
|
CheckState();
|
||||||
|
|
|
@ -99,7 +99,7 @@ void VisToolEndLine::RefreshGeometry()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VisToolEndLine::Angle() const
|
QString VisToolEndLine::Angle() const
|
||||||
{
|
{
|
||||||
return QString("%1").arg(this->line().angle());
|
return QString::number(this->line().angle());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue
Block a user