Refactoring.

Replace the redundant type with "auto".
This commit is contained in:
Roman Telezhynskyi 2024-05-04 09:14:22 +03:00
parent 143d709e83
commit d997f74620
39 changed files with 109 additions and 114 deletions

View File

@ -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";

View File

@ -3959,7 +3959,7 @@ 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*/
auto const arcs = QStringList() << VToolArc::ToolType /*0*/
<< VNodeArc::ToolType /*1*/
<< VToolArcWithLength::ToolType; /*2*/
@ -3995,7 +3995,7 @@ 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*/
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,7 +4068,7 @@ 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*/
const auto opers = QStringList() << VToolRotation::ToolType /*0*/
<< VToolFlippingByLine::ToolType /*1*/
<< VToolFlippingByAxis::ToolType /*2*/
<< VToolMove::ToolType; /*3*/

View File

@ -592,7 +592,7 @@ void FvUpdater::IgnoreVersion(const QString &version)
//---------------------------------------------------------------------------------------------------------------------
auto FvUpdater::CurrentlyRunningOnPlatform(const QString &platform) -> bool
{
const QStringList platforms = QStringList() << "Q_OS_LINUX"
const auto platforms = QStringList() << "Q_OS_LINUX"
<< "Q_OS_MAC"
<< "Q_OS_WIN32";

View File

@ -1436,7 +1436,7 @@ auto VPatternConverter::OldNamesToNewNames_InV0_2_1() -> QMap<QString, QString>
//---------------------------------------------------------------------------------------------------------------------
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,7 +1781,7 @@ 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"
const auto units = QStringList() << "mm"
<< "cm"
<< "inch";
switch (units.indexOf(UniqueTagText(*strUnit)))
@ -1836,7 +1836,7 @@ auto VPatternConverter::AddTagPatternLabelV0_5_1() -> QDomElement
const QDomNodeList list = elementsByTagName(*strPatternLabel);
if (list.isEmpty())
{
const QStringList tags = QStringList() << *strUnit << *strImage << *strAuthor << *strDescription << *strNotes
const auto tags = QStringList() << *strUnit << *strImage << *strAuthor << *strDescription << *strNotes
<< *strGradation << *strPatternName << *strPatternNum << *strCompanyName
<< *strCustomerName << *strPatternLabel;
@ -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);

View File

@ -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

View File

@ -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.

View File

@ -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<qreal> t = QVector<qreal>(3, -1);
auto t = QVector<qreal>(3, -1);
Cubic(t, b / a, c / a, d / a);
QVector<qreal> retT;

View File

@ -134,7 +134,7 @@ auto FindLabelGeometry(const VPatternLabelData &labelData, const VContainer *pat
const auto topLeftPinPoint = pattern->GeometricObject<VPointF>(topLeftPin);
const auto bottomRightPinPoint = pattern->GeometricObject<VPointF>(bottomRightPin);
const QRectF labelRect =
const auto labelRect =
QRectF(static_cast<QPointF>(*topLeftPinPoint), static_cast<QPointF>(*bottomRightPinPoint));
labelWidth = qAbs(labelRect.width());
labelHeight = qAbs(labelRect.height());

View File

@ -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<QRgb *>(scan + jj * depth);
auto *rgbpixel = reinterpret_cast<QRgb *>(scan + jj * depth);
int const gray = qGray(*rgbpixel);
*rgbpixel = QColor(gray, gray, gray, qAlpha(*rgbpixel)).rgba();
}

View File

@ -557,7 +557,7 @@ void VPrintLayout::SetPrinterPageSize(QPrinter *printer)
}
}
QSizeF size = QSizeF(width, height);
auto size = QSizeF(width, height);
if (not m_isLayoutPortrait)
{

View File

@ -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;
}

View File

@ -526,7 +526,7 @@ auto VAbstractApplication::GetPlaceholderTranslator() -> QSharedPointer<VTransla
return QSharedPointer<VTranslator>(new VTranslator);
}
QSharedPointer<VTranslator> translator = QSharedPointer<VTranslator>(new VTranslator);
auto translator = QSharedPointer<VTranslator>(new VTranslator);
const QString appQmDir = VAbstractApplication::translationsPath(settings->GetLocale());
if (translator->load(QStringLiteral("valentina_") + pieceLabelLocale, appQmDir))
{

View File

@ -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<QPointF> points;

View File

@ -1330,7 +1330,7 @@ void DialogSeamAllowance::ShowPlaceLabelsContextMenu(const QPoint &pos)
auto SaveType = [this, &currentLabel, 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());

View File

@ -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);

View File

@ -149,7 +149,7 @@ auto VToolArc::Create(VToolArcInitData &initData) -> VToolArc *
calcF2 = CheckFormula(initData.id, initData.f2, initData.data);
const VPointF c = *initData.data->GeometricObject<VPointF>(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);

View File

@ -131,7 +131,7 @@ auto VToolArcWithLength::Create(VToolArcWithLengthInitData &initData) -> VToolAr
calcF1 = CheckFormula(initData.id, initData.f1, initData.data);
const VPointF c = *initData.data->GeometricObject<VPointF>(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);

View File

@ -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<QPointF>(*VAbstractTool::data.GeometricObject<VPointF>(spl->GetP1().id()));
const auto splinePoint = static_cast<QPointF>(*VAbstractTool::data.GeometricObject<VPointF>(spl->GetP1().id()));
controlPoints[0]->RefreshCtrlPoint(1, SplinePointPosition::FirstPoint, static_cast<QPointF>(spl->GetP2()),
static_cast<QPointF>(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<QPointF>(*VAbstractTool::data.GeometricObject<VPointF>(spl->GetP4().id()));
const auto splinePoint = static_cast<QPointF>(*VAbstractTool::data.GeometricObject<VPointF>(spl->GetP4().id()));
controlPoints[1]->RefreshCtrlPoint(1, SplinePointPosition::LastPoint, static_cast<QPointF>(spl->GetP3()),
static_cast<QPointF>(splinePoint), freeAngle2, freeLength2);
}

View File

@ -231,7 +231,7 @@ void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, cons
moved = true;
}
QSharedPointer<VSplinePath> newSplPath = QSharedPointer<VSplinePath>::create(*oldSplPath);
auto newSplPath = QSharedPointer<VSplinePath>::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);

View File

@ -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");

View File

@ -236,10 +236,10 @@ auto VToolCutSplinePath::CutSplinePath(qreal length, const QSharedPointer<VAbstr
const VSplinePoint splP1 = points.at(p1);
const VSplinePoint splP2 = points.at(p2);
VSpline spl1 = VSpline(splP1.P(), spl1p2, spl1p3, *p);
auto spl1 = VSpline(splP1.P(), spl1p2, spl1p3, *p);
spl1.SetApproximationScale(splPath->GetApproximationScale());
VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P());
auto spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P());
spl2.SetApproximationScale(splPath->GetApproximationScale());
*splPath1 = new VSplinePath();

View File

@ -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)

View File

@ -284,7 +284,7 @@ void VToolLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void VToolLine::AddToFile()
{
QDomElement domElement = doc->createElement(getTagName());
QSharedPointer<VGObject> obj = QSharedPointer<VGObject>();
auto obj = QSharedPointer<VGObject>();
SaveOptions(domElement, obj);
AddToCalculation(domElement);
}

View File

@ -210,7 +210,7 @@ inline auto VAbstractTool::getData() const -> const VContainer *
//---------------------------------------------------------------------------------------------------------------------
template <typename T> inline void VAbstractTool::AddVisualization()
{
T *visual = new T(getData());
auto *visual = new T(getData());
auto *scene = qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
// cppcheck-suppress unknownMacro
SCASSERT(scene != nullptr)
@ -231,7 +231,7 @@ template <typename T>
auto VAbstractTool::CreateNode(VContainer *data, quint32 id) -> quint32
{
// We can't use exist object. Need create new.
T *node = new T(*data->GeometricObject<T>(id).data());
auto *node = new T(*data->GeometricObject<T>(id).data());
node->setMode(Draw::Modeling);
node->setIdObject(id);
return data->AddGObject(node);

View File

@ -2150,7 +2150,7 @@ auto VToolSeamAllowance::FindLabelGeometry(const VPatternLabelData &labelData, c
const auto topLeftPinPoint = VAbstractTool::data.GeometricObject<VPointF>(topLeftPin);
const auto bottomRightPinPoint = VAbstractTool::data.GeometricObject<VPointF>(bottomRightPin);
const QRectF labelRect =
const auto labelRect =
QRectF(static_cast<QPointF>(*topLeftPinPoint), static_cast<QPointF>(*bottomRightPinPoint));
labelWidth = FromPixel(qAbs(labelRect.width()), *VDataTool::data.GetPatternUnit());
labelHeight = FromPixel(qAbs(labelRect.height()), *VDataTool::data.GetPatternUnit());

View File

@ -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<VArc> arc = initData.data->GeometricObject<VArc>(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<VPointF> 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<VEllipticalArc> arc = initData.data->GeometricObject<VEllipticalArc>(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<VPointF> 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<QPointF>(p2), static_cast<QPointF>(p3), *p4);
auto const spl = VSpline(*p1, static_cast<QPointF>(p2), static_cast<QPointF>(p3), *p4);
if (i == 1)
{
const qreal angle1 = spl.GetStartAngle() + 180;
@ -937,8 +937,8 @@ void UpdateNodeArc(VContainer *data, const VPieceNode &node, QVector<quint32> &c
quint32 pRotate, qreal angle)
{
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(node.GetId());
VPointF p1 = VPointF(arc->GetP1());
VPointF p2 = VPointF(arc->GetP2());
auto p1 = VPointF(arc->GetP1());
auto p2 = VPointF(arc->GetP2());
QScopedPointer<VPointF> 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>
quint32 pRotate, qreal angle)
{
const QSharedPointer<VEllipticalArc> arc = data->GeometricObject<VEllipticalArc>(node.GetId());
VPointF p1 = VPointF(arc->GetP1());
VPointF p2 = VPointF(arc->GetP2());
auto p1 = VPointF(arc->GetP1());
auto p2 = VPointF(arc->GetP2());
QScopedPointer<VPointF> 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<quin
BiasRotatePoint(p4.data(), dx, dy, p, angle);
}
VSpline const spl = VSpline(*p1, static_cast<QPointF>(p2), static_cast<QPointF>(p3), *p4);
auto const spl = VSpline(*p1, static_cast<QPointF>(p2), static_cast<QPointF>(p3), *p4);
if (i == 1)
{
const qreal angle1 = spl.GetStartAngle() + 180;
@ -1861,7 +1861,7 @@ auto VToolUnionDetails::GetReferenceObjects() const -> QVector<quint32>
return list;
}
const QStringList parts = QStringList() << VAbstractPattern::TagNodes /*0*/
const auto parts = QStringList() << VAbstractPattern::TagNodes /*0*/
<< VToolSeamAllowance::TagCSA /*1*/
<< VToolSeamAllowance::TagIPaths /*2*/
<< VToolSeamAllowance::TagPins /*3*/

View File

@ -72,7 +72,7 @@ void VisToolRotation::RefreshGeometry()
return;
}
QSharedPointer<VPointF> origin = QSharedPointer<VPointF>(new VPointF());
auto origin = QSharedPointer<VPointF>(new VPointF());
qreal tempAngle = 0;

View File

@ -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<DirectionArrow>(), 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<DirectionArrow>(), 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);
}

View File

@ -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<DirectionArrow>(), 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<DirectionArrow>(), 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);
}

View File

@ -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);

View File

@ -154,7 +154,7 @@ template <typename Item> inline void Visualization::AddItem(Item *item)
//---------------------------------------------------------------------------------------------------------------------
template <class Item> 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);

View File

@ -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<int>(Qt::AlignCenter | (drawIcon ? Qt::AlignBottom : Qt::AlignVCenter) | Qt::TextWordWrap);
if (enabled)
{

View File

@ -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<QRgb *>(im.scanLine(y));
auto *scanLine = reinterpret_cast<QRgb *>(im.scanLine(y));
for (int x = 0; x < im.width(); ++x)
{
QRgb const pixel = *scanLine;

View File

@ -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)));

View File

@ -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();

View File

@ -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)));

View File

@ -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<VLayoutPoint> inputPoints;
CastTo(InputPointsCase1(), inputPoints);
det.SetContourPoints(inputPoints);
@ -122,7 +122,7 @@ QVector<QPointF> TST_VLayoutDetail::OutputPointsCase1() const //-V524
//---------------------------------------------------------------------------------------------------------------------
void TST_VLayoutDetail::Case2() const
{
VLayoutPiece det = VLayoutPiece();
VLayoutPiece det;
QVector<VLayoutPoint> inputPoints;
CastTo(InputPointsCase2(), inputPoints);
det.SetContourPoints(inputPoints);
@ -140,9 +140,9 @@ auto TST_VLayoutDetail::InputPointsCase2() const -> QVector<QPointF>
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<QPointF>
//---------------------------------------------------------------------------------------------------------------------
void TST_VLayoutDetail::Case3() const
{
VLayoutPiece det = VLayoutPiece();
VLayoutPiece det;
QVector<VLayoutPoint> inputPoints;
CastTo(InputPointsCase3(), inputPoints);
det.SetContourPoints(inputPoints);
@ -183,7 +183,7 @@ auto TST_VLayoutDetail::InputPointsCase3() const -> QVector<QPointF>
{
QVector<QPointF> 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<QPointF> TST_VLayoutDetail::OutputPointsCase3() const //-V524
{
QVector<QPointF> points;
points += QPointF(557.0, -94.0);// Only one point
points += QPointF(557.0, -94.0); // Only one point
return points;
}

View File

@ -54,8 +54,7 @@ void TST_VMeasurements::CreateEmptyMultisizeFile()
{
Unit const mUnit = Unit::Cm;
QSharedPointer<VContainer> const data =
QSharedPointer<VContainer>(new VContainer(nullptr, &mUnit, VContainer::UniqueNamespace()));
auto const data = QSharedPointer<VContainer>(new VContainer(nullptr, &mUnit, VContainer::UniqueNamespace()));
auto m_xDimension = QSharedPointer<VXMeasurementDimension>::create(mUnit, 50, 200, 6);
m_xDimension->SetBaseValue(176);
@ -65,8 +64,7 @@ void TST_VMeasurements::CreateEmptyMultisizeFile()
QVector<MeasurementDimension_p> const dimensions{m_xDimension, m_yDimension};
QSharedPointer<VMeasurements> const m =
QSharedPointer<VMeasurements>(new VMeasurements(mUnit, dimensions, data.data()));
auto const m = QSharedPointer<VMeasurements>(new VMeasurements(mUnit, dimensions, data.data()));
QTemporaryFile file;
QString fileName;
@ -106,10 +104,9 @@ void TST_VMeasurements::CreateEmptyIndividualFile()
{
Unit const mUnit = Unit::Cm;
QSharedPointer<VContainer> const data =
QSharedPointer<VContainer>(new VContainer(nullptr, &mUnit, VContainer::UniqueNamespace()));
auto const data = QSharedPointer<VContainer>(new VContainer(nullptr, &mUnit, VContainer::UniqueNamespace()));
QSharedPointer<VMeasurements> const m = QSharedPointer<VMeasurements>(new VMeasurements(mUnit, data.data()));
auto const m = QSharedPointer<VMeasurements>(new VMeasurements(mUnit, data.data()));
QTemporaryFile file;
QString fileName;

View File

@ -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;