Merge branch 'maintenance/improvement2' into 'develop'

Code smell and performance

See merge request smart-pattern/valentina!20
This commit is contained in:
Roman Telezhynskyi 2024-02-24 10:10:04 +00:00
commit 2c58867ed9
34 changed files with 72 additions and 72 deletions

View File

@ -310,7 +310,7 @@ void PuzzlePreferencesConfigurationPage::InitShortcuts(bool defaults)
}
//---------------------------------------------------------------------------------------------------------------------
void PuzzlePreferencesConfigurationPage::UpdateShortcutsTable()
void PuzzlePreferencesConfigurationPage::UpdateShortcutsTable() const
{
for (int i = 0; i < m_transientShortcuts.length(); i++)
{
@ -320,7 +320,7 @@ void PuzzlePreferencesConfigurationPage::UpdateShortcutsTable()
}
//---------------------------------------------------------------------------------------------------------------------
void PuzzlePreferencesConfigurationPage::RetranslateShortcutsTable()
void PuzzlePreferencesConfigurationPage::RetranslateShortcutsTable() const
{
VAbstractShortcutManager *manager = VAbstractApplication::VApp()->GetShortcutManager();
if (manager == nullptr)

View File

@ -61,8 +61,8 @@ private:
void SetThemeModeComboBox();
void InitShortcuts(bool defaults = false);
void UpdateShortcutsTable();
void RetranslateShortcutsTable();
void UpdateShortcutsTable() const;
void RetranslateShortcutsTable() const;
};
#endif // PUZZLEPREFERENCESCONFIGURATIONPAGE_H

View File

@ -680,7 +680,7 @@ void PuzzlePreferencesLayoutPage::ReadSettings()
}
//---------------------------------------------------------------------------------------------------------------------
void PuzzlePreferencesLayoutPage::FindTemplate(QComboBox *box, qreal width, qreal height)
void PuzzlePreferencesLayoutPage::FindTemplate(QComboBox *box, qreal width, qreal height) const
{
SCASSERT(box != nullptr)
const Unit paperUnit = LayoutUnit();

View File

@ -99,7 +99,7 @@ private:
void ReadSettings();
void FindTemplate(QComboBox *box, qreal width, qreal height);
void FindTemplate(QComboBox *box, qreal width, qreal height) const;
};
#endif // PUZZLEPREFERENCESLAYOUTPAGE_H

View File

@ -56,7 +56,7 @@ PuzzlePreferencesPathPage::PuzzlePreferencesPathPage(QWidget *parent)
PuzzlePreferencesPathPage::~PuzzlePreferencesPathPage() = default;
//---------------------------------------------------------------------------------------------------------------------
void PuzzlePreferencesPathPage::Apply()
void PuzzlePreferencesPathPage::Apply() const
{
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
settings->SetPathSVGFonts(ui->pathTable->item(0, 1)->text());
@ -78,7 +78,7 @@ void PuzzlePreferencesPathPage::changeEvent(QEvent *event)
}
//---------------------------------------------------------------------------------------------------------------------
void PuzzlePreferencesPathPage::DefaultPath()
void PuzzlePreferencesPathPage::DefaultPath() const
{
const int row = ui->pathTable->currentRow();
QTableWidgetItem *item = ui->pathTable->item(row, 1);

View File

@ -44,13 +44,13 @@ public:
explicit PuzzlePreferencesPathPage(QWidget *parent = nullptr);
~PuzzlePreferencesPathPage() override;
void Apply();
void Apply() const;
protected:
void changeEvent(QEvent *event) override;
private slots:
void DefaultPath();
void DefaultPath() const;
void EditPath();
private:

View File

@ -217,7 +217,7 @@ void VPPiece::ClearTransformations()
}
//---------------------------------------------------------------------------------------------------------------------
void VPPiece::SetPosition(QPointF point)
void VPPiece::SetPosition(QPointF point) const
{
QTransform matrix = GetMatrix();
const QPointF offset = MappedDetailBoundingRect().topLeft();
@ -226,7 +226,7 @@ void VPPiece::SetPosition(QPointF point)
}
//---------------------------------------------------------------------------------------------------------------------
auto VPPiece::GetPosition() -> QPointF
auto VPPiece::GetPosition() const -> QPointF
{
QTransform const matrix = GetMatrix();
return {matrix.dx(), matrix.dy()};

View File

@ -65,13 +65,13 @@ public:
* @brief SetPosition Sets the position of the piece, in relation to the origin of the scene
* @param point the point where to set the piece
*/
void SetPosition(QPointF point);
void SetPosition(QPointF point) const;
/**
* @brief GetPosition Returns the position of the piece
* @return the position of the piece
*/
auto GetPosition() -> QPointF;
auto QPointF GetPosition() -> QPointF;
/**
* @brief RotateToGrainline rotates the piece to follow the grainline

View File

@ -310,7 +310,7 @@ void VPSheetSceneData::RefreshSheetSize()
}
//---------------------------------------------------------------------------------------------------------------------
void VPSheetSceneData::ConnectPiece(VPGraphicsPiece *piece)
void VPSheetSceneData::ConnectPiece(VPGraphicsPiece *piece) const
{
SCASSERT(piece != nullptr)

View File

@ -129,7 +129,7 @@ private:
bool m_outOfBoundTmp{false};
bool m_pieceSuperpositionTmp{false};
void ConnectPiece(VPGraphicsPiece *piece);
void ConnectPiece(VPGraphicsPiece *piece) const;
};
class VPSheet : public QObject

View File

@ -205,7 +205,7 @@ VPGraphicsPiece::VPGraphicsPiece(const VPPiecePtr &piece, QGraphicsItem *parent)
}
//---------------------------------------------------------------------------------------------------------------------
auto VPGraphicsPiece::GetPiece() -> VPPiecePtr
auto VPGraphicsPiece::GetPiece() const -> VPPiecePtr
{
return m_piece.toStrongRef();
}
@ -809,7 +809,7 @@ void VPGraphicsPiece::PaintInternalPaths(QPainter *painter, const VPPiecePtr &pi
QVector<VLayoutPoint> points = piecePath.Points();
const QTransform matrix = VGObject::FlippingMatrix(piece->GetSeamMirrorLine());
std::transform(points.begin(), points.end(), points.begin(),
[matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
[&matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
QVector<QPointF> casted;
CastTo(points, casted);
path.addPath(piece->GetMatrix().map(VPiecePath::MakePainterPath(casted)));
@ -893,7 +893,7 @@ void VPGraphicsPiece::PaintPlaceLabels(QPainter *painter, const VPPiecePtr &piec
for (auto &points : shape)
{
std::transform(points.begin(), points.end(), points.begin(),
[matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
[&matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
}
path.addPath(VAbstractPiece::LabelShapePath(piece->MapPlaceLabelShape(shape)));
@ -939,7 +939,7 @@ void VPGraphicsPiece::PaintStickyPath(QPainter *painter)
}
//---------------------------------------------------------------------------------------------------------------------
void VPGraphicsPiece::PaintMirrorLine(QPainter *painter, const VPPiecePtr &piece)
void VPGraphicsPiece::PaintMirrorLine(QPainter *painter, const VPPiecePtr &piece) const
{
if (piece->IsShowFullPiece())
{

View File

@ -50,7 +50,7 @@ public:
* @brief GetPiece Returns the piece that corresponds to the graphics piece
* @return the piece
*/
auto GetPiece() -> VPPiecePtr;
auto GetPiece() const -> VPPiecePtr;
auto type() const -> int override { return Type; }
enum
@ -133,7 +133,7 @@ private:
void PaintPassmarks(QPainter *painter, const VPPiecePtr &piece);
void PaintPlaceLabels(QPainter *painter, const VPPiecePtr &piece);
void PaintStickyPath(QPainter *painter);
void PaintMirrorLine(QPainter *painter, const VPPiecePtr &piece);
void PaintMirrorLine(QPainter *painter, const VPPiecePtr &piece) const;
void PaintFoldLine(QPainter *painter, const VPPiecePtr &piece);
void GroupMove(const QPointF &pos);

View File

@ -167,7 +167,7 @@ void VPGraphicsTileGrid::paint(QPainter *painter, const QStyleOptionGraphicsItem
VWatermarkData const watermarkData = layout->TileFactory()->WatermarkData();
auto PaintWatermark = [painter, layout, xScale, yScale, watermarkData](const QRectF &img)
auto PaintWatermark = [painter, layout, xScale, yScale, &watermarkData](const QRectF &img)
{
if (not layout->LayoutSettings().WatermarkPath().isEmpty() && layout->LayoutSettings().GetShowWatermark() &&
watermarkData.opacity > 0)

View File

@ -103,7 +103,7 @@ VPMainGraphicsView::VPMainGraphicsView(const VPLayoutPtr &layout, QWidget *paren
}
//---------------------------------------------------------------------------------------------------------------------
void VPMainGraphicsView::RefreshLayout()
void VPMainGraphicsView::RefreshLayout() const
{
VPLayoutPtr const layout = m_layout.toStrongRef();
if (not layout.isNull())
@ -117,7 +117,7 @@ void VPMainGraphicsView::RefreshLayout()
}
//---------------------------------------------------------------------------------------------------------------------
void VPMainGraphicsView::RefreshPieces()
void VPMainGraphicsView::RefreshPieces() const
{
VPLayoutPtr const layout = m_layout.toStrongRef();
if (not layout.isNull())
@ -570,7 +570,7 @@ void VPMainGraphicsView::SwitchScene(const VPSheetPtr &sheet)
}
//---------------------------------------------------------------------------------------------------------------------
void VPMainGraphicsView::ClearSelection()
void VPMainGraphicsView::ClearSelection() const
{
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
@ -593,7 +593,7 @@ void VPMainGraphicsView::ClearSelection()
}
//---------------------------------------------------------------------------------------------------------------------
void VPMainGraphicsView::ZValueMove(int move)
void VPMainGraphicsView::ZValueMove(int move) const
{
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())

View File

@ -52,7 +52,7 @@ public:
/**
* @brief RefreshLayout Refreshes the rectangles for the layout border and the margin
*/
void RefreshLayout();
void RefreshLayout() const;
public slots:
/**
@ -64,7 +64,7 @@ public slots:
void on_ActiveSheetChanged(const VPSheetPtr &focusedSheet);
void RefreshPieces();
void RefreshPieces() const;
signals:
/**
@ -108,9 +108,9 @@ private:
void TranslatePiecesOn(qreal dx, qreal dy);
void SwitchScene(const VPSheetPtr &sheet);
void ClearSelection();
void ClearSelection() const;
void ZValueMove(int move);
void ZValueMove(int move) const;
void RemovePiece() const;
void MovePiece(QKeyEvent *event);

View File

@ -689,7 +689,7 @@ void VPTileFactory::PaintWatermarkImage(QPainter *painter, const QRectF &img, co
SCASSERT(painter != nullptr)
const qreal opacity = watermarkData.opacity / 100.;
auto BrokenImage = [img, watermarkData, watermarkPath, opacity, folowColorScheme]()
auto BrokenImage = [&img, &watermarkData, watermarkPath, opacity, folowColorScheme]()
{
QString colorScheme = QStringLiteral("light");

View File

@ -912,7 +912,7 @@ void VDxfEngine::ExportAAMADrawSewLine(const QSharedPointer<dx_ifaceBlock> &deta
const UTF8STRING &layer = not detail.IsSewLineOnDrawing() ? *layer14 : *layer8;
QVector<VLayoutPoint> const points = detail.GetMappedFullContourPoints();
auto DrawPolygon = [this, detailBlock, layer](const QVector<VLayoutPoint> &points, bool forceClosed)
auto DrawPolygon = [this, detailBlock, &layer](const QVector<VLayoutPoint> &points, bool forceClosed)
{
if (DRW_Entity *e = AAMAPolygon(points, layer, forceClosed))
{
@ -977,7 +977,7 @@ void VDxfEngine::ExportAAMADrawInternalPaths(const QSharedPointer<dx_ifaceBlock>
{
const QTransform matrix = VGObject::FlippingMatrix(detail.GetMappedSeamMirrorLine());
std::transform(points.begin(), points.end(), points.begin(),
[matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
[&matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
DrawPolygon(points, iPath.PenStyle(), false);
}
}
@ -1015,7 +1015,7 @@ void VDxfEngine::ExportAAMADrawPlaceLabels(const QSharedPointer<dx_ifaceBlock> &
for (auto &points : shape)
{
std::transform(points.begin(), points.end(), points.begin(),
[matrix](const VLayoutPoint &point)
[&matrix](const VLayoutPoint &point)
{ return VAbstractPiece::MapPoint(point, matrix); });
}
@ -1049,7 +1049,7 @@ void VDxfEngine::ExportAAMAIntcut(const QSharedPointer<dx_ifaceBlock> &detailBlo
{
const QTransform matrix = VGObject::FlippingMatrix(detail.GetMappedSeamMirrorLine());
std::transform(points.begin(), points.end(), points.begin(),
[matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
[&matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
DrawPolygon(points, false);
}
}
@ -1524,7 +1524,7 @@ void VDxfEngine::ExportASTMDrawInternalPaths(const QSharedPointer<dx_ifaceBlock>
{
const QTransform matrix = VGObject::FlippingMatrix(detail.GetMappedSeamMirrorLine());
std::transform(points.begin(), points.end(), points.begin(),
[matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
[&matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
DrawPolygon(points, iPath.PenStyle(), iPath.IsNotMirrored(), false);
}
}
@ -1576,7 +1576,7 @@ void VDxfEngine::ExportASTMDrawPlaceLabels(const QSharedPointer<dx_ifaceBlock> &
for (auto &points : shape)
{
std::transform(points.begin(), points.end(), points.begin(),
[matrix](const VLayoutPoint &point)
[&matrix](const VLayoutPoint &point)
{ return VAbstractPiece::MapPoint(point, matrix); });
}
@ -1624,7 +1624,7 @@ void VDxfEngine::ExportASTMInternalCutout(const QSharedPointer<dx_ifaceBlock> &d
{
const QTransform matrix = VGObject::FlippingMatrix(detail.GetMappedSeamMirrorLine());
std::transform(points.begin(), points.end(), points.begin(),
[matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
[&matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
DrawPolygon(points, intCut.IsNotMirrored(), false);
}
}
@ -1687,7 +1687,7 @@ void VDxfEngine::ExportASTMNotches(const QSharedPointer<dx_ifaceBlock> &detailBl
return;
}
auto ExportPassmark = [this, detailBlock, detail](const VLayoutPassmark &passmark)
auto ExportPassmark = [this, detailBlock, &detail](const VLayoutPassmark &passmark)
{
DRW_ASTMNotch *notch = ExportASTMNotch(passmark);
DRW_ATTDEF *attdef = ExportASTMNotchDataDependecy(passmark, notch->layer, detail);

View File

@ -516,7 +516,7 @@ auto VEllipticalArc::GetPoints() const -> QVector<QPointF>
t.rotate(-d->rotationAngle);
t.translate(-center.x(), -center.y());
std::transform(points.begin(), points.end(), points.begin(), [t](const QPointF &point) { return t.map(point); });
std::transform(points.begin(), points.end(), points.begin(), [&t](const QPointF &point) { return t.map(point); });
return IsFlipped() ? Reverse(points) : points;
}

View File

@ -502,7 +502,7 @@ void VHPGLEngine::PlotInternalPaths(QTextStream &out, const VLayoutPiece &detail
{
const QTransform matrix = VGObject::FlippingMatrix(detail.GetMappedSeamMirrorLine());
std::transform(points.begin(), points.end(), points.begin(),
[matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
[&matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
PlotPath(out, CastToPoint(ConvertPath(points)), path.PenStyle());
}
}
@ -531,7 +531,7 @@ void VHPGLEngine::PlotPlaceLabels(QTextStream &out, const VLayoutPiece &detail)
for (auto &points : shape)
{
std::transform(points.begin(), points.end(), points.begin(),
[matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
[&matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
}
PlotShape(shape);

View File

@ -1906,7 +1906,7 @@ auto VAbstractPiece::GrainlineMainLine(const VGrainlineData &geom, const VContai
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLabelImg
{
auto LayoutPoint = [label](QPointF p, bool turnPoint = false, bool curvePoint = false)
auto LayoutPoint = [&label](QPointF p, bool turnPoint = false, bool curvePoint = false)
{
VLayoutPoint point(label.RotationMatrix().map(p));
point.SetTurnPoint(turnPoint);
@ -1917,7 +1917,7 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
const QPointF pos = label.Center();
const QRectF box = label.Box();
auto SegmentShape = [pos, box, LayoutPoint]()
auto SegmentShape = [pos, &box, &LayoutPoint]()
{
QVector<VLayoutPoint> const shape{LayoutPoint(QPointF(pos.x(), pos.y() - box.height() / 2.0), true),
LayoutPoint(QPointF(pos.x(), pos.y() + box.height() / 2.0), true)};
@ -1925,7 +1925,7 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
return PlaceLabelImg{shape};
};
auto RectangleShape = [pos, box, LayoutPoint]()
auto RectangleShape = [pos, &box, &LayoutPoint]()
{
QRectF const rect(QPointF(pos.x() - box.width() / 2.0, pos.y() - box.height() / 2.0),
QPointF(pos.x() + box.width() / 2.0, pos.y() + box.height() / 2.0));
@ -1937,7 +1937,7 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
return PlaceLabelImg{shape};
};
auto CrossShape = [pos, box, LayoutPoint]()
auto CrossShape = [pos, &box, &LayoutPoint]()
{
QVector<VLayoutPoint> const shape1{LayoutPoint(QPointF(pos.x(), pos.y() - box.height() / 2.0), true),
LayoutPoint(QPointF(pos.x(), pos.y() + box.height() / 2.0), true)};
@ -1948,7 +1948,7 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
return PlaceLabelImg{shape1, shape2};
};
auto TshapedShape = [pos, box, LayoutPoint]()
auto TshapedShape = [pos, &box, &LayoutPoint]()
{
QPointF const center2(pos.x(), pos.y() + box.height() / 2.0);
@ -1960,7 +1960,7 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
return PlaceLabelImg{shape1, shape2};
};
auto DoubletreeShape = [pos, box, LayoutPoint]()
auto DoubletreeShape = [pos, &box, &LayoutPoint]()
{
QRectF const rect(QPointF(pos.x() - box.width() / 2.0, pos.y() - box.height() / 2.0),
QPointF(pos.x() + box.width() / 2.0, pos.y() + box.height() / 2.0));
@ -1972,7 +1972,7 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
return PlaceLabelImg{shape1, shape2};
};
auto CornerShape = [pos, box, LayoutPoint]()
auto CornerShape = [pos, &box, &LayoutPoint]()
{
QVector<VLayoutPoint> const shape1{LayoutPoint(QPointF(pos.x(), pos.y()), true),
LayoutPoint(QPointF(pos.x(), pos.y() + box.height() / 2.0), true)};
@ -1983,7 +1983,7 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
return PlaceLabelImg{shape1, shape2};
};
auto TriangleShape = [pos, box, LayoutPoint]()
auto TriangleShape = [pos, &box, &LayoutPoint]()
{
QRectF const rect(QPointF(pos.x() - box.width() / 2.0, pos.y() - box.height() / 2.0),
QPointF(pos.x() + box.width() / 2.0, pos.y() + box.height() / 2.0));
@ -1994,7 +1994,7 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
return PlaceLabelImg{shape};
};
auto HshapedShape = [pos, box, LayoutPoint]()
auto HshapedShape = [pos, &box, &LayoutPoint]()
{
const QPointF center1(pos.x(), pos.y() - box.height() / 2.0);
const QPointF center2(pos.x(), pos.y() + box.height() / 2.0);
@ -2010,7 +2010,7 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
return PlaceLabelImg{shape1, shape2, shape3};
};
auto ButtonShape = [pos, box, LayoutPoint]()
auto ButtonShape = [pos, &box, &LayoutPoint]()
{
const qreal radius = qMin(box.width() / 2.0, box.height() / 2.0);
QVector<VLayoutPoint> const shape1{LayoutPoint(QPointF(pos.x(), pos.y() - radius), true),
@ -2044,7 +2044,7 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
return PlaceLabelImg{shape1, shape2, shape3};
};
auto CircleShape = [pos, box, LayoutPoint]()
auto CircleShape = [pos, &box, &LayoutPoint]()
{
const qreal radius = qMin(box.width() / 2.0, box.height() / 2.0);
VArc arc(VPointF(pos), radius, 0, 360);

View File

@ -940,7 +940,7 @@ template <class T>
inline auto VAbstractPiece::MapVector(QVector<T> points, const QTransform &matrix, bool mirror) -> QVector<T>
{
std::transform(points.begin(), points.end(), points.begin(),
[matrix](const T &point) { return MapPoint(point, matrix); });
[&matrix](const T &point) { return MapPoint(point, matrix); });
if (mirror)
{
std::reverse(points.begin(), points.end());

View File

@ -84,7 +84,7 @@ auto VBestSquare::operator=(VBestSquare &&res) noexcept -> VBestSquare &
//---------------------------------------------------------------------------------------------------------------------
void VBestSquare::NewResult(const VBestSquareResData &data)
{
auto SaveResult = [this, data]()
auto SaveResult = [this, &data]()
{
d->valideResult = true;
d->data = data;

View File

@ -459,7 +459,7 @@ auto VFoldLine::FoldLineThreeDotsPath() const -> QVector<QPainterPath>
ThreeDotsPosData const data = ThreeDotsData();
QPainterPath dots;
auto DrawCircle = [&dots, data](const QPointF &center)
auto DrawCircle = [&dots, &data](const QPointF &center)
{
qreal const diameter = 2 * data.radius;
qreal const x = center.x() - data.radius;

View File

@ -1693,7 +1693,7 @@ auto VLayoutPiece::GetItem(bool textAsPaths, bool togetherWithNotches, bool show
QVector<VLayoutPoint> points = path.Points();
const QTransform matrix = VGObject::FlippingMatrix(d->m_seamMirrorLine);
std::transform(points.begin(), points.end(), points.begin(),
[matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
[&matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
QVector<QPointF> casted;
CastTo(points, casted);
p.addPath(d->m_matrix.map(VPiecePath::MakePainterPath(casted)));
@ -1724,7 +1724,7 @@ auto VLayoutPiece::GetItem(bool textAsPaths, bool togetherWithNotches, bool show
for (auto &points : shape)
{
std::transform(points.begin(), points.end(), points.begin(),
[matrix](const VLayoutPoint &point) { return MapPoint(point, matrix); });
[&matrix](const VLayoutPoint &point) { return MapPoint(point, matrix); });
}
path.addPath(d->m_matrix.map(LabelShapePath(shape)));
@ -2382,7 +2382,7 @@ auto VLayoutPiece::ConvertPassmarks(const VPiece &piece, const VContainer *patte
continue;
}
auto AddPassmark = [passmark, piece, pattern, &layoutPassmarks](PassmarkSide side)
auto AddPassmark = [&passmark, &piece, pattern, &layoutPassmarks](PassmarkSide side)
{
bool ok = false;
VLayoutPassmark const layoutPassmark = PrepareSAPassmark(piece, pattern, passmark, side, ok);
@ -2392,7 +2392,7 @@ auto VLayoutPiece::ConvertPassmarks(const VPiece &piece, const VContainer *patte
}
};
auto AddBuiltInPassmark = [passmark, piece, pattern, &layoutPassmarks]()
auto AddBuiltInPassmark = [&passmark, &piece, pattern, &layoutPassmarks]()
{
bool ok = false;
VLayoutPassmark const layoutPassmark = PreapreBuiltInSAPassmark(piece, pattern, passmark, ok);

View File

@ -95,7 +95,7 @@ auto PointsToSegments(const QVector<QPointF> &points) -> QVector<QLineF>
//---------------------------------------------------------------------------------------------------------------------
auto PassmarkLength(const VPiecePassmarkData &passmarkData, qreal width, bool &ok) -> qreal
{
auto ValidateLength = [passmarkData](qreal length)
auto ValidateLength = [&passmarkData](qreal length)
{
if (length <= accuracyPointOnLine)
{

View File

@ -404,7 +404,7 @@ auto VPiece::PlaceLabelPath(const VContainer *data) const -> QPainterPath
for (auto &points : shape)
{
std::transform(points.begin(), points.end(), points.begin(),
[matrix](const VLayoutPoint &point) { return MapPoint(point, matrix); });
[&matrix](const VLayoutPoint &point) { return MapPoint(point, matrix); });
}
path.addPath(LabelShapePath(shape));

View File

@ -271,7 +271,7 @@ void DialogArc::ShowDialog(bool click)
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetCenter());
QLineF const line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
auto Angle = [line]()
auto Angle = [&line]()
{
if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
{

View File

@ -298,7 +298,7 @@ void DialogArcWithLength::ShowDialog(bool click)
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetCenter());
QLineF const line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
auto Angle = [line]()
auto Angle = [&line]()
{
if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
{

View File

@ -592,7 +592,7 @@ void DialogEllipticalArc::ShowDialog(bool click)
const QSharedPointer<VPointF> center = data->GeometricObject<VPointF>(GetCenter());
QLineF line = QLineF(static_cast<QPointF>(*center), scene->getScenePos());
auto Angle = [line]()
auto Angle = [&line]()
{
if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
{

View File

@ -1318,7 +1318,7 @@ void DialogSeamAllowance::ShowPlaceLabelsContextMenu(const QPoint &pos)
QScopedPointer<QMenu> menu(new QMenu());
auto InitAction = [currentLabel, &menu](const QString &text, PlaceLabelType type)
auto InitAction = [&currentLabel, &menu](const QString &text, PlaceLabelType type)
{
QAction *action = menu->addAction(text);
action->setCheckable(true);
@ -1326,7 +1326,7 @@ void DialogSeamAllowance::ShowPlaceLabelsContextMenu(const QPoint &pos)
return action;
};
auto SaveType = [this, currentLabel, labelId](PlaceLabelType type)
auto SaveType = [this, &currentLabel, labelId](PlaceLabelType type)
{
VPlaceLabelItem newLabel = VPlaceLabelItem(currentLabel);
newLabel.SetLabelType(type);

View File

@ -328,7 +328,7 @@ void VToolPiecePath::RefreshGeometry()
QVector<VLayoutPoint> points = path.PathPoints(this->getData(), cuttingPath);
const QTransform matrix = VGObject::FlippingMatrix(mirrorLine);
std::transform(points.begin(), points.end(), points.begin(),
[matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
[&matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
QVector<QPointF> casted;
CastTo(points, casted);
p.addPath(VPiecePath::MakePainterPath(casted));

View File

@ -1559,7 +1559,7 @@ void CreateUnitedDetail(const VToolUnionDetailsInitData &initData, qreal dx, qre
piece->RefreshGeometry(true); // Refresh internal paths
}
auto DuplicateDetail = [initData](quint32 id)
auto DuplicateDetail = [&initData](quint32 id)
{
VToolSeamAllowanceInitData initPieceData;
initPieceData.scene = initData.scene;

View File

@ -67,7 +67,7 @@ void VisToolArc::RefreshGeometry()
{
QLineF const r = QLineF(static_cast<QPointF>(*first), ScenePos());
auto Angle = [r]()
auto Angle = [&r]()
{
if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
{

View File

@ -65,7 +65,7 @@ void VisToolArcWithLength::RefreshGeometry()
{
QLineF const r = QLineF(static_cast<QPointF>(*first), ScenePos());
auto Angle = [r]()
auto Angle = [&r]()
{
if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
{