From d997f74620b838dc1019e18475af2fdf333ce47e Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 4 May 2024 09:14:22 +0300 Subject: [PATCH] Refactoring. Replace the redundant type with "auto". --- src/app/valentina/core/vcmdexport.cpp | 2 +- src/app/valentina/xml/vpattern.cpp | 20 ++++++------- src/libs/fervor/fvupdater.cpp | 6 ++-- src/libs/ifc/xml/vpatternconverter.cpp | 26 ++++++++-------- src/libs/vformat/vmeasurements.cpp | 4 +-- .../vgeometry/vabstractcubicbezierpath.cpp | 4 +-- src/libs/vgeometry/vspline.cpp | 2 +- src/libs/vlayout/vlayoutpiece.cpp | 2 +- src/libs/vlayout/vposter.cpp | 2 +- src/libs/vlayout/vprintlayout.cpp | 2 +- src/libs/vmisc/theme/vtheme.cpp | 2 +- src/libs/vmisc/vabstractapplication.cpp | 2 +- src/libs/vpatterndb/vpiece.cpp | 2 +- .../tools/piece/dialogseamallowance.cpp | 4 +-- .../vbackgroundimagecontrols.cpp | 2 +- .../tools/drawTools/toolcurve/vtoolarc.cpp | 2 +- .../toolcurve/vtoolarcwithlength.cpp | 2 +- .../tools/drawTools/toolcurve/vtoolspline.cpp | 6 ++-- .../drawTools/toolcurve/vtoolsplinepath.cpp | 4 +-- .../toolcut/vtoolcutspline.cpp | 4 +-- .../toolcut/vtoolcutsplinepath.cpp | 4 +-- src/libs/vtools/tools/drawTools/vdrawtool.h | 4 +-- src/libs/vtools/tools/drawTools/vtoolline.cpp | 2 +- src/libs/vtools/tools/vabstracttool.h | 4 +-- src/libs/vtools/tools/vtoolseamallowance.cpp | 2 +- src/libs/vtools/tools/vtooluniondetails.cpp | 30 +++++++++---------- .../line/operation/vistoolrotation.cpp | 2 +- .../vtools/visualization/path/vistoolarc.cpp | 8 ++--- .../path/vistoolarcwithlength.cpp | 8 ++--- .../visualization/path/vistoolcutspline.cpp | 4 +-- src/libs/vtools/visualization/visualization.h | 2 +- src/libs/vwidgets/fancytabbar/fancytabbar.cpp | 2 +- src/libs/vwidgets/fancytabbar/stylehelper.cpp | 2 +- .../tst_valentinacommandline.cpp | 6 ++-- src/test/ValentinaTest/tst_varc.cpp | 2 +- src/test/ValentinaTest/tst_vellipticalarc.cpp | 2 +- src/test/ValentinaTest/tst_vlayoutdetail.cpp | 24 +++++++-------- src/test/ValentinaTest/tst_vmeasurements.cpp | 11 +++---- src/test/ValentinaTest/tst_vspline.cpp | 4 +-- 39 files changed, 109 insertions(+), 114 deletions(-) diff --git a/src/app/valentina/core/vcmdexport.cpp b/src/app/valentina/core/vcmdexport.cpp index 868554a14..11eef3702 100644 --- a/src/app/valentina/core/vcmdexport.cpp +++ b/src/app/valentina/core/vcmdexport.cpp @@ -529,7 +529,7 @@ auto VCommandLine::TiledPageMargins() const -> QMarginsF if (IsOptionSet(LONG_OPTION_SHIFTUNITS)) { const QString value = OptionValue(LONG_OPTION_SHIFTUNITS); - if (const QStringList supportedUnits = QStringList() << unitMM << unitCM << unitINCH; + if (const auto supportedUnits = QStringList() << unitMM << unitCM << unitINCH; not supportedUnits.contains(value)) { qCritical() << translate("VCommandLine", "Unsupported paper units.") << "\n"; diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 6ea80499e..766d07f51 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -3959,9 +3959,9 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of arc is empty"); - QStringList const arcs = QStringList() << VToolArc::ToolType /*0*/ - << VNodeArc::ToolType /*1*/ - << VToolArcWithLength::ToolType; /*2*/ + auto const arcs = QStringList() << VToolArc::ToolType /*0*/ + << VNodeArc::ToolType /*1*/ + << VToolArcWithLength::ToolType; /*2*/ switch (arcs.indexOf(type)) { @@ -3995,8 +3995,8 @@ void VPattern::ParseEllipticalArcElement(VMainGraphicsScene *scene, QDomElement Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of elliptical arc is empty"); - const QStringList arcs = QStringList() << VToolEllipticalArc::ToolType /*0*/ - << VNodeEllipticalArc::ToolType; /*1*/ + const auto arcs = QStringList() << VToolEllipticalArc::ToolType /*0*/ + << VNodeEllipticalArc::ToolType; /*1*/ switch (arcs.indexOf(type)) { @@ -4027,7 +4027,7 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty"); - const QStringList tools = QStringList() << VToolUnionDetails::ToolType; + const auto tools = QStringList() << VToolUnionDetails::ToolType; switch (tools.indexOf(type)) { case 0: // VToolUnionDetails::ToolType @@ -4068,10 +4068,10 @@ void VPattern::ParseOperationElement(VMainGraphicsScene *scene, QDomElement &dom Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of operation is empty"); - const QStringList opers = QStringList() << VToolRotation::ToolType /*0*/ - << VToolFlippingByLine::ToolType /*1*/ - << VToolFlippingByAxis::ToolType /*2*/ - << VToolMove::ToolType; /*3*/ + const auto opers = QStringList() << VToolRotation::ToolType /*0*/ + << VToolFlippingByLine::ToolType /*1*/ + << VToolFlippingByAxis::ToolType /*2*/ + << VToolMove::ToolType; /*3*/ switch (opers.indexOf(type)) { diff --git a/src/libs/fervor/fvupdater.cpp b/src/libs/fervor/fvupdater.cpp index 87e81cc6e..f200f0d35 100644 --- a/src/libs/fervor/fvupdater.cpp +++ b/src/libs/fervor/fvupdater.cpp @@ -592,9 +592,9 @@ void FvUpdater::IgnoreVersion(const QString &version) //--------------------------------------------------------------------------------------------------------------------- auto FvUpdater::CurrentlyRunningOnPlatform(const QString &platform) -> bool { - const QStringList platforms = QStringList() << "Q_OS_LINUX" - << "Q_OS_MAC" - << "Q_OS_WIN32"; + const auto platforms = QStringList() << "Q_OS_LINUX" + << "Q_OS_MAC" + << "Q_OS_WIN32"; switch (platforms.indexOf(platform.toUpper().trimmed())) { diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index 0f6894299..a5d77bc11 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -1436,7 +1436,7 @@ auto VPatternConverter::OldNamesToNewNames_InV0_2_1() -> QMap //--------------------------------------------------------------------------------------------------------------------- void VPatternConverter::FixCutPoint() { - const QStringList types = QStringList() << *strCutSplinePath << *strCutSpline << *strCutArc; + const auto types = QStringList() << *strCutSplinePath << *strCutSpline << *strCutArc; const QDomNodeList list = elementsByTagName(*strPoint); for (int i = 0; i < list.size(); ++i) @@ -1478,9 +1478,9 @@ void VPatternConverter::FixCutPoint() //--------------------------------------------------------------------------------------------------------------------- void VPatternConverter::FixSubPaths(int i, quint32 id, quint32 baseCurve) { - const QStringList pointTypes = QStringList() << *strCutSplinePath << *strCutSpline << *strPointOfIntersectionCurves - << *strCurveIntersectAxis << *strPointFromArcAndTangent - << *strPointOfIntersectionArcs; + const auto pointTypes = QStringList() + << *strCutSplinePath << *strCutSpline << *strPointOfIntersectionCurves + << *strCurveIntersectAxis << *strPointFromArcAndTangent << *strPointOfIntersectionArcs; const QDomNodeList listPoints = elementsByTagName(*strPoint); for (int j = i + 1; j < listPoints.size(); ++j) @@ -1563,7 +1563,7 @@ void VPatternConverter::FixSubPaths(int i, quint32 id, quint32 baseCurve) } } - const QStringList splTypes = QStringList() << *strModelingPath << *strModelingSpline; + const auto splTypes = QStringList() << *strModelingPath << *strModelingSpline; const QDomNodeList listSplines = elementsByTagName(*strSpline); for (int j = 0; j < listSplines.size(); ++j) @@ -1653,7 +1653,7 @@ void VPatternConverter::TagDetailToV0_4_0() dom.setAttribute(*strVersion, QChar('1')); - const QStringList tags = QStringList() << *strNode << *strData << *strPatternInfo << *strGrainline; + const auto tags = QStringList() << *strNode << *strData << *strPatternInfo << *strGrainline; QDomElement tagData; QDomElement tagPatternInfo; @@ -1781,9 +1781,9 @@ void VPatternConverter::LabelTagToV0_4_4(const QString &tagName) Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 4, 4), "Time to refactor the code."); Unit unit = Unit::Cm; - const QStringList units = QStringList() << "mm" - << "cm" - << "inch"; + const auto units = QStringList() << "mm" + << "cm" + << "inch"; switch (units.indexOf(UniqueTagText(*strUnit))) { case 0: // mm @@ -1836,9 +1836,9 @@ auto VPatternConverter::AddTagPatternLabelV0_5_1() -> QDomElement const QDomNodeList list = elementsByTagName(*strPatternLabel); if (list.isEmpty()) { - const QStringList tags = QStringList() << *strUnit << *strImage << *strAuthor << *strDescription << *strNotes - << *strGradation << *strPatternName << *strPatternNum << *strCompanyName - << *strCustomerName << *strPatternLabel; + const auto tags = QStringList() << *strUnit << *strImage << *strAuthor << *strDescription << *strNotes + << *strGradation << *strPatternName << *strPatternNum << *strCompanyName + << *strCustomerName << *strPatternLabel; QDomElement const element = createElement(*strPatternLabel); QDomElement pattern = documentElement(); @@ -2226,7 +2226,7 @@ void VPatternConverter::TagUnionDetailsToV0_4_0() QDomElement toolDOM = list.at(i).toElement(); if (not toolDOM.isNull()) { - const QStringList tags = QStringList() << *strDet << *strChildren; + const auto tags = QStringList() << *strDet << *strChildren; nodes.resize(0); QDomElement tagChildrenNodes = createElement(*strChildren); diff --git a/src/libs/vformat/vmeasurements.cpp b/src/libs/vformat/vmeasurements.cpp index 061b06bba..9b11a4d27 100644 --- a/src/libs/vformat/vmeasurements.cpp +++ b/src/libs/vformat/vmeasurements.cpp @@ -984,7 +984,7 @@ auto VMeasurements::GenderToStr(const GenderType &sex) -> QString //--------------------------------------------------------------------------------------------------------------------- auto VMeasurements::StrToGender(const QString &sex) -> GenderType { - const QStringList genders = QStringList() << GenderMale << GenderFemale << GenderUnknown; + const auto genders = QStringList() << GenderMale << GenderFemale << GenderUnknown; switch (genders.indexOf(sex)) { case 0: // GenderMale @@ -1054,7 +1054,7 @@ auto VMeasurements::IMDToStr(const IMD &type) -> QString //--------------------------------------------------------------------------------------------------------------------- auto VMeasurements::StrToIMD(const QString &type) -> IMD { - const QStringList dimensions = QStringList{DimensionN, DimensionX, DimensionY, DimensionW, DimensionZ}; + const auto dimensions = QStringList{DimensionN, DimensionX, DimensionY, DimensionW, DimensionZ}; switch (dimensions.indexOf(type)) { case 1: // DimensionX diff --git a/src/libs/vgeometry/vabstractcubicbezierpath.cpp b/src/libs/vgeometry/vabstractcubicbezierpath.cpp index db77f2167..92c0cfad3 100644 --- a/src/libs/vgeometry/vabstractcubicbezierpath.cpp +++ b/src/libs/vgeometry/vabstractcubicbezierpath.cpp @@ -155,8 +155,8 @@ auto VAbstractCubicBezierPath::Segment(const QPointF &p) const -> int * * VSplinePoint splP1 = splPath->at(p1); * VSplinePoint splP2 = splPath->at(p2); - * VSpline spl1 = VSpline(splP1.P(), spl1p2, spl1p3, *p, splPath->GetKCurve()); - * VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P(), splPath->GetKCurve()); + * auto spl1 = VSpline(splP1.P(), spl1p2, spl1p3, *p, splPath->GetKCurve()); + * auto spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P(), splPath->GetKCurve()); * @param length length first spline path. * @param p1 index first spline point in list. * @param p2 index second spline point in list. diff --git a/src/libs/vgeometry/vspline.cpp b/src/libs/vgeometry/vspline.cpp index 8dce4e366..fface000f 100644 --- a/src/libs/vgeometry/vspline.cpp +++ b/src/libs/vgeometry/vspline.cpp @@ -520,7 +520,7 @@ auto VSpline::CalcT(qreal curveCoord1, qreal curveCoord2, qreal curveCoord3, qre const qreal c = -3 * curveCoord1 + 3 * curveCoord2; const qreal d = -pointCoord + curveCoord1; - QVector t = QVector(3, -1); + auto t = QVector(3, -1); Cubic(t, b / a, c / a, d / a); QVector retT; diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index 63de4253d..28d727e34 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -134,7 +134,7 @@ auto FindLabelGeometry(const VPatternLabelData &labelData, const VContainer *pat const auto topLeftPinPoint = pattern->GeometricObject(topLeftPin); const auto bottomRightPinPoint = pattern->GeometricObject(bottomRightPin); - const QRectF labelRect = + const auto labelRect = QRectF(static_cast(*topLeftPinPoint), static_cast(*bottomRightPinPoint)); labelWidth = qAbs(labelRect.width()); labelHeight = qAbs(labelRect.height()); diff --git a/src/libs/vlayout/vposter.cpp b/src/libs/vlayout/vposter.cpp index 9fd7158de..0ba6e339f 100644 --- a/src/libs/vlayout/vposter.cpp +++ b/src/libs/vlayout/vposter.cpp @@ -69,7 +69,7 @@ auto Grayscale(QImage image) -> QImage int const depth = 4; for (int jj = 0; jj < image.width(); jj++) { - QRgb *rgbpixel = reinterpret_cast(scan + jj * depth); + auto *rgbpixel = reinterpret_cast(scan + jj * depth); int const gray = qGray(*rgbpixel); *rgbpixel = QColor(gray, gray, gray, qAlpha(*rgbpixel)).rgba(); } diff --git a/src/libs/vlayout/vprintlayout.cpp b/src/libs/vlayout/vprintlayout.cpp index 8fd4f90de..c1cfe3b4f 100644 --- a/src/libs/vlayout/vprintlayout.cpp +++ b/src/libs/vlayout/vprintlayout.cpp @@ -557,7 +557,7 @@ void VPrintLayout::SetPrinterPageSize(QPrinter *printer) } } - QSizeF size = QSizeF(width, height); + auto size = QSizeF(width, height); if (not m_isLayoutPortrait) { diff --git a/src/libs/vmisc/theme/vtheme.cpp b/src/libs/vmisc/theme/vtheme.cpp index f019d2b0c..e69b31ec9 100644 --- a/src/libs/vmisc/theme/vtheme.cpp +++ b/src/libs/vmisc/theme/vtheme.cpp @@ -195,7 +195,7 @@ auto GetResourceName(const QString &root, const QString &iconName, bool dark) -> auto GetPixmapResource(const QString &root, const QString &iconName, bool dark) -> QPixmap { QString const resourceName = GetResourceName(root, iconName, dark); - QPixmap pixmap = QPixmap(resourceName); + auto pixmap = QPixmap(resourceName); Q_ASSERT(!pixmap.isNull()); return pixmap; } diff --git a/src/libs/vmisc/vabstractapplication.cpp b/src/libs/vmisc/vabstractapplication.cpp index c89b6a8af..1e11a4069 100644 --- a/src/libs/vmisc/vabstractapplication.cpp +++ b/src/libs/vmisc/vabstractapplication.cpp @@ -526,7 +526,7 @@ auto VAbstractApplication::GetPlaceholderTranslator() -> QSharedPointer(new VTranslator); } - QSharedPointer translator = QSharedPointer(new VTranslator); + auto translator = QSharedPointer(new VTranslator); const QString appQmDir = VAbstractApplication::translationsPath(settings->GetLocale()); if (translator->load(QStringLiteral("valentina_") + pieceLabelLocale, appQmDir)) { diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp index ac7c93bde..6ab9d4ec3 100644 --- a/src/libs/vpatterndb/vpiece.cpp +++ b/src/libs/vpatterndb/vpiece.cpp @@ -1678,7 +1678,7 @@ auto VPiece::SeamAllowanceMirrorLine(const VContainer *data) const -> QLineF auto rec = QRectF(0, 0, INT_MAX, INT_MAX); rec.translate(-INT_MAX / 2.0, -INT_MAX / 2.0); - QLineF axis = + auto axis = QLineF(seamMirrorLine.center(), VGObject::BuildRay(seamMirrorLine.center(), seamMirrorLine.angle() + 180, rec)); QVector points; diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp index fcc4e8535..e8d2e5895 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp @@ -1330,7 +1330,7 @@ void DialogSeamAllowance::ShowPlaceLabelsContextMenu(const QPoint &pos) auto SaveType = [this, ¤tLabel, labelId](PlaceLabelType type) { - VPlaceLabelItem newLabel = VPlaceLabelItem(currentLabel); + auto newLabel = VPlaceLabelItem(currentLabel); newLabel.SetLabelType(type); m_newPlaceLabels.insert(labelId, newLabel); @@ -1798,7 +1798,7 @@ void DialogSeamAllowance::PlaceLabelDialogClosed(int result) const qreal v = Visualization::FindValFromUser(dialogTool->GetFormulaVisible(), vars, false); qDebug() << w << h << a << v; - VPlaceLabelItem newLabel = VPlaceLabelItem(); + auto newLabel = VPlaceLabelItem(); newLabel.setName(currentLabel.name()); newLabel.setX(currentLabel.x()); newLabel.setY(currentLabel.y()); diff --git a/src/libs/vtools/tools/backgroundimage/vbackgroundimagecontrols.cpp b/src/libs/vtools/tools/backgroundimage/vbackgroundimagecontrols.cpp index b67b0d2ca..de069a51e 100644 --- a/src/libs/vtools/tools/backgroundimage/vbackgroundimagecontrols.cpp +++ b/src/libs/vtools/tools/backgroundimage/vbackgroundimagecontrols.cpp @@ -94,7 +94,7 @@ VBackgroundImageControls::VBackgroundImageControls(VAbstractPattern *doc, QGraph InitPixmaps(); - QGuiApplication *guiApp = qGuiApp; + auto *guiApp = qGuiApp; if (guiApp != nullptr) { connect(guiApp, &QGuiApplication::primaryScreenChanged, this, &VBackgroundImageControls::ScreenChanged); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp index 049df5ab8..927f691dd 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp @@ -149,7 +149,7 @@ auto VToolArc::Create(VToolArcInitData &initData) -> VToolArc * calcF2 = CheckFormula(initData.id, initData.f2, initData.data); const VPointF c = *initData.data->GeometricObject(initData.center); - VArc *arc = new VArc(c, calcRadius, initData.radius, calcF1, initData.f1, calcF2, initData.f2); + auto *arc = new VArc(c, calcRadius, initData.radius, calcF1, initData.f1, calcF2, initData.f2); arc->SetColor(initData.color); arc->SetPenStyle(initData.penStyle); arc->SetApproximationScale(initData.approximationScale); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp index c41ce5626..ba2534f48 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp @@ -131,7 +131,7 @@ auto VToolArcWithLength::Create(VToolArcWithLengthInitData &initData) -> VToolAr calcF1 = CheckFormula(initData.id, initData.f1, initData.data); const VPointF c = *initData.data->GeometricObject(initData.center); - VArc *arc = new VArc(calcLength, initData.length, c, calcRadius, initData.radius, calcF1, initData.f1); + auto *arc = new VArc(calcLength, initData.length, c, calcRadius, initData.radius, calcF1, initData.f1); arc->SetColor(initData.color); arc->SetPenStyle(initData.penStyle); arc->SetApproximationScale(initData.approximationScale); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp index d9fcaded3..325d443f1 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp @@ -602,8 +602,7 @@ void VToolSpline::RefreshCtrlPoints() const bool freeAngle1 = qmu::QmuTokenParser::IsSingle(spl->GetStartAngleFormula()); const bool freeLength1 = qmu::QmuTokenParser::IsSingle(spl->GetC1LengthFormula()); - const QPointF splinePoint = - static_cast(*VAbstractTool::data.GeometricObject(spl->GetP1().id())); + const auto splinePoint = static_cast(*VAbstractTool::data.GeometricObject(spl->GetP1().id())); controlPoints[0]->RefreshCtrlPoint(1, SplinePointPosition::FirstPoint, static_cast(spl->GetP2()), static_cast(splinePoint), freeAngle1, freeLength1); } @@ -612,8 +611,7 @@ void VToolSpline::RefreshCtrlPoints() const bool freeAngle2 = qmu::QmuTokenParser::IsSingle(spl->GetEndAngleFormula()); const bool freeLength2 = qmu::QmuTokenParser::IsSingle(spl->GetC2LengthFormula()); - const QPointF splinePoint = - static_cast(*VAbstractTool::data.GeometricObject(spl->GetP4().id())); + const auto splinePoint = static_cast(*VAbstractTool::data.GeometricObject(spl->GetP4().id())); controlPoints[1]->RefreshCtrlPoint(1, SplinePointPosition::LastPoint, static_cast(spl->GetP3()), static_cast(splinePoint), freeAngle2, freeLength2); } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp index 358c402a7..1b536c428 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp @@ -231,7 +231,7 @@ void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, cons moved = true; } - QSharedPointer newSplPath = QSharedPointer::create(*oldSplPath); + auto newSplPath = QSharedPointer::create(*oldSplPath); const VSpline spl = CorrectedSpline(newSplPath->GetSpline(indexSpline), position, pos); UpdateControlPoints(spl, newSplPath, indexSpline); @@ -681,7 +681,7 @@ void VToolSplinePath::mouseMoveEvent(QGraphicsSceneMouseEvent *event) oldPosition = event->scenePos(); // Now mouse here - const VSpline spl = VSpline(spline.GetP1(), p2, p3, spline.GetP4()); + const auto spl = VSpline(spline.GetP1(), p2, p3, spline.GetP4()); UpdateControlPoints(spl, newMoveSplinePath, splIndex); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp index b95b75946..88ecea338 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp @@ -299,10 +299,10 @@ auto VToolCutSpline::MakeToolTip() const -> QString QPointF const point = spl->CutSpline(VAbstractValApplication::VApp()->toPixel(length), spl1p2, spl1p3, spl2p2, spl2p3, p->name()); - VSpline spline1 = VSpline(spl->GetP1(), spl1p2, spl1p3, VPointF(point)); + auto spline1 = VSpline(spl->GetP1(), spl1p2, spl1p3, VPointF(point)); spline1.SetAliasSuffix(m_aliasSuffix1); - VSpline spline2 = VSpline(VPointF(point), spl2p2, spl2p3, spl->GetP4()); + auto spline2 = VSpline(VPointF(point), spl2p2, spl2p3, spl->GetP4()); spline2.SetAliasSuffix(m_aliasSuffix2); const QString curveStr = QCoreApplication::translate("VToolCutSpline", "Curve"); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp index 528bed57a..cefb55cd5 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp @@ -236,10 +236,10 @@ auto VToolCutSplinePath::CutSplinePath(qreal length, const QSharedPointerGetApproximationScale()); - VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P()); + auto spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P()); spl2.SetApproximationScale(splPath->GetApproximationScale()); *splPath1 = new VSplinePath(); diff --git a/src/libs/vtools/tools/drawTools/vdrawtool.h b/src/libs/vtools/tools/drawTools/vdrawtool.h index db243ca62..c53d6dd82 100644 --- a/src/libs/vtools/tools/drawTools/vdrawtool.h +++ b/src/libs/vtools/tools/drawTools/vdrawtool.h @@ -192,7 +192,7 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI { QMenu *menuAddToGroup = menu.addMenu(FromTheme(VThemeIcon::ListAdd), VDrawTool::tr("Add to group")); - QStringList list = QStringList(groupsNotContainingItem.values()); + auto list = QStringList(groupsNotContainingItem.values()); list.sort(Qt::CaseInsensitive); for (int i = 0; i < list.count(); ++i) @@ -216,7 +216,7 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI QMenu *menuRemoveFromGroup = menu.addMenu(FromTheme(VThemeIcon::ListRemove), VDrawTool::tr("Remove from group")); - QStringList list = QStringList(groupsContainingItem.values()); + auto list = QStringList(groupsContainingItem.values()); list.sort(Qt::CaseInsensitive); for (int i = 0; i < list.count(); ++i) diff --git a/src/libs/vtools/tools/drawTools/vtoolline.cpp b/src/libs/vtools/tools/drawTools/vtoolline.cpp index 369c977a0..014fe70cc 100644 --- a/src/libs/vtools/tools/drawTools/vtoolline.cpp +++ b/src/libs/vtools/tools/drawTools/vtoolline.cpp @@ -284,7 +284,7 @@ void VToolLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolLine::AddToFile() { QDomElement domElement = doc->createElement(getTagName()); - QSharedPointer obj = QSharedPointer(); + auto obj = QSharedPointer(); SaveOptions(domElement, obj); AddToCalculation(domElement); } diff --git a/src/libs/vtools/tools/vabstracttool.h b/src/libs/vtools/tools/vabstracttool.h index fdf7e53f7..4ed7e970d 100644 --- a/src/libs/vtools/tools/vabstracttool.h +++ b/src/libs/vtools/tools/vabstracttool.h @@ -210,7 +210,7 @@ inline auto VAbstractTool::getData() const -> const VContainer * //--------------------------------------------------------------------------------------------------------------------- template inline void VAbstractTool::AddVisualization() { - T *visual = new T(getData()); + auto *visual = new T(getData()); auto *scene = qobject_cast(VAbstractValApplication::VApp()->getCurrentScene()); // cppcheck-suppress unknownMacro SCASSERT(scene != nullptr) @@ -231,7 +231,7 @@ template auto VAbstractTool::CreateNode(VContainer *data, quint32 id) -> quint32 { // We can't use exist object. Need create new. - T *node = new T(*data->GeometricObject(id).data()); + auto *node = new T(*data->GeometricObject(id).data()); node->setMode(Draw::Modeling); node->setIdObject(id); return data->AddGObject(node); diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 0360277e8..497c0f223 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -2150,7 +2150,7 @@ auto VToolSeamAllowance::FindLabelGeometry(const VPatternLabelData &labelData, c const auto topLeftPinPoint = VAbstractTool::data.GeometricObject(topLeftPin); const auto bottomRightPinPoint = VAbstractTool::data.GeometricObject(bottomRightPin); - const QRectF labelRect = + const auto labelRect = QRectF(static_cast(*topLeftPinPoint), static_cast(*bottomRightPinPoint)); labelWidth = FromPixel(qAbs(labelRect.width()), *VDataTool::data.GetPatternUnit()); labelHeight = FromPixel(qAbs(labelRect.height()), *VDataTool::data.GetPatternUnit()); diff --git a/src/libs/vtools/tools/vtooluniondetails.cpp b/src/libs/vtools/tools/vtooluniondetails.cpp index 5ea4947f5..fa64f2b38 100644 --- a/src/libs/vtools/tools/vtooluniondetails.cpp +++ b/src/libs/vtools/tools/vtooluniondetails.cpp @@ -497,8 +497,8 @@ auto AddNodeArc(const VPieceNode &node, const VToolUnionDetailsInitData &initDat const QString &drawName, qreal dx, qreal dy, quint32 pRotate, qreal angle) -> quint32 { const QSharedPointer arc = initData.data->GeometricObject(node.GetId()); - VPointF p1 = VPointF(arc->GetP1(), QChar('A'), 0, 0); - VPointF p2 = VPointF(arc->GetP2(), QChar('A'), 0, 0); + auto p1 = VPointF(arc->GetP1(), QChar('A'), 0, 0); + auto p2 = VPointF(arc->GetP2(), QChar('A'), 0, 0); std::unique_ptr center(new VPointF(arc->GetCenter())); if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) @@ -548,8 +548,8 @@ auto AddNodeElArc(const VPieceNode &node, const VToolUnionDetailsInitData &initD const QString &drawName, qreal dx, qreal dy, quint32 pRotate, qreal angle) -> quint32 { const QSharedPointer arc = initData.data->GeometricObject(node.GetId()); - VPointF p1 = VPointF(arc->GetP1(), QChar('A'), 0, 0); - VPointF p2 = VPointF(arc->GetP2(), QChar('A'), 0, 0); + auto p1 = VPointF(arc->GetP1(), QChar('A'), 0, 0); + auto p2 = VPointF(arc->GetP2(), QChar('A'), 0, 0); std::unique_ptr center(new VPointF(arc->GetCenter())); if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) @@ -666,7 +666,7 @@ auto AddNodeSplinePath(const VPieceNode &node, const VToolUnionDetailsInitData & BiasRotatePoint(p4.data(), dx, dy, p, angle); } - VSpline const spl = VSpline(*p1, static_cast(p2), static_cast(p3), *p4); + auto const spl = VSpline(*p1, static_cast(p2), static_cast(p3), *p4); if (i == 1) { const qreal angle1 = spl.GetStartAngle() + 180; @@ -937,8 +937,8 @@ void UpdateNodeArc(VContainer *data, const VPieceNode &node, QVector &c quint32 pRotate, qreal angle) { const QSharedPointer arc = data->GeometricObject(node.GetId()); - VPointF p1 = VPointF(arc->GetP1()); - VPointF p2 = VPointF(arc->GetP2()); + auto p1 = VPointF(arc->GetP1()); + auto p2 = VPointF(arc->GetP2()); QScopedPointer const center(new VPointF(arc->GetCenter())); if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) @@ -964,8 +964,8 @@ void UpdateNodeElArc(VContainer *data, const VPieceNode &node, QVector quint32 pRotate, qreal angle) { const QSharedPointer arc = data->GeometricObject(node.GetId()); - VPointF p1 = VPointF(arc->GetP1()); - VPointF p2 = VPointF(arc->GetP2()); + auto p1 = VPointF(arc->GetP1()); + auto p2 = VPointF(arc->GetP2()); QScopedPointer const center(new VPointF(arc->GetCenter())); if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) @@ -1041,7 +1041,7 @@ void UpdateNodeSplinePath(VContainer *data, const VPieceNode &node, QVector(p2), static_cast(p3), *p4); + auto const spl = VSpline(*p1, static_cast(p2), static_cast(p3), *p4); if (i == 1) { const qreal angle1 = spl.GetStartAngle() + 180; @@ -1861,11 +1861,11 @@ auto VToolUnionDetails::GetReferenceObjects() const -> QVector return list; } - const QStringList parts = QStringList() << VAbstractPattern::TagNodes /*0*/ - << VToolSeamAllowance::TagCSA /*1*/ - << VToolSeamAllowance::TagIPaths /*2*/ - << VToolSeamAllowance::TagPins /*3*/ - << VToolSeamAllowance::TagPlaceLabels; /*4*/ + const auto parts = QStringList() << VAbstractPattern::TagNodes /*0*/ + << VToolSeamAllowance::TagCSA /*1*/ + << VToolSeamAllowance::TagIPaths /*2*/ + << VToolSeamAllowance::TagPins /*3*/ + << VToolSeamAllowance::TagPlaceLabels; /*4*/ const QDomNodeList nodesList = tool.childNodes(); for (qint32 i = 0; i < nodesList.size(); ++i) diff --git a/src/libs/vtools/visualization/line/operation/vistoolrotation.cpp b/src/libs/vtools/visualization/line/operation/vistoolrotation.cpp index 6f91b4aad..5f1f3e38a 100644 --- a/src/libs/vtools/visualization/line/operation/vistoolrotation.cpp +++ b/src/libs/vtools/visualization/line/operation/vistoolrotation.cpp @@ -72,7 +72,7 @@ void VisToolRotation::RefreshGeometry() return; } - QSharedPointer origin = QSharedPointer(new VPointF()); + auto origin = QSharedPointer(new VPointF()); qreal tempAngle = 0; diff --git a/src/libs/vtools/visualization/path/vistoolarc.cpp b/src/libs/vtools/visualization/path/vistoolarc.cpp index bf8714e66..deda9a0a6 100644 --- a/src/libs/vtools/visualization/path/vistoolarc.cpp +++ b/src/libs/vtools/visualization/path/vistoolarc.cpp @@ -83,7 +83,7 @@ void VisToolArc::RefreshGeometry() if (qFuzzyIsNull(m_radius)) { - VArc arc = VArc(*first, r.length(), r.angle(), r.angle()); + auto arc = VArc(*first, r.length(), r.angle(), r.angle()); arc.SetApproximationScale(ApproximationScale()); DrawPath(this, arc.GetPath(), QVector(), Qt::DashLine, Qt::RoundCap); @@ -95,7 +95,7 @@ void VisToolArc::RefreshGeometry() else if (m_f1 < 0) { qreal const f1Angle = Angle(); - VArc arc = VArc(*first, m_radius, f1Angle, f1Angle); + auto arc = VArc(*first, m_radius, f1Angle, f1Angle); arc.SetApproximationScale(ApproximationScale()); DrawPath(this, arc.GetPath(), QVector(), Qt::DashLine, Qt::RoundCap); @@ -115,7 +115,7 @@ void VisToolArc::RefreshGeometry() else if (m_f1 >= 0) { qreal const f2Angle = StickyEnd(Angle()); - VArc arc = VArc(*first, m_radius, m_f1, f2Angle); + auto arc = VArc(*first, m_radius, m_f1, f2Angle); arc.SetApproximationScale(ApproximationScale()); DrawPath(this, arc.GetPath(), arc.DirectionArrows(), LineStyle(), Qt::RoundCap); @@ -132,7 +132,7 @@ void VisToolArc::RefreshGeometry() { if (not qFuzzyIsNull(m_radius) && m_f1 >= 0 && m_f2 >= 0) { - VArc arc = VArc(*first, m_radius, m_f1, m_f2); + auto arc = VArc(*first, m_radius, m_f1, m_f2); arc.SetApproximationScale(ApproximationScale()); DrawPath(this, arc.GetPath(), arc.DirectionArrows(), LineStyle(), Qt::RoundCap); } diff --git a/src/libs/vtools/visualization/path/vistoolarcwithlength.cpp b/src/libs/vtools/visualization/path/vistoolarcwithlength.cpp index 5630f9ba0..092c92585 100644 --- a/src/libs/vtools/visualization/path/vistoolarcwithlength.cpp +++ b/src/libs/vtools/visualization/path/vistoolarcwithlength.cpp @@ -81,7 +81,7 @@ void VisToolArcWithLength::RefreshGeometry() if (qFuzzyIsNull(m_radius)) { - VArc arc = VArc(*first, r.length(), r.angle(), r.angle()); + auto arc = VArc(*first, r.length(), r.angle(), r.angle()); arc.SetApproximationScale(ApproximationScale()); DrawPath(this, arc.GetPath(), QVector(), Qt::DashLine, Qt::RoundCap); @@ -93,7 +93,7 @@ void VisToolArcWithLength::RefreshGeometry() else if (m_f1 < 0) { qreal const f1Angle = Angle(); - VArc arc = VArc(*first, m_radius, f1Angle, f1Angle); + auto arc = VArc(*first, m_radius, f1Angle, f1Angle); arc.SetApproximationScale(ApproximationScale()); DrawPath(this, arc.GetPath(), QVector(), Qt::DashLine, Qt::RoundCap); @@ -112,7 +112,7 @@ void VisToolArcWithLength::RefreshGeometry() } else if (m_f1 >= 0) { - VArc arc = VArc(*first, m_radius, m_f1, r.angle()); + auto arc = VArc(*first, m_radius, m_f1, r.angle()); arc.SetApproximationScale(ApproximationScale()); DrawPath(this, arc.GetPath(), arc.DirectionArrows(), LineStyle(), Qt::RoundCap); @@ -127,7 +127,7 @@ void VisToolArcWithLength::RefreshGeometry() { if (not qFuzzyIsNull(m_radius) && m_f1 >= 0 && not qFuzzyIsNull(m_length)) { - VArc arc = VArc(m_length, *first, m_radius, m_f1); + auto arc = VArc(m_length, *first, m_radius, m_f1); arc.SetApproximationScale(ApproximationScale()); DrawPath(this, arc.GetPath(), arc.DirectionArrows(), LineStyle(), Qt::RoundCap); } diff --git a/src/libs/vtools/visualization/path/vistoolcutspline.cpp b/src/libs/vtools/visualization/path/vistoolcutspline.cpp index 6f05f6f52..30404f6a5 100644 --- a/src/libs/vtools/visualization/path/vistoolcutspline.cpp +++ b/src/libs/vtools/visualization/path/vistoolcutspline.cpp @@ -77,9 +77,9 @@ void VisToolCutSpline::RefreshGeometry() QPointF spl2p3; const QPointF p = spl->CutSpline(m_length, spl1p2, spl1p3, spl2p2, spl2p3, QString()); - VSpline sp1 = VSpline(spl->GetP1(), spl1p2, spl1p3, VPointF(p)); + auto sp1 = VSpline(spl->GetP1(), spl1p2, spl1p3, VPointF(p)); sp1.SetApproximationScale(spl->GetApproximationScale()); - VSpline sp2 = VSpline(VPointF(p), spl2p2, spl2p3, spl->GetP4()); + auto sp2 = VSpline(VPointF(p), spl2p2, spl2p3, spl->GetP4()); sp2.SetApproximationScale(spl->GetApproximationScale()); DrawPoint(m_point, p); diff --git a/src/libs/vtools/visualization/visualization.h b/src/libs/vtools/visualization/visualization.h index 147287e1e..2ed84fca8 100644 --- a/src/libs/vtools/visualization/visualization.h +++ b/src/libs/vtools/visualization/visualization.h @@ -154,7 +154,7 @@ template inline void Visualization::AddItem(Item *item) //--------------------------------------------------------------------------------------------------------------------- template inline auto Visualization::InitItem(VColorRole role, QGraphicsItem *parent) -> Item * { - Item *item = new Item(role, parent); + auto *item = new Item(role, parent); item->setZValue(1); item->setFlags(QGraphicsItem::ItemStacksBehindParent); item->setVisible(false); diff --git a/src/libs/vwidgets/fancytabbar/fancytabbar.cpp b/src/libs/vwidgets/fancytabbar/fancytabbar.cpp index a567cd611..3ec3439a1 100644 --- a/src/libs/vwidgets/fancytabbar/fancytabbar.cpp +++ b/src/libs/vwidgets/fancytabbar/fancytabbar.cpp @@ -508,7 +508,7 @@ void FancyTabBar::PaintTab(QPainter *painter, int tabIndex) const boldFont.setBold(true); painter->setFont(boldFont); painter->setPen(selected ? QColor(255, 255, 255, 160) : QColor(0, 0, 0, 110)); - const int textFlags = + const auto textFlags = static_cast(Qt::AlignCenter | (drawIcon ? Qt::AlignBottom : Qt::AlignVCenter) | Qt::TextWordWrap); if (enabled) { diff --git a/src/libs/vwidgets/fancytabbar/stylehelper.cpp b/src/libs/vwidgets/fancytabbar/stylehelper.cpp index d6f1eaa31..35d07be19 100644 --- a/src/libs/vwidgets/fancytabbar/stylehelper.cpp +++ b/src/libs/vwidgets/fancytabbar/stylehelper.cpp @@ -143,7 +143,7 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect, QPain QImage im = px.toImage().convertToFormat(QImage::Format_ARGB32); for (int y = 0; y < im.height(); ++y) { - QRgb *scanLine = reinterpret_cast(im.scanLine(y)); + auto *scanLine = reinterpret_cast(im.scanLine(y)); for (int x = 0; x < im.width(); ++x) { QRgb const pixel = *scanLine; diff --git a/src/test/CollectionTest/tst_valentinacommandline.cpp b/src/test/CollectionTest/tst_valentinacommandline.cpp index 660a57453..57dbd57f5 100644 --- a/src/test/CollectionTest/tst_valentinacommandline.cpp +++ b/src/test/CollectionTest/tst_valentinacommandline.cpp @@ -154,7 +154,7 @@ void TST_ValentinaCommandLine::ExportMode() QString error; const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder; - const QStringList arg = QStringList() << tmp + QDir::separator() + file << arguments.split(";;"); + const auto arg = QStringList() << tmp + QDir::separator() + file << arguments.split(";;"); const int exit = Run(exitCode, ValentinaPath(), arg, error); QVERIFY2(exit == exitCode, qUtf8Printable(error.right(350))); @@ -199,7 +199,7 @@ void TST_ValentinaCommandLine::TestMode() QString error; const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder; - const QStringList arg = QStringList() << tmp + QDir::separator() + file << arguments.split(";;"_L1); + const auto arg = QStringList() << tmp + QDir::separator() + file << arguments.split(";;"_L1); const int exit = Run(exitCode, ValentinaPath(), arg, error); QVERIFY2(exit == exitCode, qUtf8Printable(error.right(350))); @@ -260,7 +260,7 @@ void TST_ValentinaCommandLine::TestOpenCollection() QString error; const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestCollectionFolder; - const QStringList arg = QStringList() << tmp + QDir::separator() + file << arguments.split(";;"); + const auto arg = QStringList() << tmp + QDir::separator() + file << arguments.split(";;"); const int exit = Run(exitCode, ValentinaPath(), arg, error); QVERIFY2(exit == exitCode, qUtf8Printable(error.right(350))); diff --git a/src/test/ValentinaTest/tst_varc.cpp b/src/test/ValentinaTest/tst_varc.cpp index 889ecf764..62f8a0ab0 100644 --- a/src/test/ValentinaTest/tst_varc.cpp +++ b/src/test/ValentinaTest/tst_varc.cpp @@ -482,7 +482,7 @@ void TST_VArc::TestCutArcByLength_data() QTest::newRow("Arc 10 cm length, cut length 3 cm") << center << radius << 135. << length << ToPixel(3, Unit::Cm) << cutPoint; - QLineF l = QLineF(center, QPointF(center.x() + radius, center.y())); + auto l = QLineF(center, QPointF(center.x() + radius, center.y())); l.setAngle(135); QTest::newRow("Arc 10 cm length, cut length 0 cm") << center << radius << 135. << length << 0. << l.p2(); diff --git a/src/test/ValentinaTest/tst_vellipticalarc.cpp b/src/test/ValentinaTest/tst_vellipticalarc.cpp index a73cebf33..d21176435 100644 --- a/src/test/ValentinaTest/tst_vellipticalarc.cpp +++ b/src/test/ValentinaTest/tst_vellipticalarc.cpp @@ -217,7 +217,7 @@ void TST_VEllipticalArc::ArcByLength() Q_RELAXED_CONSTEXPR qreal eps = ToPixel(0.45, Unit::Mm); // computing error // cppcheck-suppress unreadVariable - const QString errorMsg = + const auto errorMsg = QStringLiteral("Difference between real and computing lengthes bigger than eps = %1. v1 = %2; v2 = %3"); QVERIFY2(qAbs(arc.GetLength() - length) <= eps, qUtf8Printable(errorMsg.arg(eps).arg(arc.GetLength()).arg(length))); diff --git a/src/test/ValentinaTest/tst_vlayoutdetail.cpp b/src/test/ValentinaTest/tst_vlayoutdetail.cpp index 14610e60b..8009ad6cc 100644 --- a/src/test/ValentinaTest/tst_vlayoutdetail.cpp +++ b/src/test/ValentinaTest/tst_vlayoutdetail.cpp @@ -33,20 +33,20 @@ //--------------------------------------------------------------------------------------------------------------------- TST_VLayoutDetail::TST_VLayoutDetail(QObject *parent) - :AbstractTest(parent) + : AbstractTest(parent) { } //--------------------------------------------------------------------------------------------------------------------- void TST_VLayoutDetail::RemoveDublicates() const { - qDebug()<<"Case 1."; + qDebug() << "Case 1."; Case1(); - qDebug()<<"Case 2."; + qDebug() << "Case 2."; Case2(); - qDebug()<<"Case 3."; + qDebug() << "Case 3."; Case3(); } @@ -56,7 +56,7 @@ void TST_VLayoutDetail::Case1() const // See issue #304. Layout appears different than my pattern. // https://bitbucket.org/dismine/valentina/issue/304/layout-appears-different-than-my-pattern - VLayoutPiece det = VLayoutPiece(); + VLayoutPiece det; QVector inputPoints; CastTo(InputPointsCase1(), inputPoints); det.SetContourPoints(inputPoints); @@ -122,7 +122,7 @@ QVector TST_VLayoutDetail::OutputPointsCase1() const //-V524 //--------------------------------------------------------------------------------------------------------------------- void TST_VLayoutDetail::Case2() const { - VLayoutPiece det = VLayoutPiece(); + VLayoutPiece det; QVector inputPoints; CastTo(InputPointsCase2(), inputPoints); det.SetContourPoints(inputPoints); @@ -140,9 +140,9 @@ auto TST_VLayoutDetail::InputPointsCase2() const -> QVector points += QPointF(557.0, -94.0); points += QPointF(760.0, -53.0); - points += QPointF(760.0, -53.0);// Need delete this part - points += QPointF(760.0, -53.0);// Need delete this part - points += QPointF(760.0, -53.0);// Need delete this part + points += QPointF(760.0, -53.0); // Need delete this part + points += QPointF(760.0, -53.0); // Need delete this part + points += QPointF(760.0, -53.0); // Need delete this part points += QPointF(661.0, 411.0); points += QPointF(708.0, 467.0); points += QPointF(366.0, 845.0); @@ -167,7 +167,7 @@ auto TST_VLayoutDetail::OutputPointsCase2() const -> QVector //--------------------------------------------------------------------------------------------------------------------- void TST_VLayoutDetail::Case3() const { - VLayoutPiece det = VLayoutPiece(); + VLayoutPiece det; QVector inputPoints; CastTo(InputPointsCase3(), inputPoints); det.SetContourPoints(inputPoints); @@ -183,7 +183,7 @@ auto TST_VLayoutDetail::InputPointsCase3() const -> QVector { QVector points; - points += QPointF(557.0, -94.0);// Only one point + points += QPointF(557.0, -94.0); // Only one point return points; } @@ -193,7 +193,7 @@ QVector TST_VLayoutDetail::OutputPointsCase3() const //-V524 { QVector points; - points += QPointF(557.0, -94.0);// Only one point + points += QPointF(557.0, -94.0); // Only one point return points; } diff --git a/src/test/ValentinaTest/tst_vmeasurements.cpp b/src/test/ValentinaTest/tst_vmeasurements.cpp index 4ca7d36e3..45d11721b 100644 --- a/src/test/ValentinaTest/tst_vmeasurements.cpp +++ b/src/test/ValentinaTest/tst_vmeasurements.cpp @@ -54,8 +54,7 @@ void TST_VMeasurements::CreateEmptyMultisizeFile() { Unit const mUnit = Unit::Cm; - QSharedPointer const data = - QSharedPointer(new VContainer(nullptr, &mUnit, VContainer::UniqueNamespace())); + auto const data = QSharedPointer(new VContainer(nullptr, &mUnit, VContainer::UniqueNamespace())); auto m_xDimension = QSharedPointer::create(mUnit, 50, 200, 6); m_xDimension->SetBaseValue(176); @@ -65,8 +64,7 @@ void TST_VMeasurements::CreateEmptyMultisizeFile() QVector const dimensions{m_xDimension, m_yDimension}; - QSharedPointer const m = - QSharedPointer(new VMeasurements(mUnit, dimensions, data.data())); + auto const m = QSharedPointer(new VMeasurements(mUnit, dimensions, data.data())); QTemporaryFile file; QString fileName; @@ -106,10 +104,9 @@ void TST_VMeasurements::CreateEmptyIndividualFile() { Unit const mUnit = Unit::Cm; - QSharedPointer const data = - QSharedPointer(new VContainer(nullptr, &mUnit, VContainer::UniqueNamespace())); + auto const data = QSharedPointer(new VContainer(nullptr, &mUnit, VContainer::UniqueNamespace())); - QSharedPointer const m = QSharedPointer(new VMeasurements(mUnit, data.data())); + auto const m = QSharedPointer(new VMeasurements(mUnit, data.data())); QTemporaryFile file; QString fileName; diff --git a/src/test/ValentinaTest/tst_vspline.cpp b/src/test/ValentinaTest/tst_vspline.cpp index 37c0b89fb..228bbb9ac 100644 --- a/src/test/ValentinaTest/tst_vspline.cpp +++ b/src/test/ValentinaTest/tst_vspline.cpp @@ -863,7 +863,7 @@ void TST_VSpline::TestCutSpline_data() QStringLiteral("Line_Г3_Г6*1.1"), 226.7716535433071, QStringLiteral("6")); spl.SetApproximationScale(0.5); - QString const name(QStringLiteral("з")); + auto const name(QStringLiteral("з")); qreal const result = 1.35; // Correct distance in cm. // See file valentina_private_collection/bugs/men_jacket/issue_cut_spline.val (private collection) @@ -879,7 +879,7 @@ void TST_VSpline::TestCutSpline_data() VSpline const spl(p1, p4, 175.0, QStringLiteral("175"), 5.0, QStringLiteral("5"), 151.18110236220474, QStringLiteral("4"), 151.18110236220474, QStringLiteral("4")); - QString const name(QStringLiteral("А193")); + auto const name(QStringLiteral("А193")); const qreal result = 4.5090698038574057; // Correct distance in cm. // See file valentina_private_collection/bugs/coat/coat.val (private collection) QTest::newRow("Half of a curve") << spl << result << name;