From 9600364c050fca1693319775252dda8292fa063c Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 2 May 2024 13:47:29 +0300 Subject: [PATCH] Refactoring. Replace the redundant type with "auto". --- src/libs/ifc/xml/vabstractpattern.cpp | 7 ++-- src/libs/qmuparser/qmuparsertest.cpp | 2 +- src/libs/vformat/vmeasurements.cpp | 2 +- src/libs/vgeometry/vabstractcurve.cpp | 2 +- src/libs/vgeometry/vgobject.cpp | 4 +-- src/libs/vlayout/vabstractpiece.cpp | 10 +++--- src/libs/vlayout/vlayoutpiece.cpp | 2 +- src/libs/vmisc/crashhandler/vcrashpaths.cpp | 4 +-- src/libs/vmisc/vabstractapplication.cpp | 4 +-- src/libs/vmisc/vcommonsettings.cpp | 2 +- src/libs/vpatterndb/vpassmark.cpp | 34 +++++++++---------- src/libs/vtools/dialogs/tools/dialogarc.cpp | 2 +- .../dialogs/tools/dialogarcwithlength.cpp | 2 +- .../tools/dialogcurveintersectaxis.cpp | 2 +- .../dialogs/tools/dialogellipticalarc.cpp | 2 +- .../vtools/dialogs/tools/dialogendline.cpp | 2 +- .../dialogs/tools/dialoglineintersectaxis.cpp | 2 +- .../tools/dialogpointfromcircleandtangent.cpp | 2 +- .../vtools/dialogs/tools/dialogrotation.cpp | 2 +- .../toollinepoint/vtoolalongline.cpp | 2 +- .../toollinepoint/vtoolendline.cpp | 2 +- .../toollinepoint/vtoollineintersectaxis.cpp | 2 +- .../toollinepoint/vtoolshoulderpoint.cpp | 6 ++-- src/libs/vtools/tools/vtooluniondetails.cpp | 4 +-- .../vtools/visualization/line/visline.cpp | 8 ++--- .../visualization/line/vistoolnormal.cpp | 4 +-- .../line/vistoolshoulderpoint.cpp | 4 +-- .../vtools/visualization/path/vistoolarc.cpp | 2 +- .../path/vistoolarcwithlength.cpp | 2 +- src/test/ValentinaTest/tst_vpointf.cpp | 4 +-- 30 files changed, 64 insertions(+), 65 deletions(-) diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 46bbab718..00cba6bd3 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -799,8 +799,7 @@ auto VAbstractPattern::ParseSANode(const QDomElement &domElement) -> VPieceNode VDomDocument::GetParametrString(domElement, VAbstractPattern::AttrSABefore, currentSeamAllowance); const QString saAfter = VDomDocument::GetParametrString(domElement, VAbstractPattern::AttrSAAfter, currentSeamAllowance); - const PieceNodeAngle angle = - static_cast(VDomDocument::GetParametrUInt(domElement, AttrAngle, QChar('0'))); + const auto angle = static_cast(VDomDocument::GetParametrUInt(domElement, AttrAngle, QChar('0'))); const bool passmark = VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrNodePassmark, falseStr); const PassmarkLineType passmarkLine = StringToPassmarkLineType( @@ -1510,7 +1509,7 @@ void VAbstractPattern::DeleteBackgroundImage(const QUuid &id) const QDomElement imageElement = imageNode.toElement(); if (not imageElement.isNull()) { - QUuid const imageId = QUuid(GetParametrEmptyString(imageElement, AttrImageId)); + auto const imageId = QUuid(GetParametrEmptyString(imageElement, AttrImageId)); if (imageId == id) { imagesTag.removeChild(imageElement); @@ -2272,7 +2271,7 @@ auto VAbstractPattern::GetBackgroundImageElement(const QUuid &id) const -> QDomE const QDomElement imageElement = imageNode.toElement(); if (not imageElement.isNull()) { - QUuid const imageId = QUuid(GetParametrEmptyString(imageElement, AttrImageId)); + auto const imageId = QUuid(GetParametrEmptyString(imageElement, AttrImageId)); if (imageId == id) { return imageElement; diff --git a/src/libs/qmuparser/qmuparsertest.cpp b/src/libs/qmuparser/qmuparsertest.cpp index 26f683d28..ab553c91e 100644 --- a/src/libs/qmuparser/qmuparsertest.cpp +++ b/src/libs/qmuparser/qmuparsertest.cpp @@ -504,7 +504,7 @@ auto QmuParserTester::TestVarConst() -> int // 4 used variables p.SetExpr("a+b+c+d"); qmu::varmap_type UsedVar = p.GetUsedVar(); - int iCount = static_cast(UsedVar.size()); + auto iCount = static_cast(UsedVar.size()); if (iCount != 4) { throw false; diff --git a/src/libs/vformat/vmeasurements.cpp b/src/libs/vformat/vmeasurements.cpp index 3681b1338..061b06bba 100644 --- a/src/libs/vformat/vmeasurements.cpp +++ b/src/libs/vformat/vmeasurements.cpp @@ -1017,7 +1017,7 @@ auto VMeasurements::DimensionTypeToStr(const MeasurementDimension &type) -> QStr //--------------------------------------------------------------------------------------------------------------------- auto VMeasurements::StrToDimensionType(const QString &type) -> MeasurementDimension { - const QStringList dimensions = QStringList{DimensionX, DimensionY, DimensionW, DimensionZ}; + const auto dimensions = QStringList{DimensionX, DimensionY, DimensionW, DimensionZ}; switch (dimensions.indexOf(type)) { case 1: // DimensionY diff --git a/src/libs/vgeometry/vabstractcurve.cpp b/src/libs/vgeometry/vabstractcurve.cpp index e451d63cf..aeba22abc 100644 --- a/src/libs/vgeometry/vabstractcurve.cpp +++ b/src/libs/vgeometry/vabstractcurve.cpp @@ -496,7 +496,7 @@ auto VAbstractCurve::CurveIntersectAxis(const QPointF &point, qreal angle, const rec.translate(-INT_MAX / 2.0, -INT_MAX / 2.0); // Instead of using axis compare two rays. See issue #963. - QLineF axis = QLineF(point, VGObject::BuildRay(point, angle, rec)); + auto axis = QLineF(point, VGObject::BuildRay(point, angle, rec)); QVector points = VAbstractCurve::CurveIntersectLine(curvePoints, axis); axis = QLineF(point, VGObject::BuildRay(point, angle + 180, rec)); diff --git a/src/libs/vgeometry/vgobject.cpp b/src/libs/vgeometry/vgobject.cpp index 193845471..5f6d4ca44 100644 --- a/src/libs/vgeometry/vgobject.cpp +++ b/src/libs/vgeometry/vgobject.cpp @@ -299,7 +299,7 @@ auto VGObject::ToJson() const -> QJsonObject //--------------------------------------------------------------------------------------------------------------------- auto VGObject::BuildLine(const QPointF &p1, const qreal &length, const qreal &angle) -> QLineF { - QLineF line = QLineF(); + QLineF line; line.setP1(p1); line.setAngle(angle); // First set angle then length. Length can have negative value. line.setLength(length); @@ -696,7 +696,7 @@ auto VGObject::FlippingMatrix(const QLineF &axis) -> QTransform return matrix; } - const QLineF axisOX = QLineF(axis.x2(), axis.y2(), axis.x2() + 100, axis.y2()); // Ox axis + const auto axisOX = QLineF(axis.x2(), axis.y2(), axis.x2() + 100, axis.y2()); // Ox axis const qreal angle = axis.angleTo(axisOX); const QPointF p2 = axis.p2(); diff --git a/src/libs/vlayout/vabstractpiece.cpp b/src/libs/vlayout/vabstractpiece.cpp index 8620a6915..106333d24 100644 --- a/src/libs/vlayout/vabstractpiece.cpp +++ b/src/libs/vlayout/vabstractpiece.cpp @@ -327,7 +327,7 @@ auto AngleByFirstSymmetry(const QVector &points, QPointF p1, QPoint *needRollback = false; } - const QLineF axis = QLineF(p1, p2); + const auto axis = QLineF(p1, p2); QLineF const sEdge(VPointF::FlipPF(axis, bigLine2.p1()), VPointF::FlipPF(axis, bigLine2.p2())); @@ -408,7 +408,7 @@ auto AngleBySecondSymmetry(const QVector &points, QPointF p1, QPoin *needRollback = false; } - const QLineF axis = QLineF(p3, p2); + const auto axis = QLineF(p3, p2); QLineF const sEdge(VPointF::FlipPF(axis, bigLine1.p1()), VPointF::FlipPF(axis, bigLine1.p2())); @@ -755,7 +755,7 @@ void RollbackByLength(QVector &ekvPoints, const QVector & //--------------------------------------------------------------------------------------------------------------------- void RollbackBySecondEdgeSymmetry(QVector &ekvPoints, const QVector &points, qreal width) { - const QLineF axis = QLineF(points.at(points.size() - 1), points.at(1)); + const auto axis = QLineF(points.at(points.size() - 1), points.at(1)); const QLineF bigLine1 = VAbstractPiece::ParallelLine(points.at(points.size() - 2), points.at(0), width); QLineF const sEdge(VPointF::FlipPF(axis, bigLine1.p1()), VPointF::FlipPF(axis, bigLine1.p2())); @@ -772,7 +772,7 @@ void RollbackBySecondEdgeSymmetry(QVector &ekvPoints, const QVector //--------------------------------------------------------------------------------------------------------------------- void RollbackByFirstEdgeSymmetry(QVector &ekvPoints, const QVector &points, qreal width) { - const QLineF axis = QLineF(points.at(points.size() - 2), points.at(points.size() - 1)); + const auto axis = QLineF(points.at(points.size() - 2), points.at(points.size() - 1)); const QLineF bigLine2 = VAbstractPiece::ParallelLine(points.at(points.size() - 1), points.at(1), width); QLineF const sEdge(VPointF::FlipPF(axis, bigLine2.p1()), VPointF::FlipPF(axis, bigLine2.p2())); const QLineF bigLine1 = VAbstractPiece::ParallelLine(points.at(points.size() - 2), points.at(0), width); @@ -1625,7 +1625,7 @@ void VAbstractPiece::SetUUID(const QUuid &uuid) //--------------------------------------------------------------------------------------------------------------------- void VAbstractPiece::SetUUID(const QString &uuid) { - const QUuid temp = QUuid(uuid); + const auto temp = QUuid(uuid); d->m_uuid = temp.isNull() ? QUuid::createUuid() : temp; } diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index 7a00c9560..63de4253d 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -1269,7 +1269,7 @@ void VLayoutPiece::Mirror(const QLineF &edge) return; } - const QLineF axis = QLineF(edge.x2(), edge.y2(), edge.x2() + 100, edge.y2()); // Ox axis + const auto axis = QLineF(edge.x2(), edge.y2(), edge.x2() + 100, edge.y2()); // Ox axis const qreal angle = edge.angleTo(axis); const QPointF p2 = edge.p2(); diff --git a/src/libs/vmisc/crashhandler/vcrashpaths.cpp b/src/libs/vmisc/crashhandler/vcrashpaths.cpp index 28e13a1f4..6e58e45d3 100644 --- a/src/libs/vmisc/crashhandler/vcrashpaths.cpp +++ b/src/libs/vmisc/crashhandler/vcrashpaths.cpp @@ -55,9 +55,9 @@ auto LogDirPath(const QString &appName) -> QString #endif } #if defined(Q_OS_WINDOWS) - QString path = QStringList{logDirPath, logs}.join(QDir::separator()); + auto path = QStringList{logDirPath, logs}.join(QDir::separator()); #else - QString path = QStringList{logDirPath, VER_COMPANYNAME_STR, logs, appName}.join(QDir::separator()); + auto path = QStringList{logDirPath, VER_COMPANYNAME_STR, logs, appName}.join(QDir::separator()); #endif return path; } diff --git a/src/libs/vmisc/vabstractapplication.cpp b/src/libs/vmisc/vabstractapplication.cpp index a9869f0e9..c89b6a8af 100644 --- a/src/libs/vmisc/vabstractapplication.cpp +++ b/src/libs/vmisc/vabstractapplication.cpp @@ -662,9 +662,9 @@ auto VAbstractApplication::LogDirPath() -> QString #endif } #if defined(Q_OS_WINDOWS) - QString path = QStringList{logDirPath, logs}.join(QDir::separator()); + auto path = QStringList{logDirPath, logs}.join(QDir::separator()); #else - QString path = + auto path = QStringList{logDirPath, QCoreApplication::organizationName(), logs, QCoreApplication::applicationName()}.join( QDir::separator()); #endif diff --git a/src/libs/vmisc/vcommonsettings.cpp b/src/libs/vmisc/vcommonsettings.cpp index 6ed17934e..475794415 100644 --- a/src/libs/vmisc/vcommonsettings.cpp +++ b/src/libs/vmisc/vcommonsettings.cpp @@ -347,7 +347,7 @@ void VCommonSettings::SetPathCustomImage(const QString &value) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetDefPathSVGFonts() -> QString { - QString const defPath = QStringList{QDir::homePath(), "Valentina"_L1, "Svg fonts"_L1}.join(QDir::separator()); + auto const defPath = QStringList{QDir::homePath(), "Valentina"_L1, "Svg fonts"_L1}.join(QDir::separator()); #if defined(Q_OS_WIN) QString const docPath = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); diff --git a/src/libs/vpatterndb/vpassmark.cpp b/src/libs/vpatterndb/vpassmark.cpp index 56602539c..b5eb5ea48 100644 --- a/src/libs/vpatterndb/vpassmark.cpp +++ b/src/libs/vpatterndb/vpassmark.cpp @@ -82,7 +82,7 @@ auto PointsToSegments(const QVector &points) -> QVector lines.reserve(points.size() - 1); for (int i = 0; i < points.size() - 1; ++i) { - QLineF const segment = QLineF(points.at(i), points.at(i + 1)); + auto const segment = QLineF(points.at(i), points.at(i + 1)); if (segment.length() > 0) { lines.append(segment); @@ -183,7 +183,7 @@ auto PassmarkWidth(const VPiecePassmarkData &passmarkData, qreal width) -> qreal //--------------------------------------------------------------------------------------------------------------------- auto FixNotchPoint(const QVector &seamAllowance, const VPiecePassmarkData &data, QPointF *notch) -> bool { - QLineF axis = QLineF(data.passmarkSAPoint, *notch); + auto axis = QLineF(data.passmarkSAPoint, *notch); if (data.passmarkAngleType == PassmarkAngleType::Straightforward) { @@ -274,7 +274,7 @@ auto CreateTwoPassmarkLines(const VPiecePassmarkData &passmarkData, const QLineF QPointF l1p2; { - QLineF line1 = QLineF(line.p2(), line.p1()); + auto line1 = QLineF(line.p2(), line.p1()); line1.setAngle(line1.angle() - 90); line1.setLength(width / 2.); l1p2 = line1.p2(); @@ -282,7 +282,7 @@ auto CreateTwoPassmarkLines(const VPiecePassmarkData &passmarkData, const QLineF QPointF l2p2; { - QLineF line2 = QLineF(line.p2(), line.p1()); + auto line2 = QLineF(line.p2(), line.p1()); line2.setAngle(line2.angle() + 90); line2.setLength(width / 2.); l2p2 = line2.p2(); @@ -321,7 +321,7 @@ auto CreateThreePassmarkLines(const VPiecePassmarkData &passmarkData, const QLin QPointF l1p2; { - QLineF line1 = QLineF(line.p2(), line.p1()); + auto line1 = QLineF(line.p2(), line.p1()); line1.setAngle(line1.angle() - 90); line1.setLength(width / 2.); l1p2 = line1.p2(); @@ -329,7 +329,7 @@ auto CreateThreePassmarkLines(const VPiecePassmarkData &passmarkData, const QLin QPointF l2p2; { - QLineF line2 = QLineF(line.p2(), line.p1()); + auto line2 = QLineF(line.p2(), line.p1()); line2.setAngle(line2.angle() + 90); line2.setLength(width / 2.); l2p2 = line2.p2(); @@ -353,7 +353,7 @@ auto CreateTMarkPassmark(const VPiecePassmarkData &passmarkData, const QLineF &l QPointF p1; { - QLineF tmpLine = QLineF(line.p2(), line.p1()); + auto tmpLine = QLineF(line.p2(), line.p1()); tmpLine.setAngle(tmpLine.angle() - 90); tmpLine.setLength(width / 2.); p1 = tmpLine.p2(); @@ -361,7 +361,7 @@ auto CreateTMarkPassmark(const VPiecePassmarkData &passmarkData, const QLineF &l QPointF p2; { - QLineF tmpLine = QLineF(line.p2(), line.p1()); + auto tmpLine = QLineF(line.p2(), line.p1()); tmpLine.setAngle(tmpLine.angle() + 90); tmpLine.setLength(width / 2.); p2 = tmpLine.p2(); @@ -396,11 +396,11 @@ auto CreateInternalVMarkPassmark(const VPiecePassmarkData &passmarkData, const Q const qreal width = PassmarkWidth(passmarkData, defWidth * 2.); const qreal angle = qRadiansToDegrees(qAtan(qAbs(width) / 2. / line.length())); - QLineF l1 = QLineF(line.p2(), line.p1()); + auto l1 = QLineF(line.p2(), line.p1()); l1.setAngle(l1.angle() + angle); l1 = VPassmark::FindIntersection(l1, seamAllowance); - QLineF l2 = QLineF(line.p2(), line.p1()); + auto l2 = QLineF(line.p2(), line.p1()); l2.setAngle(l2.angle() - angle); return {{l1.p2(), l1.p1()}, VPassmark::FindIntersection(l2, seamAllowance)}; @@ -439,7 +439,7 @@ auto CreateUMarkPassmark(const VPiecePassmarkData &passmarkData, const QLineF &l QPointF l1p2; { - QLineF line = QLineF(baseLine.p2(), baseLine.p1()); + auto line = QLineF(baseLine.p2(), baseLine.p1()); line.setAngle(line.angle() + 90); line.setLength(radius); l1p2 = line.p2(); @@ -447,7 +447,7 @@ auto CreateUMarkPassmark(const VPiecePassmarkData &passmarkData, const QLineF &l QPointF l2p2; { - QLineF line = QLineF(baseLine.p2(), baseLine.p1()); + auto line = QLineF(baseLine.p2(), baseLine.p1()); line.setAngle(line.angle() - 90); line.setLength(radius); l2p2 = line.p2(); @@ -497,7 +497,7 @@ auto CreateBoxMarkPassmark(const VPiecePassmarkData &passmarkData, const QLineF QPointF l1p2; { - QLineF tmp = QLineF(line.p2(), line.p1()); + auto tmp = QLineF(line.p2(), line.p1()); tmp.setAngle(tmp.angle() + 90); tmp.setLength(width / 2.); l1p2 = tmp.p2(); @@ -513,7 +513,7 @@ auto CreateBoxMarkPassmark(const VPiecePassmarkData &passmarkData, const QLineF QPointF l2p2; { - QLineF tmp = QLineF(line.p2(), line.p1()); + auto tmp = QLineF(line.p2(), line.p1()); tmp.setAngle(tmp.angle() - 90); tmp.setLength(width / 2.); l2p2 = tmp.p2(); @@ -783,7 +783,7 @@ auto VPassmark::PassmarkStraightforwardBaseLine(const QPointF &seamPassmarkSAPoi return {}; } - QLineF line = QLineF(seamPassmarkSAPoint, m_data.passmarkSAPoint); + auto line = QLineF(seamPassmarkSAPoint, m_data.passmarkSAPoint); line.setLength(length); return {line}; } @@ -952,8 +952,8 @@ auto VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const -> QVector< } } - QLineF edge1 = QLineF(m_data.passmarkSAPoint, m_data.previousSAPoint); - QLineF const edge2 = QLineF(m_data.passmarkSAPoint, m_data.nextSAPoint); + auto edge1 = QLineF(m_data.passmarkSAPoint, m_data.previousSAPoint); + auto const edge2 = QLineF(m_data.passmarkSAPoint, m_data.nextSAPoint); edge1.setAngle(edge1.angle() + edge1.angleTo(edge2) / 2.); edge1.setLength(length); diff --git a/src/libs/vtools/dialogs/tools/dialogarc.cpp b/src/libs/vtools/dialogs/tools/dialogarc.cpp index dd5dad911..f1ec8195f 100644 --- a/src/libs/vtools/dialogs/tools/dialogarc.cpp +++ b/src/libs/vtools/dialogs/tools/dialogarc.cpp @@ -269,7 +269,7 @@ void DialogArc::ShowDialog(bool click) auto *scene = qobject_cast(VAbstractValApplication::VApp()->getCurrentScene()); SCASSERT(scene != nullptr) const QSharedPointer point = data->GeometricObject(GetCenter()); - QLineF const line = QLineF(static_cast(*point), scene->getScenePos()); + auto const line = QLineF(static_cast(*point), scene->getScenePos()); auto Angle = [&line]() { diff --git a/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp b/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp index 4e4b03c3f..755259a44 100644 --- a/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp +++ b/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp @@ -296,7 +296,7 @@ void DialogArcWithLength::ShowDialog(bool click) auto *scene = qobject_cast(VAbstractValApplication::VApp()->getCurrentScene()); SCASSERT(scene != nullptr) const QSharedPointer point = data->GeometricObject(GetCenter()); - QLineF const line = QLineF(static_cast(*point), scene->getScenePos()); + auto const line = QLineF(static_cast(*point), scene->getScenePos()); auto Angle = [&line]() { diff --git a/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp b/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp index c83d351e8..8d77b80b3 100644 --- a/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp @@ -232,7 +232,7 @@ void DialogCurveIntersectAxis::ShowDialog(bool click) auto *scene = qobject_cast(VAbstractValApplication::VApp()->getCurrentScene()); SCASSERT(scene != nullptr) const QSharedPointer point = data->GeometricObject(GetBasePointId()); - QLineF const line = QLineF(static_cast(*point), scene->getScenePos()); + auto const line = QLineF(static_cast(*point), scene->getScenePos()); // Radius of point circle, but little bigger. Need handle with hover sizes. if (line.length() <= ScaledRadius(SceneScale(VAbstractValApplication::VApp()->getCurrentScene())) * 1.5) diff --git a/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp b/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp index 233544849..51b3210dd 100644 --- a/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp +++ b/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp @@ -590,7 +590,7 @@ void DialogEllipticalArc::ShowDialog(bool click) SCASSERT(scene != nullptr) const QSharedPointer center = data->GeometricObject(GetCenter()); - QLineF line = QLineF(static_cast(*center), scene->getScenePos()); + auto line = QLineF(static_cast(*center), scene->getScenePos()); auto Angle = [&line]() { diff --git a/src/libs/vtools/dialogs/tools/dialogendline.cpp b/src/libs/vtools/dialogs/tools/dialogendline.cpp index e4a40033e..ef9855919 100644 --- a/src/libs/vtools/dialogs/tools/dialogendline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogendline.cpp @@ -344,7 +344,7 @@ void DialogEndLine::ShowDialog(bool click) auto *scene = qobject_cast(VAbstractValApplication::VApp()->getCurrentScene()); SCASSERT(scene != nullptr) const QSharedPointer point = data->GeometricObject(GetBasePointId()); - QLineF const line = QLineF(static_cast(*point), scene->getScenePos()); + auto const line = QLineF(static_cast(*point), scene->getScenePos()); // Radius of point circle, but little bigger. Need handle with hover sizes. if (line.length() <= ScaledRadius(SceneScale(VAbstractValApplication::VApp()->getCurrentScene())) * 1.5) diff --git a/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp b/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp index 21dc7dbf6..d856bdd91 100644 --- a/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp +++ b/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp @@ -255,7 +255,7 @@ void DialogLineIntersectAxis::ShowDialog(bool click) auto *scene = qobject_cast(VAbstractValApplication::VApp()->getCurrentScene()); SCASSERT(scene != nullptr) const QSharedPointer point = data->GeometricObject(GetBasePointId()); - QLineF const line = QLineF(static_cast(*point), scene->getScenePos()); + auto const line = QLineF(static_cast(*point), scene->getScenePos()); // Radius of point circle, but little bigger. Need handle with hover sizes. if (line.length() <= ScaledRadius(SceneScale(VAbstractValApplication::VApp()->getCurrentScene())) * 1.5) diff --git a/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp b/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp index d424fb326..42f0ea6f9 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp @@ -223,7 +223,7 @@ void DialogPointFromCircleAndTangent::ShowDialog(bool click) auto *scene = qobject_cast(VAbstractValApplication::VApp()->getCurrentScene()); SCASSERT(scene != nullptr) const QSharedPointer center = data->GeometricObject(GetCircleCenterId()); - QLineF const line = QLineF(static_cast(*center), scene->getScenePos()); + auto const line = QLineF(static_cast(*center), scene->getScenePos()); SetCircleRadius(QString::number(FromPixel(line.length(), *data->GetPatternUnit()))); } diff --git a/src/libs/vtools/dialogs/tools/dialogrotation.cpp b/src/libs/vtools/dialogs/tools/dialogrotation.cpp index d58eaf6af..3d15c81f0 100644 --- a/src/libs/vtools/dialogs/tools/dialogrotation.cpp +++ b/src/libs/vtools/dialogs/tools/dialogrotation.cpp @@ -277,7 +277,7 @@ void DialogRotation::ShowDialog(bool click) try { const QSharedPointer point = data->GeometricObject(GetOrigPointId()); - const QLineF line = QLineF(static_cast(*point), scene->getScenePos()); + const auto line = QLineF(static_cast(*point), scene->getScenePos()); // Radius of point circle, but little bigger. Need handle with hover sizes. if (line.length() <= ScaledRadius(SceneScale(VAbstractValApplication::VApp()->getCurrentScene())) * 1.5) diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp index 7255dcbf3..7367a9faf 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp @@ -272,7 +272,7 @@ auto VToolAlongLine::Create(VToolAlongLineInitData &initData) -> VToolAlongLine { const QSharedPointer firstPoint = initData.data->GeometricObject(initData.firstPointId); const QSharedPointer secondPoint = initData.data->GeometricObject(initData.secondPointId); - QLineF line = QLineF(static_cast(*firstPoint), static_cast(*secondPoint)); + auto line = QLineF(static_cast(*firstPoint), static_cast(*secondPoint)); // Declare special variable "CurrentLength" auto *length = new VLengthLine(firstPoint.data(), initData.firstPointId, secondPoint.data(), initData.secondPointId, diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp index 636cabac5..f62b81843 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp @@ -133,7 +133,7 @@ auto VToolEndLine::Create(const QPointer &dialog, VMainGraphicsScene auto VToolEndLine::Create(VToolEndLineInitData &initData) -> VToolEndLine * { const QSharedPointer basePoint = initData.data->GeometricObject(initData.basePointId); - QLineF line = QLineF(static_cast(*basePoint), QPointF(basePoint->x() + 100, basePoint->y())); + auto line = QLineF(static_cast(*basePoint), QPointF(basePoint->x() + 100, basePoint->y())); line.setAngle(CheckFormula(initData.id, initData.formulaAngle, initData.data)); // First set angle. line.setLength( diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp index 914f3d00b..32ea75a25 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp @@ -120,7 +120,7 @@ auto VToolLineIntersectAxis::Create(const QPointer &dialog, VMainGra auto VToolLineIntersectAxis::Create(VToolLineIntersectAxisInitData &initData) -> VToolLineIntersectAxis * { const QSharedPointer basePoint = initData.data->GeometricObject(initData.basePointId); - QLineF axis = QLineF(static_cast(*basePoint), QPointF(basePoint->x() + 100, basePoint->y())); + auto axis = QLineF(static_cast(*basePoint), QPointF(basePoint->x() + 100, basePoint->y())); axis.setAngle(CheckFormula(initData.id, initData.formulaAngle, initData.data)); const QSharedPointer firstPoint = initData.data->GeometricObject(initData.firstPointId); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp index bab3b19e9..be5c34a3b 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp @@ -114,7 +114,7 @@ auto VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Line, return shoulderPoint; } - QLineF line = QLineF(p1Line, p2Line); + auto line = QLineF(p1Line, p2Line); const qreal baseLength = line.length(); const int baseAngle = qRound(line.angle()); line.setLength(length * 2); @@ -126,8 +126,8 @@ auto VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Line, if (res == 1 || res == 2) { - const QLineF line1 = QLineF(p1Line, p1); - const QLineF line2 = QLineF(p1Line, p2); + const auto line1 = QLineF(p1Line, p1); + const auto line2 = QLineF(p1Line, p2); if (line1.length() > baseLength && baseAngle == qRound(line1.angle())) { shoulderPoint = p1; diff --git a/src/libs/vtools/tools/vtooluniondetails.cpp b/src/libs/vtools/tools/vtooluniondetails.cpp index 1be2c299c..5ea4947f5 100644 --- a/src/libs/vtools/tools/vtooluniondetails.cpp +++ b/src/libs/vtools/tools/vtooluniondetails.cpp @@ -375,8 +375,8 @@ void UnionInitParameters(const VToolUnionDetailsInitData &initData, const VPiece point4.setX(point4.x() + dx); point4.setY(point4.y() + dy); - const QLineF p4p3 = QLineF(static_cast(point4), static_cast(point3)); - const QLineF p1p2 = QLineF(static_cast(point1), static_cast(point2)); + const auto p4p3 = QLineF(static_cast(point4), static_cast(point3)); + const auto p1p2 = QLineF(static_cast(point1), static_cast(point2)); angle = p4p3.angleTo(p1p2); } diff --git a/src/libs/vtools/visualization/line/visline.cpp b/src/libs/vtools/visualization/line/visline.cpp index fc2dc31db..b87a19fcd 100644 --- a/src/libs/vtools/visualization/line/visline.cpp +++ b/src/libs/vtools/visualization/line/visline.cpp @@ -83,7 +83,7 @@ auto VisLine::Ray(const QPointF &firstPoint, const qreal &angle) const -> QPoint { if (this->scene() == nullptr) { - QLineF line = QLineF(firstPoint, ScenePos()); + auto line = QLineF(firstPoint, ScenePos()); line.setAngle(angle); return line.p2(); // We can't find ray because item doesn't have scene. We will return cursor position on scene. } @@ -91,10 +91,10 @@ auto VisLine::Ray(const QPointF &firstPoint, const qreal &angle) const -> QPoint QRectF scRect = this->scene()->sceneRect(); // Limit size of the scene rect. Axis that has same size as scene rect cause scene size growth. - QLineF line1 = QLineF(scRect.topLeft(), scRect.bottomRight()); + auto line1 = QLineF(scRect.topLeft(), scRect.bottomRight()); line1.setLength(2); - QLineF line2 = QLineF(scRect.bottomRight(), scRect.topLeft()); + auto line2 = QLineF(scRect.bottomRight(), scRect.topLeft()); line2.setLength(2); scRect = QRectF(line1.p2(), line2.p2()); @@ -110,7 +110,7 @@ auto VisLine::Ray(const QPointF &firstPoint, const qreal &angle) const -> QPoint //--------------------------------------------------------------------------------------------------------------------- auto VisLine::Ray(const QPointF &firstPoint) const -> QPointF { - QLineF const line = QLineF(firstPoint, ScenePos()); + auto const line = QLineF(firstPoint, ScenePos()); return Ray(firstPoint, line.angle()); } diff --git a/src/libs/vtools/visualization/line/vistoolnormal.cpp b/src/libs/vtools/visualization/line/vistoolnormal.cpp index bc20a6df8..00ea87807 100644 --- a/src/libs/vtools/visualization/line/vistoolnormal.cpp +++ b/src/libs/vtools/visualization/line/vistoolnormal.cpp @@ -82,7 +82,7 @@ void VisToolNormal::RefreshGeometry() { QPointF const fPoint = VToolNormal::FindPoint(static_cast(*first), static_cast(*second), m_length, m_angle); - QLineF const mainLine = QLineF(static_cast(*first), fPoint); + auto const mainLine = QLineF(static_cast(*first), fPoint); DrawLine(this, mainLine, LineStyle()); DrawPoint(m_point, mainLine.p2()); @@ -101,7 +101,7 @@ void VisToolNormal::RefreshGeometry() QPointF const fPoint = VToolNormal::FindPoint(static_cast(*first), static_cast(*second), len, m_angle); - QLineF const mainLine = QLineF(static_cast(*first), fPoint); + auto const mainLine = QLineF(static_cast(*first), fPoint); DrawLine(this, mainLine, LineStyle()); DrawPoint(m_point, mainLine.p2()); diff --git a/src/libs/vtools/visualization/line/vistoolshoulderpoint.cpp b/src/libs/vtools/visualization/line/vistoolshoulderpoint.cpp index e0b6a29f6..8da73f610 100644 --- a/src/libs/vtools/visualization/line/vistoolshoulderpoint.cpp +++ b/src/libs/vtools/visualization/line/vistoolshoulderpoint.cpp @@ -92,7 +92,7 @@ void VisToolShoulderPoint::RefreshGeometry() QPointF const fPoint = VToolShoulderPoint::FindPoint(static_cast(*second), static_cast(*third), static_cast(*first), m_length); - QLineF const mainLine = QLineF(static_cast(*second), fPoint); + auto const mainLine = QLineF(static_cast(*second), fPoint); DrawLine(this, mainLine, LineStyle()); DrawPoint(m_point, mainLine.p2()); @@ -105,7 +105,7 @@ void VisToolShoulderPoint::RefreshGeometry() qreal const len = cursorLine.length(); QPointF const fPoint = VToolShoulderPoint::FindPoint( static_cast(*second), static_cast(*third), static_cast(*first), len); - QLineF const mainLine = QLineF(static_cast(*second), fPoint); + auto const mainLine = QLineF(static_cast(*second), fPoint); DrawLine(this, mainLine, LineStyle()); DrawPoint(m_point, mainLine.p2()); diff --git a/src/libs/vtools/visualization/path/vistoolarc.cpp b/src/libs/vtools/visualization/path/vistoolarc.cpp index fb3f0906e..bf8714e66 100644 --- a/src/libs/vtools/visualization/path/vistoolarc.cpp +++ b/src/libs/vtools/visualization/path/vistoolarc.cpp @@ -65,7 +65,7 @@ void VisToolArc::RefreshGeometry() if (GetMode() == Mode::Creation) { - QLineF const r = QLineF(static_cast(*first), ScenePos()); + auto const r = QLineF(static_cast(*first), ScenePos()); auto Angle = [&r]() { diff --git a/src/libs/vtools/visualization/path/vistoolarcwithlength.cpp b/src/libs/vtools/visualization/path/vistoolarcwithlength.cpp index 9c7d6dbf7..5630f9ba0 100644 --- a/src/libs/vtools/visualization/path/vistoolarcwithlength.cpp +++ b/src/libs/vtools/visualization/path/vistoolarcwithlength.cpp @@ -63,7 +63,7 @@ void VisToolArcWithLength::RefreshGeometry() if (GetMode() == Mode::Creation) { - QLineF const r = QLineF(static_cast(*first), ScenePos()); + auto const r = QLineF(static_cast(*first), ScenePos()); auto Angle = [&r]() { diff --git a/src/test/ValentinaTest/tst_vpointf.cpp b/src/test/ValentinaTest/tst_vpointf.cpp index 16eb062bb..452e2d827 100644 --- a/src/test/ValentinaTest/tst_vpointf.cpp +++ b/src/test/ValentinaTest/tst_vpointf.cpp @@ -52,7 +52,7 @@ void TST_VPointF::TestFlip_data() QTest::addColumn("prefix"); VPointF const originPoint; - QLineF axis = QLineF(QPointF(5, 0), QPointF(5, 10)); + auto axis = QLineF(QPointF(5, 0), QPointF(5, 10)); auto flipped = QPointF(10, 0); QTest::newRow("Vertical axis") << originPoint << axis << flipped << "a2"; @@ -62,7 +62,7 @@ void TST_VPointF::TestFlip_data() QTest::newRow("Horizontal axis") << originPoint << axis << flipped << "a2"; - QLineF l = QLineF(QPointF(), QPointF(10, 0)); + auto l = QLineF(QPointF(), QPointF(10, 0)); l.setAngle(315); flipped = l.p2(); l.setLength(l.length() / 2.0);