From ed970fe6f618d1d8ccaa5a1ae04eba22198a3157 Mon Sep 17 00:00:00 2001 From: llocram Date: Fri, 28 Aug 2020 13:57:14 +0200 Subject: [PATCH] Minor refactoring --- src/libs/vlayout/vlayoutpiece.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index 680683785..6a9f61a98 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -175,7 +175,7 @@ QVector PrepareAllowance(const QVector &points) { QVector allowancePoints; allowancePoints.reserve(points.size()); - for(auto point : points) + for(auto &point : points) { allowancePoints.append(VSAPoint(point)); } @@ -206,8 +206,9 @@ QStringList PieceLabelText(const QVector &labelShape, const VTextManage QStringList text; if (labelShape.count() > 2) { - text.reserve(tm.GetSourceLinesCount()); - for (int i = 0; i < tm.GetSourceLinesCount(); ++i) + int sourceCount = tm.GetSourceLinesCount(); + text.reserve(sourceCount); + for (int i = 0; i < sourceCount; ++i) { text.append(tm.GetSourceLine(i).m_qsText); } @@ -219,9 +220,9 @@ QStringList PieceLabelText(const QVector &labelShape, const VTextManage QVector ConvertPlaceLabels(const VPiece &piece, const VContainer *pattern) { QVector labels; - const QVector placeLabels = piece.GetPlaceLabels(); + const auto placeLabels = piece.GetPlaceLabels(); labels.reserve(placeLabels.size()); - for(auto placeLabel : placeLabels) + for(auto &placeLabel : placeLabels) { const auto label = pattern->GeometricObject(placeLabel); if (label->IsVisible())