diff --git a/src/app/puzzle/carousel/vpcarrouselpiece.cpp b/src/app/puzzle/carousel/vpcarrouselpiece.cpp index f696e7bc9..c08d44b82 100644 --- a/src/app/puzzle/carousel/vpcarrouselpiece.cpp +++ b/src/app/puzzle/carousel/vpcarrouselpiece.cpp @@ -53,7 +53,7 @@ VPCarrouselPiece::VPCarrouselPiece(const VPPiecePtr &piece, QListWidget *parent) { SCASSERT(m_piece != nullptr) const int width = 120 - 8; - QString clippedText = QFontMetrics(font()).elidedText(piece->GetName(), Qt::ElideRight, width); + QString const clippedText = QFontMetrics(font()).elidedText(piece->GetName(), Qt::ElideRight, width); RefreshPieceIcon(); setText(clippedText); setToolTip(piece->GetName()); @@ -68,7 +68,7 @@ auto VPCarrouselPiece::GetPiece() const -> VPPiecePtr //--------------------------------------------------------------------------------------------------------------------- void VPCarrouselPiece::RefreshSelection() { - VPPiecePtr piece = GetPiece(); + VPPiecePtr const piece = GetPiece(); if (not piece.isNull()) { setSelected(piece->IsSelected()); @@ -84,18 +84,18 @@ void VPCarrouselPiece::RefreshPieceIcon() //--------------------------------------------------------------------------------------------------------------------- auto VPCarrouselPiece::CreatePieceIcon(const QSize &size, bool isDragIcon) const -> QIcon { - VPPiecePtr piece = GetPiece(); + VPPiecePtr const piece = GetPiece(); if (piece.isNull()) { return {}; } - QRectF boundingRect = piece->DetailBoundingRect(); - qreal canvasSize = qMax(boundingRect.height(), boundingRect.width()); - QRectF canvas = QRectF(0, 0, canvasSize, canvasSize); + QRectF const boundingRect = piece->DetailBoundingRect(); + qreal const canvasSize = qMax(boundingRect.height(), boundingRect.width()); + QRectF const canvas = QRectF(0, 0, canvasSize, canvasSize); - qreal dx = canvas.center().x() - boundingRect.center().x(); - qreal dy = canvas.center().y() - boundingRect.center().y(); + qreal const dx = canvas.center().x() - boundingRect.center().x(); + qreal const dy = canvas.center().y() - boundingRect.center().y(); QVector iconModes; iconModes.append(QIcon::Normal); @@ -119,12 +119,12 @@ auto VPCarrouselPiece::CreatePieceIcon(const QSize &size, bool isDragIcon) const painter.setRenderHint(QPainter::Antialiasing); painter.setRenderHint(QPainter::SmoothPixmapTransform); - int spacing = 2; + int const spacing = 2; painter.translate(spacing, spacing); - qreal scaleFactorX = canvasSize * 100 / (size.width() - spacing * 2) / 100; - qreal scaleFactorY = canvasSize * 100 / (size.height() - spacing * 2) / 100; + qreal const scaleFactorX = canvasSize * 100 / (size.width() - spacing * 2) / 100; + qreal const scaleFactorY = canvasSize * 100 / (size.height() - spacing * 2) / 100; painter.scale(1. / scaleFactorX, 1. / scaleFactorY); painter.setPen(QPen(style.CarrouselPieceColor(), 0.8 * qMax(scaleFactorX, scaleFactorY))); @@ -141,7 +141,7 @@ auto VPCarrouselPiece::CreatePieceIcon(const QSize &size, bool isDragIcon) const : style.CarrouselPieceForegroundColor())); bool togetherWithNotches = false; - VPLayoutPtr pieceLayout = piece->Layout(); + VPLayoutPtr const pieceLayout = piece->Layout(); if (not pieceLayout.isNull()) { togetherWithNotches = pieceLayout->LayoutSettings().IsBoundaryTogetherWithNotches(); diff --git a/src/app/puzzle/carousel/vpcarrouselpiecelist.cpp b/src/app/puzzle/carousel/vpcarrouselpiecelist.cpp index 7bdf0103d..a4c2fd45c 100644 --- a/src/app/puzzle/carousel/vpcarrouselpiecelist.cpp +++ b/src/app/puzzle/carousel/vpcarrouselpiecelist.cpp @@ -168,7 +168,7 @@ void VPCarrouselPieceList::startDrag(Qt::DropActions supportedActions) return; } - VPLayoutPtr layout = m_carrousel->Layout().toStrongRef(); + VPLayoutPtr const layout = m_carrousel->Layout().toStrongRef(); if (layout.isNull()) { return; @@ -177,11 +177,11 @@ void VPCarrouselPieceList::startDrag(Qt::DropActions supportedActions) // starts the dragging auto *drag = new QDrag(this); auto *mimeData = new VPMimeDataPiece(layout->Uuid()); - VPPiecePtr piece = pieceItem->GetPiece(); + VPPiecePtr const piece = pieceItem->GetPiece(); mimeData->SetPiecePtr(piece); - QIcon pieceIcon = pieceItem->CreatePieceIcon(QSize(120, 120), true); - QPixmap pixmap; + QIcon const pieceIcon = pieceItem->CreatePieceIcon(QSize(120, 120), true); + QPixmap const pixmap; if (!pieceIcon.isNull()) { pieceIcon.pixmap(QSize(120, 120)); @@ -194,7 +194,7 @@ void VPCarrouselPieceList::startDrag(Qt::DropActions supportedActions) m_carrousel->Refresh(); piece->SetSelected(false); - VPLayoutPtr pieceLayout = piece->Layout(); + VPLayoutPtr const pieceLayout = piece->Layout(); if (not pieceLayout.isNull()) { emit pieceLayout->PieceSelectionChanged(piece); @@ -222,8 +222,8 @@ void VPCarrouselPieceList::contextMenuEvent(QContextMenuEvent *event) auto *pieceItem = dynamic_cast(_item); SCASSERT(pieceItem != nullptr) - VPPiecePtr piece = pieceItem->GetPiece(); - VPLayoutPtr layout = piece->Layout(); + VPPiecePtr const piece = pieceItem->GetPiece(); + VPLayoutPtr const layout = piece->Layout(); if (piece.isNull() || layout.isNull()) { @@ -279,11 +279,11 @@ void VPCarrouselPieceList::contextMenuEvent(QContextMenuEvent *event) if (selectedAction == moveAction) { - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (not sheet.isNull()) { piece->ClearTransformations(); - QRectF rect = sheet->GetMarginsRect(); + QRectF const rect = sheet->GetMarginsRect(); piece->SetPosition(QPointF(rect.topLeft().x() + 1, rect.topLeft().y() + 1)); piece->SetZValue(1.0); auto *command = new VPUndoMovePieceOnSheet(layout->GetFocusedSheet(), piece); diff --git a/src/app/puzzle/dialogs/configpages/puzzlepreferenceslayoutpage.cpp b/src/app/puzzle/dialogs/configpages/puzzlepreferenceslayoutpage.cpp index 07e46f38f..1031df067 100644 --- a/src/app/puzzle/dialogs/configpages/puzzlepreferenceslayoutpage.cpp +++ b/src/app/puzzle/dialogs/configpages/puzzlepreferenceslayoutpage.cpp @@ -239,7 +239,7 @@ void PuzzlePreferencesLayoutPage::ConvertPaperSize() const qreal newTileTopMargin = UnitConvertor(tileTopMargin, m_oldLayoutUnit, layoutUnit); const qreal newTileBottomMargin = UnitConvertor(tileBottomMargin, m_oldLayoutUnit, layoutUnit); - qreal newGap = UnitConvertor(ui->doubleSpinBoxPiecesGap->value(), m_oldLayoutUnit, layoutUnit); + qreal const newGap = UnitConvertor(ui->doubleSpinBoxPiecesGap->value(), m_oldLayoutUnit, layoutUnit); m_oldLayoutUnit = layoutUnit; CorrectPaperDecimals(); @@ -555,7 +555,7 @@ void PuzzlePreferencesLayoutPage::CorrectPaperDecimals() //--------------------------------------------------------------------------------------------------------------------- void PuzzlePreferencesLayoutPage::SheetPaperSizeChanged() { - bool portrait = ui->doubleSpinBoxSheetPaperHeight->value() > ui->doubleSpinBoxSheetPaperWidth->value(); + bool const portrait = ui->doubleSpinBoxSheetPaperHeight->value() > ui->doubleSpinBoxSheetPaperWidth->value(); ui->toolButtonSheetPortraitOritation->blockSignals(true); ui->toolButtonSheetPortraitOritation->setChecked(portrait); @@ -571,7 +571,7 @@ void PuzzlePreferencesLayoutPage::SheetPaperSizeChanged() //--------------------------------------------------------------------------------------------------------------------- void PuzzlePreferencesLayoutPage::TilePaperSizeChanged() { - bool portrait = ui->doubleSpinBoxTilePaperHeight->value() > ui->doubleSpinBoxTilePaperWidth->value(); + bool const portrait = ui->doubleSpinBoxTilePaperHeight->value() > ui->doubleSpinBoxTilePaperWidth->value(); ui->toolButtonTilePortraitOrientation->blockSignals(true); ui->toolButtonTilePortraitOrientation->setChecked(portrait); @@ -627,7 +627,7 @@ void PuzzlePreferencesLayoutPage::SetTileMargins(const QMarginsF &value) //--------------------------------------------------------------------------------------------------------------------- void PuzzlePreferencesLayoutPage::SetPieceGap(qreal gap) { - qreal value = UnitConvertor(gap, Unit::Px, LayoutUnit()); + qreal const value = UnitConvertor(gap, Unit::Px, LayoutUnit()); ui->doubleSpinBoxPiecesGap->setValue(value); CorrectPaperDecimals(); } diff --git a/src/app/puzzle/dialogs/configpages/puzzlepreferencespathpage.cpp b/src/app/puzzle/dialogs/configpages/puzzlepreferencespathpage.cpp index cbd811756..2a66fe357 100644 --- a/src/app/puzzle/dialogs/configpages/puzzlepreferencespathpage.cpp +++ b/src/app/puzzle/dialogs/configpages/puzzlepreferencespathpage.cpp @@ -127,7 +127,7 @@ void PuzzlePreferencesPathPage::EditPath() } bool usedNotExistedDir = false; - QDir directory(path); + QDir const directory(path); if (not directory.exists()) { usedNotExistedDir = directory.mkpath(QChar('.')); diff --git a/src/app/puzzle/dialogs/dialogpuzzlepreferences.cpp b/src/app/puzzle/dialogs/dialogpuzzlepreferences.cpp index 091bf57ef..822e270b8 100644 --- a/src/app/puzzle/dialogs/dialogpuzzlepreferences.cpp +++ b/src/app/puzzle/dialogs/dialogpuzzlepreferences.cpp @@ -92,7 +92,7 @@ void DialogPuzzlePreferences::showEvent(QShowEvent *event) } // do your init stuff here - QSize sz = VAbstractApplication::VApp()->Settings()->GetPreferenceDialogSize(); + QSize const sz = VAbstractApplication::VApp()->Settings()->GetPreferenceDialogSize(); if (not sz.isEmpty()) { resize(sz); @@ -180,6 +180,6 @@ void DialogPuzzlePreferences::PageChanged(QListWidgetItem *current, QListWidgetI { current = previous; } - int rowIndex = ui->contentsWidget->row(current); + int const rowIndex = ui->contentsWidget->row(current); ui->pagesWidget->setCurrentIndex(rowIndex); } diff --git a/src/app/puzzle/dialogs/dialogsavemanuallayout.cpp b/src/app/puzzle/dialogs/dialogsavemanuallayout.cpp index d1531d085..bcbb421a0 100644 --- a/src/app/puzzle/dialogs/dialogsavemanuallayout.cpp +++ b/src/app/puzzle/dialogs/dialogsavemanuallayout.cpp @@ -426,7 +426,7 @@ void DialogSaveManualLayout::Save() if (QFile::exists(name)) { - QMessageBox::StandardButton res = QMessageBox::question( + QMessageBox::StandardButton const res = QMessageBox::question( this, tr("Name conflict"), tr("Folder already contain file with name %1. Rewrite all conflict file names?").arg(name), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); diff --git a/src/app/puzzle/layout/vppiece.cpp b/src/app/puzzle/layout/vppiece.cpp index 59d8cf5e7..28835f743 100644 --- a/src/app/puzzle/layout/vppiece.cpp +++ b/src/app/puzzle/layout/vppiece.cpp @@ -228,14 +228,14 @@ void VPPiece::SetPosition(QPointF point) //--------------------------------------------------------------------------------------------------------------------- auto VPPiece::GetPosition() -> QPointF { - QTransform matrix = GetMatrix(); + QTransform const matrix = GetMatrix(); return {matrix.dx(), matrix.dy()}; } //--------------------------------------------------------------------------------------------------------------------- void VPPiece::RotateToGrainline(const VPTransformationOrigon &origin) { - VPSheetPtr sheet = Sheet(); + VPSheetPtr const sheet = Sheet(); if (not IsGrainlineEnabled() || sheet.isNull()) { return; diff --git a/src/app/puzzle/scene/vpgraphicspiece.cpp b/src/app/puzzle/scene/vpgraphicspiece.cpp index 76aac4eb4..eea80b685 100644 --- a/src/app/puzzle/scene/vpgraphicspiece.cpp +++ b/src/app/puzzle/scene/vpgraphicspiece.cpp @@ -293,10 +293,10 @@ void VPGraphicsPiece::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) setCursor(Qt::OpenHandCursor); emit HideTransformationHandles(false); - VPPiecePtr piece = m_piece.toStrongRef(); + VPPiecePtr const piece = m_piece.toStrongRef(); if (not piece.isNull()) { - VPLayoutPtr layout = piece->Layout(); + VPLayoutPtr const layout = piece->Layout(); if (not layout.isNull()) { if (layout->LayoutSettings().GetStickyEdges() && m_hasStickyPosition) @@ -332,13 +332,13 @@ void VPGraphicsPiece::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) //--------------------------------------------------------------------------------------------------------------------- void VPGraphicsPiece::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { - VPPiecePtr piece = m_piece.toStrongRef(); + VPPiecePtr const piece = m_piece.toStrongRef(); if (piece.isNull()) { return; } - VPLayoutPtr layout = piece->Layout(); + VPLayoutPtr const layout = piece->Layout(); if (layout.isNull()) { return; @@ -492,7 +492,7 @@ void VPGraphicsPiece::InitPieceLabelSVGFont(const QVector &labelShape, //--------------------------------------------------------------------------------------------------------------------- void VPGraphicsPiece::InitPieceLabelOutlineFont(const QVector &labelShape, const VTextManager &tm) { - VPPiecePtr piece = m_piece.toStrongRef(); + VPPiecePtr const piece = m_piece.toStrongRef(); if (piece.isNull()) { return; @@ -508,7 +508,7 @@ void VPGraphicsPiece::InitPieceLabelOutlineFont(const QVector &labelSha const qreal angle = -QLineF(labelShape.at(0), labelShape.at(1)).angle(); const QColor color = PieceColor(); const int maxLineWidth = tm.MaxLineWidthOutlineFont(static_cast(dW)); - qreal penWidth = VPApplication::VApp()->PuzzleSettings()->GetLayoutLineWidth(); + qreal const penWidth = VPApplication::VApp()->PuzzleSettings()->GetLayoutLineWidth(); qreal dY = 0; @@ -609,7 +609,7 @@ void VPGraphicsPiece::InitGrainlineItem() { delete m_grainlineItem; - VPPiecePtr piece = m_piece.toStrongRef(); + VPPiecePtr const piece = m_piece.toStrongRef(); if (piece.isNull()) { return; @@ -621,7 +621,7 @@ void VPGraphicsPiece::InitGrainlineItem() m_grainlineItem->setPath(VLayoutPiece::GrainlinePath(piece->GetMappedGrainlineShape())); VPSettings *settings = VPApplication::VApp()->PuzzleSettings(); - QPen pen(PieceColor(), settings->GetLayoutLineWidth(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); + QPen const pen(PieceColor(), settings->GetLayoutLineWidth(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); m_grainlineItem->SetCustomPen(true); m_grainlineItem->setPen(pen); } @@ -738,13 +738,13 @@ void VPGraphicsPiece::PaintCuttingLine(QPainter *painter, const VPPiecePtr &piec { if (piece->IsSeamAllowance() && not piece->IsSeamAllowanceBuiltIn()) { - QVector cuttingLinepoints = piece->GetMappedFullSeamAllowancePoints(); + QVector const cuttingLinepoints = piece->GetMappedFullSeamAllowancePoints(); if (cuttingLinepoints.isEmpty()) { return; } - VPLayoutPtr layout = piece->Layout(); + VPLayoutPtr const layout = piece->Layout(); if (layout.isNull()) { return; @@ -754,8 +754,8 @@ void VPGraphicsPiece::PaintCuttingLine(QPainter *painter, const VPPiecePtr &piec { const QVector passmarks = piece->GetMappedPassmarks(); - bool seamAllowance = piece->IsSeamAllowance() && !piece->IsSeamAllowanceBuiltIn(); - bool builtInSeamAllowance = piece->IsSeamAllowance() && piece->IsSeamAllowanceBuiltIn(); + bool const seamAllowance = piece->IsSeamAllowance() && !piece->IsSeamAllowanceBuiltIn(); + bool const builtInSeamAllowance = piece->IsSeamAllowance() && piece->IsSeamAllowanceBuiltIn(); VBoundary boundary(cuttingLinepoints, seamAllowance, builtInSeamAllowance); boundary.SetPieceName(piece->GetName()); @@ -1066,13 +1066,13 @@ void VPGraphicsPiece::PaintFoldLine(QPainter *painter, const VPPiecePtr &piece) //--------------------------------------------------------------------------------------------------------------------- void VPGraphicsPiece::GroupMove(const QPointF &pos) { - VPPiecePtr piece = m_piece.toStrongRef(); + VPPiecePtr const piece = m_piece.toStrongRef(); if (piece.isNull()) { return; } - VPLayoutPtr layout = piece->Layout(); + VPLayoutPtr const layout = piece->Layout(); if (layout.isNull()) { return; @@ -1082,7 +1082,7 @@ void VPGraphicsPiece::GroupMove(const QPointF &pos) { QList pieces; - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (not sheet.isNull()) { return sheet->GetSelectedPieces(); @@ -1091,8 +1091,8 @@ void VPGraphicsPiece::GroupMove(const QPointF &pos) return pieces; }; - QList pieces = PreparePieces(); - QPointF newPos = pos - m_moveStartPoint; + QList const pieces = PreparePieces(); + QPointF const newPos = pos - m_moveStartPoint; if (qFuzzyIsNull(newPos.x()) && qFuzzyIsNull(newPos.y())) { @@ -1134,13 +1134,13 @@ void VPGraphicsPiece::GroupMove(const QPointF &pos) //--------------------------------------------------------------------------------------------------------------------- auto VPGraphicsPiece::PieceColor() const -> QColor { - VPPiecePtr piece = m_piece.toStrongRef(); + VPPiecePtr const piece = m_piece.toStrongRef(); if (piece.isNull()) { return VSceneStylesheet::ManualLayoutStyle().PieceOkColor(); } - VPLayoutPtr layout = piece->Layout(); + VPLayoutPtr const layout = piece->Layout(); if (layout.isNull()) { return VSceneStylesheet::ManualLayoutStyle().PieceOkColor(); @@ -1175,7 +1175,7 @@ auto VPGraphicsPiece::NoBrush() const -> QBrush //--------------------------------------------------------------------------------------------------------------------- void VPGraphicsPiece::on_RefreshPiece(const VPPiecePtr &piece) { - VPPiecePtr p = m_piece.toStrongRef(); + VPPiecePtr const p = m_piece.toStrongRef(); if (p.isNull()) { return; @@ -1199,7 +1199,7 @@ void VPGraphicsPiece::on_RefreshPiece(const VPPiecePtr &piece) //--------------------------------------------------------------------------------------------------------------------- void VPGraphicsPiece::PieceZValueChanged(const VPPiecePtr &piece) { - VPPiecePtr p = m_piece.toStrongRef(); + VPPiecePtr const p = m_piece.toStrongRef(); if (p.isNull() || piece.isNull()) { return; @@ -1218,12 +1218,12 @@ auto VPGraphicsPiece::itemChange(GraphicsItemChange change, const QVariant &valu { if (change == ItemSelectedHasChanged) { - VPPiecePtr piece = m_piece.toStrongRef(); + VPPiecePtr const piece = m_piece.toStrongRef(); if (not piece.isNull()) { piece->SetSelected(value.toBool()); - VPLayoutPtr layout = piece->Layout(); + VPLayoutPtr const layout = piece->Layout(); if (not layout.isNull()) { emit layout->PieceSelectionChanged(piece); diff --git a/src/app/puzzle/scene/vpgraphicspiececontrols.cpp b/src/app/puzzle/scene/vpgraphicspiececontrols.cpp index b01c5654d..1d2878dfe 100644 --- a/src/app/puzzle/scene/vpgraphicspiececontrols.cpp +++ b/src/app/puzzle/scene/vpgraphicspiececontrols.cpp @@ -58,7 +58,7 @@ const qreal centerRadius2 = 10; auto TransformationOrigin(const VPLayoutPtr &layout, const QRectF &boundingRect) -> VPTransformationOrigon { SCASSERT(layout != nullptr) - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (not sheet.isNull()) { return sheet->TransformationOrigin(); @@ -133,7 +133,7 @@ void VPGraphicsTransformationOrigin::paint(QPainter *painter, const QStyleOption const qreal scale = SceneScale(scene()); - QPen pen(CurrentColor(), penWidth / scale, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); + QPen const pen(CurrentColor(), penWidth / scale, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); painter->setPen(pen); @@ -170,10 +170,10 @@ void VPGraphicsTransformationOrigin::mousePressEvent(QGraphicsSceneMouseEvent *e //--------------------------------------------------------------------------------------------------------------------- void VPGraphicsTransformationOrigin::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (not layout.isNull()) { - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (not sheet.isNull()) { VPTransformationOrigon origin = sheet->TransformationOrigin(); @@ -225,7 +225,7 @@ auto VPGraphicsTransformationOrigin::RotationCenter(QPainter *painter) const -> const qreal scale = SceneScale(scene()); qreal radius = centerRadius1 / scale; - VPTransformationOrigon transformationOrigin = TransformationOrigin(m_layout, QRectF()); + VPTransformationOrigon const transformationOrigin = TransformationOrigin(m_layout, QRectF()); QRectF rect(transformationOrigin.origin.x() - radius, transformationOrigin.origin.y() - radius, radius * 2., radius * 2.); @@ -264,10 +264,10 @@ auto VPGraphicsTransformationOrigin::RotationCenter(QPainter *painter) const -> auto VPGraphicsTransformationOrigin::Center1() const -> QPainterPath { const qreal scale = SceneScale(scene()); - qreal radius = centerRadius1 / scale; - VPTransformationOrigon transformationOrigin = TransformationOrigin(m_layout, QRectF()); - QRectF rect(transformationOrigin.origin.x() - radius, transformationOrigin.origin.y() - radius, radius * 2., - radius * 2.); + qreal const radius = centerRadius1 / scale; + VPTransformationOrigon const transformationOrigin = TransformationOrigin(m_layout, QRectF()); + QRectF const rect(transformationOrigin.origin.x() - radius, transformationOrigin.origin.y() - radius, radius * 2., + radius * 2.); QPainterPath center1; center1.addEllipse(rect); @@ -279,10 +279,10 @@ auto VPGraphicsTransformationOrigin::Center1() const -> QPainterPath auto VPGraphicsTransformationOrigin::Center2() const -> QPainterPath { const qreal scale = SceneScale(scene()); - qreal radius = centerRadius2 / scale; - VPTransformationOrigon transformationOrigin = TransformationOrigin(m_layout, QRectF()); - QRectF rect = QRectF(transformationOrigin.origin.x() - radius, transformationOrigin.origin.y() - radius, - radius * 2., radius * 2.); + qreal const radius = centerRadius2 / scale; + VPTransformationOrigon const transformationOrigin = TransformationOrigin(m_layout, QRectF()); + QRectF const rect = QRectF(transformationOrigin.origin.x() - radius, transformationOrigin.origin.y() - radius, + radius * 2., radius * 2.); QPainterPath center2; center2.addEllipse(rect); @@ -326,10 +326,10 @@ void VPGraphicsPieceControls::on_UpdateControls() if (not m_pieceRect.isNull()) { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (not layout.isNull()) { - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (not sheet.isNull()) { VPTransformationOrigon origin = sheet->TransformationOrigin(); @@ -361,7 +361,7 @@ auto VPGraphicsPieceControls::boundingRect() const -> QRectF auto HandlerBoundingRect = [this, &boundingRect](VPHandleCorner corner, VPHandleCornerType type, QPointF pos) { - QPixmap handler = HandlerPixmap(m_handleCorner == corner, type); + QPixmap const handler = HandlerPixmap(m_handleCorner == corner, type); boundingRect = boundingRect.united(QRectF(pos, handler.size() / handler.devicePixelRatio())); }; @@ -439,12 +439,12 @@ void VPGraphicsPieceControls::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { PrepareTransformationOrigin(event->modifiers() & Qt::ShiftModifier); - QPointF rotationNewPoint = event->scenePos(); + QPointF const rotationNewPoint = event->scenePos(); // get the angle from the center to the initial click point - VPTransformationOrigon rotationOrigin = TransformationOrigin(m_layout, m_pieceRect); - QLineF initPosition(rotationOrigin.origin, m_rotationStartPoint); - QLineF initRotationPosition(rotationOrigin.origin, rotationNewPoint); + VPTransformationOrigon const rotationOrigin = TransformationOrigin(m_layout, m_pieceRect); + QLineF const initPosition(rotationOrigin.origin, m_rotationStartPoint); + QLineF const initRotationPosition(rotationOrigin.origin, rotationNewPoint); qreal rotateOn = initPosition.angleTo(initRotationPosition); @@ -455,9 +455,9 @@ void VPGraphicsPieceControls::mouseMoveEvent(QGraphicsSceneMouseEvent *event) if (not qFuzzyIsNull(rotateOn)) { - QList pieces = SelectedPieces(); + QList const pieces = SelectedPieces(); - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (not layout.isNull()) { CorrectRotationSum(layout, rotationOrigin, rotateOn); @@ -512,10 +512,10 @@ void VPGraphicsPieceControls::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) if (m_originSaved) { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (not layout.isNull()) { - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (not sheet.isNull()) { if (not m_savedOrigin.custom) @@ -569,7 +569,7 @@ void VPGraphicsPieceControls::InitPixmaps() const QString resource = QStringLiteral("icon"); const QString fileName = QStringLiteral("32x32/%1.png").arg(imageName); - QPixmap handlePixmap = VTheme::GetPixmapResource(resource, fileName); + QPixmap const handlePixmap = VTheme::GetPixmapResource(resource, fileName); if (QGuiApplication::primaryScreen()->devicePixelRatio() >= 2) { @@ -608,27 +608,27 @@ auto VPGraphicsPieceControls::TopLeftHandlerPosition() const -> QPointF //--------------------------------------------------------------------------------------------------------------------- auto VPGraphicsPieceControls::TopRightHandlerPosition() const -> QPointF { - QRectF rect = ControllersRect(); - QPixmap handler = m_handlePixmaps.value(VPHandleCornerType::TopRight); - QSize size = handler.size() / handler.devicePixelRatio(); + QRectF const rect = ControllersRect(); + QPixmap const handler = m_handlePixmaps.value(VPHandleCornerType::TopRight); + QSize const size = handler.size() / handler.devicePixelRatio(); return {rect.topLeft().x() + (rect.width() - size.width()), rect.topLeft().y()}; } //--------------------------------------------------------------------------------------------------------------------- auto VPGraphicsPieceControls::BottomRightHandlerPosition() const -> QPointF { - QRectF rect = ControllersRect(); - QPixmap handler = m_handlePixmaps.value(VPHandleCornerType::BottomRight); - QSize size = handler.size() / handler.devicePixelRatio(); + QRectF const rect = ControllersRect(); + QPixmap const handler = m_handlePixmaps.value(VPHandleCornerType::BottomRight); + QSize const size = handler.size() / handler.devicePixelRatio(); return {rect.topLeft().x() + (rect.width() - size.width()), rect.topLeft().y() + (rect.height() - size.height())}; } //--------------------------------------------------------------------------------------------------------------------- auto VPGraphicsPieceControls::BottomLeftHandlerPosition() const -> QPointF { - QRectF rect = ControllersRect(); - QPixmap handler = m_handlePixmaps.value(VPHandleCornerType::BottomLeft); - QSize size = handler.size() / handler.devicePixelRatio(); + QRectF const rect = ControllersRect(); + QPixmap const handler = m_handlePixmaps.value(VPHandleCornerType::BottomLeft); + QSize const size = handler.size() / handler.devicePixelRatio(); return {rect.topLeft().x(), rect.topLeft().y() + (rect.height() - size.height())}; } @@ -692,7 +692,7 @@ auto VPGraphicsPieceControls::Handles() const -> QPainterPath auto VPGraphicsPieceControls::ControllersRect() const -> QRectF { const qreal scale = SceneScale(scene()); - QPixmap handler = m_handlePixmaps.value(VPHandleCornerType::TopLeft); + QPixmap const handler = m_handlePixmaps.value(VPHandleCornerType::TopLeft); QRectF pieceRect = m_pieceRect; pieceRect = QRectF(pieceRect.topLeft() * scale, QSizeF(pieceRect.width() * scale, pieceRect.height() * scale)); @@ -700,13 +700,13 @@ auto VPGraphicsPieceControls::ControllersRect() const -> QRectF if (pieceRect.width() < handler.width()) { - qreal diff = handler.width() - pieceRect.width(); + qreal const diff = handler.width() - pieceRect.width(); rect.adjust(0, 0, diff, 0); } if (pieceRect.height() < handler.height()) { - qreal diff = handler.height() - pieceRect.height(); + qreal const diff = handler.height() - pieceRect.height(); rect.adjust(0, 0, 0, diff); } @@ -721,10 +721,10 @@ auto VPGraphicsPieceControls::SelectedPieces() const -> QList { QList pieces; - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (not layout.isNull()) { - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (not sheet.isNull()) { pieces = sheet->GetSelectedPieces(); @@ -755,7 +755,7 @@ auto VPGraphicsPieceControls::ItemView() -> QGraphicsView * QGraphicsScene *scene = this->scene(); if (scene != nullptr) { - QList views = scene->views(); + QList const views = scene->views(); if (not views.isEmpty()) { return views.at(0); @@ -794,13 +794,13 @@ void VPGraphicsPieceControls::PrepareTransformationOrigin(bool shiftPressed) return; } - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (layout.isNull()) { return; } - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (sheet.isNull()) { return; @@ -842,13 +842,13 @@ void VPGraphicsPieceControls::PrepareTransformationOrigin(bool shiftPressed) return; } - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (layout.isNull()) { return; } - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (sheet.isNull()) { return; @@ -894,7 +894,7 @@ void VPGraphicsPieceControls::CorrectRotationSum(const VPLayoutPtr &layout, //--------------------------------------------------------------------------------------------------------------------- auto VPGraphicsPieceControls::SelectedHandleCorner(const QPointF &pos) const -> VPHandleCorner { - QMap corners{ + QMap const corners{ {VPHandleCorner::TopLeft, TopLeftControl()}, {VPHandleCorner::TopRight, TopRightControl()}, {VPHandleCorner::BottomRight, BottomRightControl()}, diff --git a/src/app/puzzle/scene/vpgraphicstilegrid.cpp b/src/app/puzzle/scene/vpgraphicstilegrid.cpp index e28640b85..fe0dcac0e 100644 --- a/src/app/puzzle/scene/vpgraphicstilegrid.cpp +++ b/src/app/puzzle/scene/vpgraphicstilegrid.cpp @@ -48,15 +48,15 @@ auto OptimizeFontSizeToFitTextInRect(QPainter *painter, const QRectF &drawRect, while ((error > goalError) && (iterationNumber < maxIterationNumber)) { iterationNumber++; - QRect fontBoundRect = painter->fontMetrics().boundingRect(drawRect.toRect(), flags, text); + QRect const fontBoundRect = painter->fontMetrics().boundingRect(drawRect.toRect(), flags, text); if (fontBoundRect.isNull()) { font.setPointSizeF(0.00000001); break; } - double xFactor = drawRect.width() / fontBoundRect.width(); - double yFactor = drawRect.height() / fontBoundRect.height(); + double const xFactor = drawRect.width() / fontBoundRect.width(); + double const yFactor = drawRect.height() / fontBoundRect.height(); double factor; if (xFactor < 1 && yFactor < 1) { @@ -113,10 +113,10 @@ VPGraphicsTileGrid::VPGraphicsTileGrid(const VPLayoutPtr &layout, const QUuid &s //--------------------------------------------------------------------------------------------------------------------- auto VPGraphicsTileGrid::boundingRect() const -> QRectF { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (not layout.isNull() && layout->LayoutSettings().GetShowTiles()) { - VPSheetPtr sheet = layout->GetSheet(m_sheetUuid); + VPSheetPtr const sheet = layout->GetSheet(m_sheetUuid); QMarginsF sheetMargins; if (not sheet.isNull() && not sheet->IgnoreMargins()) @@ -124,14 +124,15 @@ auto VPGraphicsTileGrid::boundingRect() const -> QRectF sheetMargins = sheet->GetSheetMargins(); } - qreal xScale = layout->LayoutSettings().HorizontalScale(); - qreal yScale = layout->LayoutSettings().VerticalScale(); + qreal const xScale = layout->LayoutSettings().HorizontalScale(); + qreal const yScale = layout->LayoutSettings().VerticalScale(); - qreal width = layout->TileFactory()->DrawingAreaWidth() - VPTileFactory::tileStripeWidth; - qreal height = layout->TileFactory()->DrawingAreaHeight() - VPTileFactory::tileStripeWidth; + qreal const width = layout->TileFactory()->DrawingAreaWidth() - VPTileFactory::tileStripeWidth; + qreal const height = layout->TileFactory()->DrawingAreaHeight() - VPTileFactory::tileStripeWidth; - QRectF rect(sheetMargins.left(), sheetMargins.top(), layout->TileFactory()->ColNb(sheet) * (width / xScale), - layout->TileFactory()->RowNb(sheet) * (height / yScale)); + QRectF const rect(sheetMargins.left(), sheetMargins.top(), + layout->TileFactory()->ColNb(sheet) * (width / xScale), + layout->TileFactory()->RowNb(sheet) * (height / yScale)); constexpr qreal halfPenWidth = penWidth / 2.; diff --git a/src/app/puzzle/scene/vpmaingraphicsview.cpp b/src/app/puzzle/scene/vpmaingraphicsview.cpp index 44d75425c..b991d965a 100644 --- a/src/app/puzzle/scene/vpmaingraphicsview.cpp +++ b/src/app/puzzle/scene/vpmaingraphicsview.cpp @@ -105,10 +105,10 @@ VPMainGraphicsView::VPMainGraphicsView(const VPLayoutPtr &layout, QWidget *paren //--------------------------------------------------------------------------------------------------------------------- void VPMainGraphicsView::RefreshLayout() { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (not layout.isNull()) { - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (not sheet.isNull()) { sheet->SceneData()->RefreshLayout(); @@ -119,10 +119,10 @@ void VPMainGraphicsView::RefreshLayout() //--------------------------------------------------------------------------------------------------------------------- void VPMainGraphicsView::RefreshPieces() { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (not layout.isNull()) { - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (not sheet.isNull()) { sheet->SceneData()->RefreshPieces(); @@ -137,7 +137,7 @@ void VPMainGraphicsView::dragEnterEvent(QDragEnterEvent *event) if (mime->hasFormat(VPMimeDataPiece::mineFormatPiecePtr)) { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (layout.isNull()) { return; @@ -159,7 +159,7 @@ void VPMainGraphicsView::dragMoveEvent(QDragMoveEvent *event) if (mime->hasFormat(VPMimeDataPiece::mineFormatPiecePtr)) { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (layout.isNull()) { return; @@ -188,7 +188,7 @@ void VPMainGraphicsView::dropEvent(QDropEvent *event) if (mime->hasFormat(VPMimeDataPiece::mineFormatPiecePtr)) { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (layout.isNull()) { return; @@ -201,7 +201,7 @@ void VPMainGraphicsView::dropEvent(QDropEvent *event) return; } - VPPiecePtr piece = mimePiece->GetPiecePtr(); + VPPiecePtr const piece = mimePiece->GetPiecePtr(); if (not piece.isNull()) { qCDebug(pMainGraphicsView(), "element dropped, %s", qUtf8Printable(piece->GetName())); @@ -308,13 +308,13 @@ void VPMainGraphicsView::keyReleaseEvent(QKeyEvent *event) { if (not event->isAutoRepeat()) { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (layout.isNull()) { return; } - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (not sheet.isNull()) { sheet->SceneData()->RotationControls()->SetIgnorePieceTransformation(false); @@ -338,13 +338,13 @@ void VPMainGraphicsView::contextMenuEvent(QContextMenuEvent *event) return; } - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (layout.isNull()) { return; } - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); QMenu menu; @@ -369,13 +369,13 @@ void VPMainGraphicsView::contextMenuEvent(QContextMenuEvent *event) //--------------------------------------------------------------------------------------------------------------------- void VPMainGraphicsView::RestoreOrigin() const { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (layout.isNull()) { return; } - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (not sheet.isNull()) { VPTransformationOrigon origin = sheet->TransformationOrigin(); @@ -384,7 +384,7 @@ void VPMainGraphicsView::RestoreOrigin() const origin.custom = false; QRectF boundingRect; - QList selectedPieces = sheet->GetSelectedPieces(); + QList const selectedPieces = sheet->GetSelectedPieces(); for (const auto &piece : selectedPieces) { if (piece->IsSelected()) @@ -409,13 +409,13 @@ void VPMainGraphicsView::on_SceneMouseMove(const QPointF &scenePos) //--------------------------------------------------------------------------------------------------------------------- void VPMainGraphicsView::RotatePiecesByAngle(qreal angle) { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (layout.isNull()) { return; } - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (sheet.isNull()) { return; @@ -424,15 +424,15 @@ void VPMainGraphicsView::RotatePiecesByAngle(qreal angle) sheet->SceneData()->RotationControls()->on_HideHandles(true); sheet->SceneData()->RotationControls()->SetIgnorePieceTransformation(true); - VPTransformationOrigon origin = sheet->TransformationOrigin(); + VPTransformationOrigon const origin = sheet->TransformationOrigin(); auto PreparePieces = [this]() { QList pieces; - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (not layout.isNull()) { - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (not sheet.isNull()) { pieces = sheet->GetSelectedPieces(); @@ -458,7 +458,7 @@ void VPMainGraphicsView::RotatePiecesByAngle(qreal angle) m_rotationSum = angle; } - QList pieces = PreparePieces(); + QList const pieces = PreparePieces(); if (pieces.size() == 1) { @@ -477,13 +477,13 @@ void VPMainGraphicsView::RotatePiecesByAngle(qreal angle) //--------------------------------------------------------------------------------------------------------------------- void VPMainGraphicsView::TranslatePiecesOn(qreal dx, qreal dy) { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (layout.isNull()) { return; } - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (sheet.isNull()) { return; @@ -496,7 +496,7 @@ void VPMainGraphicsView::TranslatePiecesOn(qreal dx, qreal dy) return; } - VPPiecePtr piece = graphicsPieces.constFirst()->GetPiece(); + VPPiecePtr const piece = graphicsPieces.constFirst()->GetPiece(); if (piece.isNull()) { return; @@ -505,10 +505,10 @@ void VPMainGraphicsView::TranslatePiecesOn(qreal dx, qreal dy) auto PreparePieces = [this]() { QList pieces; - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (not layout.isNull()) { - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (not sheet.isNull()) { pieces = sheet->GetSelectedPieces(); @@ -518,7 +518,7 @@ void VPMainGraphicsView::TranslatePiecesOn(qreal dx, qreal dy) return pieces; }; - QList pieces = PreparePieces(); + QList const pieces = PreparePieces(); if (pieces.size() == 1) { const VPPiecePtr &p = pieces.constFirst(); @@ -562,7 +562,7 @@ void VPMainGraphicsView::SwitchScene(const VPSheetPtr &sheet) { if (not sheet.isNull()) { - QSharedPointer scene = sheet->SceneData()->Scene(); + QSharedPointer const scene = sheet->SceneData()->Scene(); setScene(scene.data()); connect(scene.data(), &VMainGraphicsScene::mouseMove, this, &VPMainGraphicsView::on_SceneMouseMove, Qt::UniqueConnection); @@ -572,19 +572,19 @@ void VPMainGraphicsView::SwitchScene(const VPSheetPtr &sheet) //--------------------------------------------------------------------------------------------------------------------- void VPMainGraphicsView::ClearSelection() { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (layout.isNull()) { return; } - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (sheet.isNull()) { return; } - QList pieces = sheet->GetSelectedPieces(); + QList const pieces = sheet->GetSelectedPieces(); for (const auto &piece : pieces) { piece->SetSelected(false); @@ -595,25 +595,25 @@ void VPMainGraphicsView::ClearSelection() //--------------------------------------------------------------------------------------------------------------------- void VPMainGraphicsView::ZValueMove(int move) { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (layout.isNull()) { return; } - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (sheet.isNull()) { return; } - QList selectedPieces = sheet->GetSelectedPieces(); + QList const selectedPieces = sheet->GetSelectedPieces(); if (selectedPieces.isEmpty()) { return; } - QList allPieces = sheet->GetPieces(); + QList const allPieces = sheet->GetPieces(); if (allPieces.isEmpty() || (allPieces.size() == selectedPieces.size())) { return; @@ -634,13 +634,13 @@ void VPMainGraphicsView::ZValueMove(int move) //--------------------------------------------------------------------------------------------------------------------- void VPMainGraphicsView::RemovePiece() const { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (layout.isNull()) { return; } - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (sheet.isNull()) { return; @@ -649,13 +649,13 @@ void VPMainGraphicsView::RemovePiece() const const QList &graphicsPieces = sheet->SceneData()->GraphicsPieces(); for (auto *graphicsPiece : graphicsPieces) { - VPPiecePtr piece = graphicsPiece->GetPiece(); + VPPiecePtr const piece = graphicsPiece->GetPiece(); if (not piece.isNull() && piece->IsSelected()) { piece->SetSelected(false); - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (not layout.isNull()) { emit layout->PieceSelectionChanged(piece); @@ -672,13 +672,13 @@ void VPMainGraphicsView::MovePiece(QKeyEvent *event) { if (not event->isAutoRepeat()) { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (layout.isNull()) { return; } - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (sheet.isNull()) { return; @@ -692,7 +692,7 @@ void VPMainGraphicsView::MovePiece(QKeyEvent *event) auto PreparePieces = [layout]() { QList pieces; - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (not sheet.isNull()) { pieces = sheet->GetSelectedPieces(); @@ -701,7 +701,7 @@ void VPMainGraphicsView::MovePiece(QKeyEvent *event) return pieces; }; - QList pieces = PreparePieces(); + QList const pieces = PreparePieces(); if (pieces.size() == 1) { const VPPiecePtr &p = pieces.constFirst(); @@ -726,13 +726,13 @@ void VPMainGraphicsView::MovePiece(QKeyEvent *event) //--------------------------------------------------------------------------------------------------------------------- void VPMainGraphicsView::on_PieceSheetChanged(const VPPiecePtr &piece) { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (layout.isNull()) { return; } - VPSheetPtr sheet = layout->GetFocusedSheet(); + VPSheetPtr const sheet = layout->GetFocusedSheet(); if (sheet.isNull()) { return; diff --git a/src/app/puzzle/undocommands/vpundoaddsheet.cpp b/src/app/puzzle/undocommands/vpundoaddsheet.cpp index cc0547d51..c95323950 100644 --- a/src/app/puzzle/undocommands/vpundoaddsheet.cpp +++ b/src/app/puzzle/undocommands/vpundoaddsheet.cpp @@ -43,7 +43,7 @@ VPUndoAddSheet::VPUndoAddSheet(const VPSheetPtr &sheet, QUndoCommand *parent) //--------------------------------------------------------------------------------------------------------------------- void VPUndoAddSheet::undo() { - VPSheetPtr sheet = m_sheet.toStrongRef(); + VPSheetPtr const sheet = m_sheet.toStrongRef(); if (sheet.isNull()) { return; @@ -51,7 +51,7 @@ void VPUndoAddSheet::undo() sheet->SetVisible(false); - VPLayoutPtr layout = sheet->GetLayout(); + VPLayoutPtr const layout = sheet->GetLayout(); if (layout.isNull()) { return; @@ -64,13 +64,13 @@ void VPUndoAddSheet::undo() //--------------------------------------------------------------------------------------------------------------------- void VPUndoAddSheet::redo() { - VPSheetPtr sheet = m_sheet.toStrongRef(); + VPSheetPtr const sheet = m_sheet.toStrongRef(); if (sheet.isNull()) { return; } - VPLayoutPtr layout = sheet->GetLayout(); + VPLayoutPtr const layout = sheet->GetLayout(); if (layout.isNull()) { return; diff --git a/src/app/puzzle/undocommands/vpundomovepieceonsheet.cpp b/src/app/puzzle/undocommands/vpundomovepieceonsheet.cpp index ad240a427..32e849ac8 100644 --- a/src/app/puzzle/undocommands/vpundomovepieceonsheet.cpp +++ b/src/app/puzzle/undocommands/vpundomovepieceonsheet.cpp @@ -41,7 +41,7 @@ VPUndoMovePieceOnSheet::VPUndoMovePieceOnSheet(const VPSheetPtr &sheet, const VP m_oldSheet = piece->Sheet(); - VPLayoutPtr layout = piece->Layout(); + VPLayoutPtr const layout = piece->Layout(); if (not layout.isNull()) { m_followGrainline = layout->LayoutSettings().GetFollowGrainline(); @@ -53,7 +53,7 @@ VPUndoMovePieceOnSheet::VPUndoMovePieceOnSheet(const VPSheetPtr &sheet, const VP //--------------------------------------------------------------------------------------------------------------------- void VPUndoMovePieceOnSheet::undo() { - VPSheetPtr sourceSheet = m_oldSheet.toStrongRef(); + VPSheetPtr const sourceSheet = m_oldSheet.toStrongRef(); VPSheetPtr activateSheet = sourceSheet; if (activateSheet.isNull()) { @@ -71,7 +71,7 @@ void VPUndoMovePieceOnSheet::undo() } } - VPPiecePtr piece = m_piece.toStrongRef(); + VPPiecePtr const piece = m_piece.toStrongRef(); if (not piece.isNull()) { piece->SetSheet(sourceSheet); @@ -88,7 +88,7 @@ void VPUndoMovePieceOnSheet::undo() //--------------------------------------------------------------------------------------------------------------------- void VPUndoMovePieceOnSheet::redo() { - VPSheetPtr sourceSheet = m_sheet.toStrongRef(); + VPSheetPtr const sourceSheet = m_sheet.toStrongRef(); VPSheetPtr activateSheet = sourceSheet; if (activateSheet.isNull()) { @@ -106,7 +106,7 @@ void VPUndoMovePieceOnSheet::redo() } } - VPPiecePtr piece = m_piece.toStrongRef(); + VPPiecePtr const piece = m_piece.toStrongRef(); if (not piece.isNull()) { piece->SetSheet(sourceSheet); diff --git a/src/app/puzzle/undocommands/vpundooriginmove.cpp b/src/app/puzzle/undocommands/vpundooriginmove.cpp index e8149bc43..8243fca49 100644 --- a/src/app/puzzle/undocommands/vpundooriginmove.cpp +++ b/src/app/puzzle/undocommands/vpundooriginmove.cpp @@ -47,13 +47,13 @@ VPUndoOriginMove::VPUndoOriginMove(const VPSheetPtr &sheet, const VPTransformati //--------------------------------------------------------------------------------------------------------------------- void VPUndoOriginMove::undo() { - VPSheetPtr sheet = m_sheet.toStrongRef(); + VPSheetPtr const sheet = m_sheet.toStrongRef(); if (sheet.isNull()) { return; } - VPLayoutPtr layout = sheet->GetLayout(); + VPLayoutPtr const layout = sheet->GetLayout(); if (layout.isNull()) { return; @@ -71,13 +71,13 @@ void VPUndoOriginMove::undo() //--------------------------------------------------------------------------------------------------------------------- void VPUndoOriginMove::redo() { - VPSheetPtr sheet = m_sheet.toStrongRef(); + VPSheetPtr const sheet = m_sheet.toStrongRef(); if (sheet.isNull()) { return; } - VPLayoutPtr layout = sheet->GetLayout(); + VPLayoutPtr const layout = sheet->GetLayout(); if (layout.isNull()) { return; @@ -104,13 +104,13 @@ auto VPUndoOriginMove::mergeWith(const QUndoCommand *command) -> bool const auto *moveCommand = dynamic_cast(command); SCASSERT(moveCommand != nullptr) - VPSheetPtr sheet = Sheet(); + VPSheetPtr const sheet = Sheet(); if (moveCommand->Sheet().isNull() || sheet.isNull() || not moveCommand->AllowMerge()) { return false; } - VPTransformationOrigon origin = moveCommand->Origin(); + VPTransformationOrigon const origin = moveCommand->Origin(); if (origin.custom != m_origin.custom) { diff --git a/src/app/puzzle/undocommands/vpundopiecemove.cpp b/src/app/puzzle/undocommands/vpundopiecemove.cpp index 4a9782e2f..da9ef646f 100644 --- a/src/app/puzzle/undocommands/vpundopiecemove.cpp +++ b/src/app/puzzle/undocommands/vpundopiecemove.cpp @@ -47,13 +47,13 @@ VPUndoPieceMove::VPUndoPieceMove(const VPPiecePtr &piece, qreal dx, qreal dy, bo //--------------------------------------------------------------------------------------------------------------------- void VPUndoPieceMove::undo() { - VPPiecePtr piece = Piece(); + VPPiecePtr const piece = Piece(); if (piece.isNull()) { return; } - VPLayoutPtr layout = piece->Layout(); + VPLayoutPtr const layout = piece->Layout(); if (layout.isNull()) { return; @@ -71,13 +71,13 @@ void VPUndoPieceMove::undo() //--------------------------------------------------------------------------------------------------------------------- void VPUndoPieceMove::redo() { - VPPiecePtr piece = Piece(); + VPPiecePtr const piece = Piece(); if (piece.isNull()) { return; } - VPLayoutPtr layout = piece->Layout(); + VPLayoutPtr const layout = piece->Layout(); if (layout.isNull()) { return; @@ -104,7 +104,7 @@ auto VPUndoPieceMove::mergeWith(const QUndoCommand *command) -> bool const auto *moveCommand = dynamic_cast(command); SCASSERT(moveCommand != nullptr) - VPPiecePtr piece = Piece(); + VPPiecePtr const piece = Piece(); if (moveCommand->Piece().isNull() || piece.isNull() || moveCommand->Piece() != piece || not moveCommand->AllowMerge()) { @@ -150,13 +150,13 @@ void VPUndoPiecesMove::undo() return; } - VPLayoutPtr layout = Layout(); + VPLayoutPtr const layout = Layout(); if (layout.isNull()) { return; } - VPSheetPtr sheet = Sheet(); + VPSheetPtr const sheet = Sheet(); if (layout->GetFocusedSheet() != sheet) { layout->SetFocusedSheet(sheet); @@ -164,7 +164,7 @@ void VPUndoPiecesMove::undo() for (const auto& piece : qAsConst(m_pieces)) { - VPPiecePtr p = piece.toStrongRef(); + VPPiecePtr const p = piece.toStrongRef(); if (not p.isNull()) { if (m_oldTransforms.contains(p->GetUniqueID())) @@ -184,13 +184,13 @@ void VPUndoPiecesMove::redo() return; } - VPLayoutPtr layout = Layout(); + VPLayoutPtr const layout = Layout(); if (layout.isNull()) { return; } - VPSheetPtr sheet = Sheet(); + VPSheetPtr const sheet = Sheet(); if (layout->GetFocusedSheet() != sheet) { layout->SetFocusedSheet(sheet); @@ -198,7 +198,7 @@ void VPUndoPiecesMove::redo() for (const auto& piece : qAsConst(m_pieces)) { - VPPiecePtr p = piece.toStrongRef(); + VPPiecePtr const p = piece.toStrongRef(); if (not p.isNull()) { p->Translate(m_dx, m_dy); @@ -246,7 +246,7 @@ auto VPUndoPiecesMove::Layout() const -> VPLayoutPtr { for (const auto& piece : m_pieces) { - VPPiecePtr p = piece.toStrongRef(); + VPPiecePtr const p = piece.toStrongRef(); if (not p.isNull()) { return p->Layout(); @@ -261,7 +261,7 @@ auto VPUndoPiecesMove::Sheet() const -> VPSheetPtr { for (const auto& piece : m_pieces) { - VPPiecePtr p = piece.toStrongRef(); + VPPiecePtr const p = piece.toStrongRef(); if (not p.isNull()) { return p->Sheet(); @@ -277,7 +277,7 @@ inline auto VPUndoPiecesMove::PieceIds() const -> QSet QSet ids; for (const auto& piece : m_pieces) { - VPPiecePtr p = piece.toStrongRef(); + VPPiecePtr const p = piece.toStrongRef(); if (not p.isNull()) { ids.insert(p->GetUniqueID()); diff --git a/src/app/puzzle/undocommands/vpundopiecerotate.cpp b/src/app/puzzle/undocommands/vpundopiecerotate.cpp index eb41ef0b0..e5d4faf1e 100644 --- a/src/app/puzzle/undocommands/vpundopiecerotate.cpp +++ b/src/app/puzzle/undocommands/vpundopiecerotate.cpp @@ -52,7 +52,7 @@ VPUndoPieceRotate::VPUndoPieceRotate(const VPPiecePtr &piece, const VPTransforma m_oldTransform = piece->GetMatrix(); - VPLayoutPtr layout = piece->Layout(); + VPLayoutPtr const layout = piece->Layout(); if (not layout.isNull()) { m_followGrainline = layout->LayoutSettings().GetFollowGrainline(); @@ -64,13 +64,13 @@ VPUndoPieceRotate::VPUndoPieceRotate(const VPPiecePtr &piece, const VPTransforma //--------------------------------------------------------------------------------------------------------------------- void VPUndoPieceRotate::undo() { - VPPiecePtr piece = Piece(); + VPPiecePtr const piece = Piece(); if (piece.isNull()) { return; } - VPLayoutPtr layout = piece->Layout(); + VPLayoutPtr const layout = piece->Layout(); if (layout.isNull()) { return; @@ -88,13 +88,13 @@ void VPUndoPieceRotate::undo() //--------------------------------------------------------------------------------------------------------------------- void VPUndoPieceRotate::redo() { - VPPiecePtr piece = Piece(); + VPPiecePtr const piece = Piece(); if (piece.isNull()) { return; } - VPLayoutPtr layout = piece->Layout(); + VPLayoutPtr const layout = piece->Layout(); if (layout.isNull()) { return; @@ -147,7 +147,7 @@ auto VPUndoPieceRotate::mergeWith(const QUndoCommand *command) -> bool const auto *moveCommand = dynamic_cast(command); SCASSERT(moveCommand != nullptr) - VPPiecePtr piece = Piece(); + VPPiecePtr const piece = Piece(); if (not moveCommand->AllowMerge() || (moveCommand->Piece().isNull() || piece.isNull()) || moveCommand->Piece() != piece || moveCommand->Origin() != m_origin || moveCommand->FollowGrainline() != m_followGrainline) @@ -186,7 +186,7 @@ VPUndoPiecesRotate::VPUndoPiecesRotate(const QList &pieces, const VP } } - VPLayoutPtr layout = Layout(); + VPLayoutPtr const layout = Layout(); if (not layout.isNull()) { m_followGrainline = layout->LayoutSettings().GetFollowGrainline(); @@ -201,13 +201,13 @@ void VPUndoPiecesRotate::undo() return; } - VPLayoutPtr layout = Layout(); + VPLayoutPtr const layout = Layout(); if (layout.isNull()) { return; } - VPSheetPtr sheet = Sheet(); + VPSheetPtr const sheet = Sheet(); if (layout->GetFocusedSheet() != sheet) { layout->SetFocusedSheet(sheet); @@ -215,7 +215,7 @@ void VPUndoPiecesRotate::undo() for (const auto &piece : qAsConst(m_pieces)) { - VPPiecePtr p = piece.toStrongRef(); + VPPiecePtr const p = piece.toStrongRef(); if (not p.isNull()) { if (m_oldTransforms.contains(p->GetUniqueID())) @@ -235,13 +235,13 @@ void VPUndoPiecesRotate::redo() return; } - VPLayoutPtr layout = Layout(); + VPLayoutPtr const layout = Layout(); if (layout.isNull()) { return; } - VPSheetPtr sheet = Sheet(); + VPSheetPtr const sheet = Sheet(); if (layout->GetFocusedSheet() != sheet) { layout->SetFocusedSheet(sheet); @@ -249,7 +249,7 @@ void VPUndoPiecesRotate::redo() for (const auto &piece : qAsConst(m_pieces)) { - VPPiecePtr p = piece.toStrongRef(); + VPPiecePtr const p = piece.toStrongRef(); if (not p.isNull()) { if (m_firstCall) @@ -319,7 +319,7 @@ auto VPUndoPiecesRotate::PieceIds() const -> QSet QSet ids; for (const auto &piece : m_pieces) { - VPPiecePtr p = piece.toStrongRef(); + VPPiecePtr const p = piece.toStrongRef(); if (not p.isNull()) { ids.insert(p->GetUniqueID()); @@ -334,7 +334,7 @@ auto VPUndoPiecesRotate::Layout() const -> VPLayoutPtr { for (const auto &piece : m_pieces) { - VPPiecePtr p = piece.toStrongRef(); + VPPiecePtr const p = piece.toStrongRef(); if (not p.isNull()) { return p->Layout(); @@ -349,7 +349,7 @@ auto VPUndoPiecesRotate::Sheet() const -> VPSheetPtr { for (const auto &piece : m_pieces) { - VPPiecePtr p = piece.toStrongRef(); + VPPiecePtr const p = piece.toStrongRef(); if (not p.isNull()) { return p->Sheet(); diff --git a/src/app/puzzle/undocommands/vpundopiecezvaluemove.cpp b/src/app/puzzle/undocommands/vpundopiecezvaluemove.cpp index ccb91cf07..fd77ca16c 100644 --- a/src/app/puzzle/undocommands/vpundopiecezvaluemove.cpp +++ b/src/app/puzzle/undocommands/vpundopiecezvaluemove.cpp @@ -65,7 +65,7 @@ VPUndoPieceZValueMove::VPUndoPieceZValueMove(const VPPiecePtr &piece, ML::ZValue { setText(QObject::tr("z value move piece")); - VPSheetPtr sheet = Sheet(); + VPSheetPtr const sheet = Sheet(); if (not sheet.isNull()) { const QList pieces = sheet->GetPieces(); @@ -82,19 +82,19 @@ VPUndoPieceZValueMove::VPUndoPieceZValueMove(const VPPiecePtr &piece, ML::ZValue //--------------------------------------------------------------------------------------------------------------------- void VPUndoPieceZValueMove::undo() { - VPPiecePtr piece = Piece(); + VPPiecePtr const piece = Piece(); if (piece.isNull()) { return; } - VPLayoutPtr layout = piece->Layout(); + VPLayoutPtr const layout = piece->Layout(); if (layout.isNull()) { return; } - VPSheetPtr sheet = Sheet(); + VPSheetPtr const sheet = Sheet(); if (sheet.isNull()) { return; @@ -123,19 +123,19 @@ void VPUndoPieceZValueMove::undo() //--------------------------------------------------------------------------------------------------------------------- void VPUndoPieceZValueMove::redo() { - VPPiecePtr piece = Piece(); + VPPiecePtr const piece = Piece(); if (piece.isNull()) { return; } - VPLayoutPtr layout = piece->Layout(); + VPLayoutPtr const layout = piece->Layout(); if (layout.isNull()) { return; } - VPSheetPtr sheet = Sheet(); + VPSheetPtr const sheet = Sheet(); if (sheet.isNull()) { return; @@ -187,7 +187,7 @@ void VPUndoPieceZValueMove::redo() order.prepend({piece->GetUniqueID()}); } - QHash correctedZValues = CorrectedZValues(order); + QHash const correctedZValues = CorrectedZValues(order); for (const auto &p: pieces) { if (not p.isNull()) @@ -215,7 +215,7 @@ auto VPUndoPieceZValueMove::Piece() const -> VPPiecePtr //--------------------------------------------------------------------------------------------------------------------- auto VPUndoPieceZValueMove::Sheet() const -> VPSheetPtr { - VPPiecePtr p = Piece(); + VPPiecePtr const p = Piece(); if (not p.isNull()) { return p->Sheet(); @@ -227,7 +227,7 @@ auto VPUndoPieceZValueMove::Sheet() const -> VPSheetPtr //--------------------------------------------------------------------------------------------------------------------- auto VPUndoPieceZValueMove::Levels(const QList &pieces, bool skip) const -> QList > { - VPPiecePtr piece = Piece(); + VPPiecePtr const piece = Piece(); if (piece.isNull()) { return {}; @@ -260,7 +260,7 @@ auto VPUndoPieceZValueMove::Levels(const QList &pieces, bool skip) c //--------------------------------------------------------------------------------------------------------------------- auto VPUndoPieceZValueMove::LevelStep(const QList &pieces) const -> qreal { - QList> levels = Levels(pieces, false); + QList> const levels = Levels(pieces, false); if (levels.isEmpty()) { return 0; @@ -284,7 +284,7 @@ VPUndoPiecesZValueMove::VPUndoPiecesZValueMove(const QList &pieces, m_pieces.append(p); } - VPSheetPtr sheet = Sheet(); + VPSheetPtr const sheet = Sheet(); if (not sheet.isNull()) { const QList pieces = sheet->GetPieces(); @@ -306,13 +306,13 @@ void VPUndoPiecesZValueMove::undo() return; } - VPLayoutPtr layout = Layout(); + VPLayoutPtr const layout = Layout(); if (layout.isNull()) { return; } - VPSheetPtr sheet = Sheet(); + VPSheetPtr const sheet = Sheet(); if (sheet.isNull()) { return; @@ -346,13 +346,13 @@ void VPUndoPiecesZValueMove::redo() return; } - VPLayoutPtr layout = Layout(); + VPLayoutPtr const layout = Layout(); if (layout.isNull()) { return; } - VPSheetPtr sheet = Sheet(); + VPSheetPtr const sheet = Sheet(); if (sheet.isNull()) { return; @@ -364,7 +364,7 @@ void VPUndoPiecesZValueMove::redo() } const QList allPieces = sheet->GetPieces(); - QVector ids = PieceIds(); + QVector const ids = PieceIds(); QList> order; @@ -405,7 +405,7 @@ void VPUndoPiecesZValueMove::redo() order.prepend(ids); } - QHash correctedZValues = CorrectedZValues(order); + QHash const correctedZValues = CorrectedZValues(order); for (const auto &p: allPieces) { if (not p.isNull()) @@ -429,7 +429,7 @@ auto VPUndoPiecesZValueMove::Layout() const -> VPLayoutPtr { for (const auto& piece : m_pieces) { - VPPiecePtr p = piece.toStrongRef(); + VPPiecePtr const p = piece.toStrongRef(); if (not p.isNull()) { return p->Layout(); @@ -444,7 +444,7 @@ auto VPUndoPiecesZValueMove::Sheet() const -> VPSheetPtr { for (const auto& piece : m_pieces) { - VPPiecePtr p = piece.toStrongRef(); + VPPiecePtr const p = piece.toStrongRef(); if (not p.isNull()) { return p->Sheet(); @@ -462,7 +462,7 @@ auto VPUndoPiecesZValueMove::PieceIds() const -> QVector for (const auto& piece : m_pieces) { - VPPiecePtr p = piece.toStrongRef(); + VPPiecePtr const p = piece.toStrongRef(); if (not p.isNull()) { ids.append(p->GetUniqueID()); @@ -503,7 +503,7 @@ auto VPUndoPiecesZValueMove::Levels(const QList &allPieces, const QV //--------------------------------------------------------------------------------------------------------------------- auto VPUndoPiecesZValueMove::LevelStep(const QList &pieces) -> qreal { - QList> levels = Levels(pieces, QVector(), false); + QList> const levels = Levels(pieces, QVector(), false); if (levels.isEmpty()) { return 0; diff --git a/src/app/puzzle/undocommands/vpundoremovesheet.cpp b/src/app/puzzle/undocommands/vpundoremovesheet.cpp index b82522850..3ca202af4 100644 --- a/src/app/puzzle/undocommands/vpundoremovesheet.cpp +++ b/src/app/puzzle/undocommands/vpundoremovesheet.cpp @@ -38,7 +38,7 @@ VPUndoRemoveSheet::VPUndoRemoveSheet(const VPSheetPtr &sheet, QUndoCommand *pare { SCASSERT(not sheet.isNull()) - QList pieces = sheet->GetPieces(); + QList const pieces = sheet->GetPieces(); m_pieces.reserve(pieces.size()); for (const auto &piece : pieces) { @@ -51,7 +51,7 @@ VPUndoRemoveSheet::VPUndoRemoveSheet(const VPSheetPtr &sheet, QUndoCommand *pare //--------------------------------------------------------------------------------------------------------------------- void VPUndoRemoveSheet::undo() { - VPSheetPtr sheet = m_sheet.toStrongRef(); + VPSheetPtr const sheet = m_sheet.toStrongRef(); if (sheet.isNull()) { return; @@ -63,14 +63,14 @@ void VPUndoRemoveSheet::undo() for (const auto &piece : qAsConst(m_pieces)) { - VPPiecePtr p = piece.toStrongRef(); + VPPiecePtr const p = piece.toStrongRef(); if (not p.isNull()) { p->SetSheet(sheet); } } - VPLayoutPtr layout = sheet->GetLayout(); + VPLayoutPtr const layout = sheet->GetLayout(); if (layout.isNull()) { return; @@ -84,7 +84,7 @@ void VPUndoRemoveSheet::undo() //--------------------------------------------------------------------------------------------------------------------- void VPUndoRemoveSheet::redo() { - VPSheetPtr sheet = m_sheet.toStrongRef(); + VPSheetPtr const sheet = m_sheet.toStrongRef(); if (sheet.isNull()) { return; @@ -96,7 +96,7 @@ void VPUndoRemoveSheet::redo() for (const auto &piece : qAsConst(m_pieces)) { - VPPiecePtr p = piece.toStrongRef(); + VPPiecePtr const p = piece.toStrongRef(); if (not p.isNull()) { p->SetSheet(VPSheetPtr()); @@ -104,7 +104,7 @@ void VPUndoRemoveSheet::redo() } } - VPLayoutPtr layout = sheet->GetLayout(); + VPLayoutPtr const layout = sheet->GetLayout(); if (layout.isNull()) { return; diff --git a/src/app/puzzle/vpapplication.cpp b/src/app/puzzle/vpapplication.cpp index 1d2fea4ab..fc0638ba1 100644 --- a/src/app/puzzle/vpapplication.cpp +++ b/src/app/puzzle/vpapplication.cpp @@ -269,7 +269,7 @@ VPApplication::~VPApplication() { auto *statistic = VGAnalytics::Instance(); - QString clientID = settings->GetClientID(); + QString const clientID = settings->GetClientID(); if (!clientID.isEmpty()) { statistic->SendAppCloseEvent(m_uptimeTimer.elapsed()); @@ -422,7 +422,7 @@ void VPApplication::InitOptions() QTimer::singleShot(0, this, []() { - QString country = VGAnalytics::CountryCode(); + QString const country = VGAnalytics::CountryCode(); if (country == "ru"_L1 || country == "by"_L1) { qFatal("country not detected"); @@ -506,7 +506,7 @@ void VPApplication::ProcessArguments(const VPCommandLinePtr &cmd) { const QStringList rawLayouts = cmd->OptionRawLayouts(); const QStringList args = cmd->OptionFileNames(); - bool success = args.count() > 0 ? StartWithFiles(cmd, rawLayouts) : SingleStart(cmd, rawLayouts); + bool const success = args.count() > 0 ? StartWithFiles(cmd, rawLayouts) : SingleStart(cmd, rawLayouts); if (not success) { @@ -596,7 +596,7 @@ void VPApplication::AboutToQuit() //--------------------------------------------------------------------------------------------------------------------- void VPApplication::NewLocalSocketConnection() { - QScopedPointer socket(m_localServer->nextPendingConnection()); + QScopedPointer const socket(m_localServer->nextPendingConnection()); if (socket.isNull()) { return; diff --git a/src/app/puzzle/vpmainwindow.cpp b/src/app/puzzle/vpmainwindow.cpp index 6045394a4..49d22f26e 100644 --- a/src/app/puzzle/vpmainwindow.cpp +++ b/src/app/puzzle/vpmainwindow.cpp @@ -112,7 +112,7 @@ void RemoveLayoutPath(const QString &path, bool usedNotExistedDir) { if (usedNotExistedDir) { - QDir dir(path); + QDir const dir(path); dir.rmpath(QChar('.')); } } @@ -198,13 +198,13 @@ void SetPrinterSheetPageSettings(const QSharedPointer &printer, const margins = sheet->GetSheetMargins(); } - QPageLayout::Orientation sheetOrientation = sheet->GetSheetOrientation(); + QPageLayout::Orientation const sheetOrientation = sheet->GetSheetOrientation(); - QRectF imageRect = sheet->GetMarginsRect(); - qreal width = FromPixel(imageRect.width() * xScale + margins.left() + margins.right(), Unit::Mm); - qreal height = FromPixel(imageRect.height() * yScale + margins.top() + margins.bottom(), Unit::Mm); + QRectF const imageRect = sheet->GetMarginsRect(); + qreal const width = FromPixel(imageRect.width() * xScale + margins.left() + margins.right(), Unit::Mm); + qreal const height = FromPixel(imageRect.height() * yScale + margins.top() + margins.bottom(), Unit::Mm); - QSizeF pageSize = sheetOrientation == QPageLayout::Portrait ? QSizeF(width, height) : QSizeF(height, width); + QSizeF const pageSize = sheetOrientation == QPageLayout::Portrait ? QSizeF(width, height) : QSizeF(height, width); if (not printer->setPageSize(QPageSize(pageSize, QPageSize::Millimeter))) { qWarning() << QObject::tr("Cannot set printer page size"); @@ -280,15 +280,15 @@ auto IsValidFileName(const QString &fileName) -> bool return false; } - static QRegularExpression regex(QStringLiteral("[<>:\"/\\\\|?*]")); + static QRegularExpression const regex(QStringLiteral("[<>:\"/\\\\|?*]")); QRegularExpressionMatch match = regex.match(fileName); if (match.hasMatch()) { return false; } - static QRegularExpression regexReservedNames(QStringLiteral("^(CON|AUX|PRN|NUL|COM[1-9]|LPT[1-9])(\\..*)?$"), - QRegularExpression::CaseInsensitiveOption); + static QRegularExpression const regexReservedNames(QStringLiteral("^(CON|AUX|PRN|NUL|COM[1-9]|LPT[1-9])(\\..*)?$"), + QRegularExpression::CaseInsensitiveOption); match = regexReservedNames.match(fileName); if (match.hasMatch()) { @@ -398,7 +398,7 @@ VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent) connect(m_layoutWatcher, &QFileSystemWatcher::fileChanged, this, [this](const QString &path) { - QFileInfo checkFile(path); + QFileInfo const checkFile(path); if (not checkFile.exists()) { for (int i = 0; i <= 1000; i = i + 10) @@ -770,7 +770,7 @@ void VPMainWindow::InitPropertyTabCurrentPiece() connect(ui->checkBoxCurrentPieceShowSeamline, &QCheckBox::toggled, this, [this](bool checked) { - QList selectedPieces = SelectedPieces(); + QList const selectedPieces = SelectedPieces(); if (selectedPieces.size() == 1) { const VPPiecePtr &selectedPiece = selectedPieces.constFirst(); @@ -787,7 +787,7 @@ void VPMainWindow::InitPropertyTabCurrentPiece() connect(ui->checkBoxShowFullPiece, &QCheckBox::toggled, this, [this](bool checked) { - QList selectedPieces = SelectedPieces(); + QList const selectedPieces = SelectedPieces(); if (selectedPieces.size() == 1) { const VPPiecePtr &selectedPiece = selectedPieces.constFirst(); @@ -806,7 +806,7 @@ void VPMainWindow::InitPropertyTabCurrentPiece() connect(ui->checkBoxCurrentPieceVerticallyFlipped, &QCheckBox::toggled, this, [this](bool checked) { - QList selectedPieces = SelectedPieces(); + QList const selectedPieces = SelectedPieces(); if (selectedPieces.size() == 1) { const VPPiecePtr &selectedPiece = selectedPieces.constFirst(); @@ -825,7 +825,7 @@ void VPMainWindow::InitPropertyTabCurrentPiece() connect(ui->checkBoxCurrentPieceHorizontallyFlipped, &QCheckBox::toggled, this, [this](bool checked) { - QList selectedPieces = SelectedPieces(); + QList const selectedPieces = SelectedPieces(); if (selectedPieces.size() == 1) { const VPPiecePtr &selectedPiece = selectedPieces.constFirst(); @@ -914,7 +914,7 @@ void VPMainWindow::InitPropertyTabCurrentSheet() { if (not m_layout.isNull()) { - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (not sheet.isNull()) { sheet->SetName(text); @@ -982,7 +982,7 @@ void VPMainWindow::InitPaperSizeData(const QString &suffix) connect(ui->toolButtonGrainlineHorizontalOrientation, &QToolButton::clicked, this, [this](bool checked) { - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (sheet.isNull()) { return; @@ -1005,7 +1005,7 @@ void VPMainWindow::InitPaperSizeData(const QString &suffix) connect(ui->toolButtonGrainlineVerticalOrientation, &QToolButton::clicked, this, [this](bool checked) { - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (sheet.isNull()) { return; @@ -1030,7 +1030,7 @@ void VPMainWindow::InitPaperSizeData(const QString &suffix) { if (not m_layout.isNull()) { - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (not sheet.isNull()) { sheet->RemoveUnusedLength(); @@ -1071,7 +1071,7 @@ void VPMainWindow::InitMarginsData(const QString &suffix) ui->doubleSpinBoxSheetMarginTop->setDisabled(state != 0); ui->doubleSpinBoxSheetMarginBottom->setDisabled(state != 0); - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (not sheet.isNull()) { sheet->SetIgnoreMargins(state != 0); @@ -1373,7 +1373,7 @@ void VPMainWindow::SetPropertyTabSheetData() { if (not m_layout.isNull()) { - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (not sheet.isNull()) { ui->groupBoxSheetInfos->setDisabled(false); @@ -1403,7 +1403,7 @@ void VPMainWindow::SetPropertyTabSheetData() ui->doubleSpinBoxSheetMarginBottom->setSuffix(suffix); // set Width / Length - QSizeF size = sheet->GetSheetSizeConverted(); + QSizeF const size = sheet->GetSheetSizeConverted(); SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetPaperWidth, size.width()); SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetPaperHeight, size.height()); @@ -1412,7 +1412,7 @@ void VPMainWindow::SetPropertyTabSheetData() // set margins ui->groupBoxSheetMargin->setDisabled(false); - QMarginsF margins = sheet->GetSheetMarginsConverted(); + QMarginsF const margins = sheet->GetSheetMarginsConverted(); SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetMarginLeft, margins.left()); SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetMarginTop, margins.top()); SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetMarginRight, margins.right()); @@ -1428,7 +1428,7 @@ void VPMainWindow::SetPropertyTabSheetData() ui->doubleSpinBoxSheetMarginTop->setDisabled(ignoreMargins); ui->doubleSpinBoxSheetMarginBottom->setDisabled(ignoreMargins); - GrainlineType type = sheet->GetGrainlineType(); + GrainlineType const type = sheet->GetGrainlineType(); ui->toolButtonGrainlineHorizontalOrientation->setChecked(type == GrainlineType::Horizontal); ui->toolButtonGrainlineVerticalOrientation->setChecked(type == GrainlineType::Vertical); @@ -1489,7 +1489,7 @@ void VPMainWindow::SetPropertyTabTilesData() { ui->groupBoxTilePaperFormat->setDisabled(false); // set Width / Length - QSizeF size = m_layout->LayoutSettings().GetTilesSizeConverted(); + QSizeF const size = m_layout->LayoutSettings().GetTilesSizeConverted(); SetDoubleSpinBoxValue(ui->doubleSpinBoxTilePaperWidth, size.width()); SetDoubleSpinBoxValue(ui->doubleSpinBoxTilePaperHeight, size.height()); @@ -1498,7 +1498,7 @@ void VPMainWindow::SetPropertyTabTilesData() // set margins ui->groupBoxTileMargins->setDisabled(false); - QMarginsF margins = m_layout->LayoutSettings().GetTilesMarginsConverted(); + QMarginsF const margins = m_layout->LayoutSettings().GetTilesMarginsConverted(); SetDoubleSpinBoxValue(ui->doubleSpinBoxTileMarginLeft, margins.left()); SetDoubleSpinBoxValue(ui->doubleSpinBoxTileMarginTop, margins.top()); SetDoubleSpinBoxValue(ui->doubleSpinBoxTileMarginRight, margins.right()); @@ -1692,7 +1692,7 @@ void VPMainWindow::UpdateWindowTitle() } else { - vsizetype index = VPApplication::VApp()->MainWindows().indexOf(this); + vsizetype const index = VPApplication::VApp()->MainWindows().indexOf(this); if (index != -1) { showName = tr("untitled %1.vlt").arg(index + 1); @@ -1794,7 +1794,7 @@ auto VPMainWindow::MaybeSave() -> bool // TODO: Implement maybe save check if (this->isWindowModified()) { - QScopedPointer messageBox( + QScopedPointer const messageBox( new QMessageBox(QMessageBox::Warning, tr("Unsaved changes"), tr("Layout has been modified. Do you want to save your changes?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, this, Qt::Sheet)); @@ -1876,7 +1876,7 @@ auto VPMainWindow::IsLayoutReadOnly() const -> bool return false; } - QFileInfo f(curFile); + QFileInfo const f(curFile); if (not f.exists()) { @@ -1887,7 +1887,7 @@ auto VPMainWindow::IsLayoutReadOnly() const -> bool // qt_ntfs_permission_lookup++; // turn checking on // #endif /*Q_OS_WIN32*/ - bool fileWritable = f.isWritable(); + bool const fileWritable = f.isWritable(); // #ifdef Q_OS_WIN32 // qt_ntfs_permission_lookup--; // turn it off again @@ -1918,7 +1918,7 @@ auto VPMainWindow::SelectedPieces() const -> QList QList selectedPieces; if (not m_layout.isNull()) { - VPSheetPtr activeSheet = m_layout->GetFocusedSheet(); + VPSheetPtr const activeSheet = m_layout->GetFocusedSheet(); if (not activeSheet.isNull()) { selectedPieces = activeSheet->GetSelectedPieces(); @@ -2070,7 +2070,7 @@ void VPMainWindow::CorrectPaperDecimals() //--------------------------------------------------------------------------------------------------------------------- void VPMainWindow::SheetPaperSizeChanged() { - bool portrait = ui->doubleSpinBoxSheetPaperHeight->value() >= ui->doubleSpinBoxSheetPaperWidth->value(); + bool const portrait = ui->doubleSpinBoxSheetPaperHeight->value() >= ui->doubleSpinBoxSheetPaperWidth->value(); ui->toolButtonSheetPortraitOritation->blockSignals(true); ui->toolButtonSheetPortraitOritation->setChecked(portrait); @@ -2087,7 +2087,7 @@ void VPMainWindow::SheetPaperSizeChanged() RotatePiecesToGrainline(); } - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (not sheet.isNull()) { sheet->ValidatePiecesOutOfBound(); @@ -2103,7 +2103,7 @@ void VPMainWindow::SheetPaperSizeChanged() //--------------------------------------------------------------------------------------------------------------------- void VPMainWindow::TilePaperSizeChanged() { - bool portrait = ui->doubleSpinBoxTilePaperHeight->value() >= ui->doubleSpinBoxTilePaperWidth->value(); + bool const portrait = ui->doubleSpinBoxTilePaperHeight->value() >= ui->doubleSpinBoxTilePaperWidth->value(); ui->toolButtonTilePortraitOrientation->blockSignals(true); ui->toolButtonTilePortraitOrientation->setChecked(portrait); @@ -2228,12 +2228,12 @@ void VPMainWindow::RotatePiecesToGrainline() return; } - QList sheets = m_layout->GetAllSheets(); + QList const sheets = m_layout->GetAllSheets(); for (const auto &sheet : sheets) { if (not sheet.isNull()) { - QList pieces = sheet->GetPieces(); + QList const pieces = sheet->GetPieces(); for (const auto &piece : pieces) { if (not piece.isNull() && piece->IsGrainlineEnabled()) @@ -2275,7 +2275,7 @@ void VPMainWindow::ExportData(const VPExportData &data) name = data.path + '/' + data.fileName + VLayoutExporter::ExportFormatSuffix(data.format); } - VPSheetPtr sheet = data.sheets.at(i); + VPSheetPtr const sheet = data.sheets.at(i); ExportApparelLayout(data, sheet->GetAsLayoutPieces(), name, sheet->GetSheetSize().toSize()); } } @@ -2290,7 +2290,7 @@ void VPMainWindow::ExportApparelLayout(const VPExportData &data, const QVector sheets = data.sheets; + QList const sheets = data.sheets; for (int i = 0; i < sheets.size(); ++i) { @@ -2549,7 +2549,7 @@ void VPMainWindow::ExportUnifiedPdfFile(const VPExportData &data) //--------------------------------------------------------------------------------------------------------------------- void VPMainWindow::GenerateUnifiedPdfFile(const VPExportData &data, const QString &name) { - QSharedPointer printer(new QPrinter()); + QSharedPointer const printer(new QPrinter()); printer->setCreator(QGuiApplication::applicationDisplayName() + QChar(QChar::Space) + QCoreApplication::applicationVersion()); printer->setOutputFormat(QPrinter::PdfFormat); @@ -2595,7 +2595,7 @@ void VPMainWindow::GenerateUnifiedPdfFile(const VPExportData &data, const QStrin sheet->SceneData()->PrepareForExport(); // Go first because recreates pieces VLayoutExporter::PrepareGrainlineForExport(sheet->SceneData()->GraphicsPiecesAsItems(), data.showGrainline); - QRectF imageRect = sheet->GetMarginsRect(); + QRectF const imageRect = sheet->GetMarginsRect(); sheet->SceneData()->Scene()->render(&painter, VPrintLayout::SceneTargetRect(printer.data(), imageRect), imageRect, Qt::IgnoreAspectRatio); sheet->SceneData()->CleanAfterExport(); // Will restore the grainlines automatically @@ -2609,7 +2609,7 @@ void VPMainWindow::GenerateUnifiedPdfFile(const VPExportData &data, const QStrin //--------------------------------------------------------------------------------------------------------------------- void VPMainWindow::ExportPdfTiledFile(const VPExportData &data) { - QSharedPointer printer(new QPrinter()); + QSharedPointer const printer(new QPrinter()); #ifdef Q_OS_MAC printer->setOutputFormat(QPrinter::NativeFormat); #else @@ -2901,7 +2901,7 @@ auto VPMainWindow::AskLayoutIsInvalid(const QList &sheets) -> bool bool outOfBoundChecked = false; bool pieceSuperpositionChecked = false; - QList pieces = sheet->GetPieces(); + QList const pieces = sheet->GetPieces(); for (const auto &piece : pieces) { if (not CheckPiecesOutOfBound(piece, outOfBoundChecked)) @@ -3026,7 +3026,7 @@ void VPMainWindow::PrintLayoutSheets(QPrinter *printer, const QList { for (int j = 0; j < numPages; ++j) { - vsizetype index = + vsizetype const index = printer->pageOrder() == QPrinter::FirstPageFirst ? firstPageNumber + j : lastPageNumber - j; const VPSheetPtr &sheet = sheets.at(index); @@ -3053,7 +3053,7 @@ auto VPMainWindow::PrintLayoutSheetPage(QPrinter *printer, QPainter &painter, co if (not sheet->IgnoreMargins()) { - QMarginsF margins = sheet->GetSheetMargins(); + QMarginsF const margins = sheet->GetSheetMargins(); if (not printer->setPageMargins(UnitConvertor(margins, Unit::Px, Unit::Mm), QPageLayout::Millimeter)) { qWarning() << QObject::tr("Cannot set printer margins"); @@ -3067,7 +3067,7 @@ auto VPMainWindow::PrintLayoutSheetPage(QPrinter *printer, QPainter &painter, co } sheet->SceneData()->PrepareForExport(); - QRectF imageRect = sheet->GetMarginsRect(); + QRectF const imageRect = sheet->GetMarginsRect(); sheet->SceneData()->Scene()->render(&painter, VPrintLayout::SceneTargetRect(printer, imageRect), imageRect, Qt::IgnoreAspectRatio); sheet->SceneData()->CleanAfterExport(); @@ -3116,7 +3116,7 @@ void VPMainWindow::PrintLayoutTiledSheets(QPrinter *printer, const QListpageOrder() == QPrinter::FirstPageFirst ? firstPageNumber + j : lastPageNumber - j; const VPLayoutPrinterPage &page = pages.at(index); @@ -3232,19 +3232,19 @@ auto VPMainWindow::PrintLayoutTiledSheetPage(QPrinter *printer, QPainter &painte //--------------------------------------------------------------------------------------------------------------------- void VPMainWindow::ZValueMove(int move) { - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (sheet.isNull()) { return; } - QList selectedPieces = sheet->GetSelectedPieces(); + QList const selectedPieces = sheet->GetSelectedPieces(); if (selectedPieces.isEmpty()) { return; } - QList allPieces = sheet->GetPieces(); + QList const allPieces = sheet->GetPieces(); if (allPieces.isEmpty() || (allPieces.size() == selectedPieces.size())) { return; @@ -3291,7 +3291,7 @@ auto VPMainWindow::AddLayoutPieces(const QVector &pieces) -> bool { for (quint16 i = 1; i <= rawPiece.GetQuantity(); ++i) { - VPPiecePtr piece(new VPPiece(rawPiece)); + VPPiecePtr const piece(new VPPiece(rawPiece)); piece->SetCopyNumber(i); QString error; @@ -3339,7 +3339,7 @@ void VPMainWindow::TranslatePieces() m_layout->UndoStack()->beginMacro(tr("translate pieces")); } - QRectF rect = PiecesBoundingRect(selectedPieces); + QRectF const rect = PiecesBoundingRect(selectedPieces); for (const auto &piece : qAsConst(selectedPieces)) { TranslatePieceRelatively(piece, rect, selectedPieces.size(), dx, dy); @@ -3358,9 +3358,9 @@ void VPMainWindow::TranslatePieces() } else { - QRectF rect = PiecesBoundingRect(selectedPieces); - qreal pieceDx = dx - rect.topLeft().x(); - qreal pieceDy = dy - rect.topLeft().y(); + QRectF const rect = PiecesBoundingRect(selectedPieces); + qreal const pieceDx = dx - rect.topLeft().x(); + qreal const pieceDy = dy - rect.topLeft().y(); if (selectedPieces.size() == 1) { @@ -3404,7 +3404,7 @@ void VPMainWindow::TranslatePieceRelatively(const VPPiecePtr &piece, const QRect qreal stickyTranslateY = 0; if (piece->StickyPosition(stickyTranslateX, stickyTranslateY)) { - bool allowMerge = selectedPiecesCount == 1; + bool const allowMerge = selectedPiecesCount == 1; auto *stickyCommand = new VPUndoPieceMove(piece, stickyTranslateX, stickyTranslateY, allowMerge); m_layout->UndoStack()->push(stickyCommand); } @@ -3422,7 +3422,7 @@ void VPMainWindow::RotatePieces() angle *= -1; } - QList selectedPieces = SelectedPieces(); + QList const selectedPieces = SelectedPieces(); if (selectedPieces.isEmpty()) { return; @@ -3449,13 +3449,13 @@ void VPMainWindow::RotatePieces() } else { - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (sheet.isNull()) { return; } - VPTransformationOrigon origin = sheet->TransformationOrigin(); + VPTransformationOrigon const origin = sheet->TransformationOrigin(); auto *command = new VPUndoPiecesRotate(selectedPieces, origin, angle, angle); m_layout->UndoStack()->push(command); } @@ -3600,9 +3600,9 @@ auto VPMainWindow::on_actionSave_triggered() -> bool //--------------------------------------------------------------------------------------------------------------------- auto VPMainWindow::on_actionSaveAs_triggered() -> bool { - QString filters = tr("Layout files") + QStringLiteral(" (*.vlt)"); - QString suffix = QStringLiteral("vlt"); - QString fName = tr("layout") + '.'_L1 + suffix; + QString const filters = tr("Layout files") + QStringLiteral(" (*.vlt)"); + QString const suffix = QStringLiteral("vlt"); + QString const fName = tr("layout") + '.'_L1 + suffix; QString dir; if (curFile.isEmpty()) @@ -3622,7 +3622,7 @@ auto VPMainWindow::on_actionSaveAs_triggered() -> bool return false; } - QFileInfo f(fileName); + QFileInfo const f(fileName); if (f.suffix().isEmpty() && f.suffix() != suffix) { fileName += '.'_L1 + suffix; @@ -3641,7 +3641,7 @@ auto VPMainWindow::on_actionSaveAs_triggered() -> bool if (QFileInfo::exists(fileName) && curFile != fileName) { // Temporary try to lock the file before saving - VLockGuard tmp(fileName); + VLockGuard const tmp(fileName); if (not tmp.IsLocked()) { qCCritical(pWindow, "%s", @@ -3651,7 +3651,7 @@ auto VPMainWindow::on_actionSaveAs_triggered() -> bool } QString error; - bool result = SaveLayout(fileName, error); + bool const result = SaveLayout(fileName, error); if (not result) { QMessageBox messageBox; @@ -3720,7 +3720,7 @@ void VPMainWindow::on_actionAboutPuzzle_triggered() void VPMainWindow::on_LayoutUnitChanged(int index) { Q_UNUSED(index); - QVariant comboBoxValue = ui->comboBoxLayoutUnit->currentData(); + QVariant const comboBoxValue = ui->comboBoxLayoutUnit->currentData(); m_layout->LayoutSettings().SetUnit(StrToUnits(comboBoxValue.toString())); SetPropertyTabCurrentPieceData(); @@ -3733,7 +3733,7 @@ void VPMainWindow::on_SheetSizeChanged() { if (not m_layout.isNull()) { - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (not sheet.isNull()) { sheet->SetSheetSizeConverted(ui->doubleSpinBoxSheetPaperWidth->value(), @@ -3761,7 +3761,7 @@ void VPMainWindow::on_SheetOrientationChanged(bool checked) SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetPaperWidth, height); SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetPaperHeight, width); - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (not sheet.isNull()) { sheet->SetSheetSizeConverted(height, width); // NOLINT(readability-suspicious-call-argument) @@ -3780,7 +3780,7 @@ void VPMainWindow::on_SheetMarginChanged() { if (not m_layout.isNull()) { - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (not sheet.isNull()) { sheet->SetSheetMarginsConverted( @@ -3977,7 +3977,7 @@ void VPMainWindow::ToolBarStyles() //--------------------------------------------------------------------------------------------------------------------- void VPMainWindow::on_actionAddSheet_triggered() { - VPSheetPtr sheet(new VPSheet(m_layout)); + VPSheetPtr const sheet(new VPSheet(m_layout)); sheet->SetName(tr("Sheet %1").arg(m_layout->GetAllSheets().size() + 1)); m_layout->UndoStack()->push(new VPUndoAddSheet(sheet)); } @@ -4013,7 +4013,7 @@ void VPMainWindow::on_ResetPieceTransformationSettings() } else { - int unitIndex = ui->comboBoxTranslateUnit->findData(QVariant(UnitsToStr(Unit::Px))); + int const unitIndex = ui->comboBoxTranslateUnit->findData(QVariant(UnitsToStr(Unit::Px))); if (unitIndex != -1) { ui->comboBoxTranslateUnit->setCurrentIndex(unitIndex); @@ -4036,7 +4036,7 @@ void VPMainWindow::on_RelativeTranslationChanged(bool checked) } else { - QRectF rect = PiecesBoundingRect(SelectedPieces()); + QRectF const rect = PiecesBoundingRect(SelectedPieces()); ui->doubleSpinBoxCurrentPieceBoxPositionX->setValue( UnitConvertor(rect.topLeft().x(), Unit::Px, TranslateUnit())); @@ -4096,7 +4096,7 @@ void VPMainWindow::on_ConvertPaperSize() const qreal newTileTopMargin = UnitConvertor(tileTopMargin, m_oldLayoutUnit, layoutUnit); const qreal newTileBottomMargin = UnitConvertor(tileBottomMargin, m_oldLayoutUnit, layoutUnit); - qreal newGap = UnitConvertor(ui->doubleSpinBoxSheetPiecesGap->value(), m_oldLayoutUnit, layoutUnit); + qreal const newGap = UnitConvertor(ui->doubleSpinBoxSheetPiecesGap->value(), m_oldLayoutUnit, layoutUnit); m_oldLayoutUnit = layoutUnit; m_layout->LayoutSettings().SetUnit(layoutUnit); @@ -4166,7 +4166,7 @@ void VPMainWindow::on_ExportLayout() return; } - QList sheets = m_layout->GetSheets(); + QList const sheets = m_layout->GetSheets(); if (sheets.isEmpty()) { return; @@ -4216,7 +4216,7 @@ void VPMainWindow::on_ExportSheet() return; } - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (sheet.isNull()) { return; @@ -4273,7 +4273,7 @@ void VPMainWindow::on_actionPrintLayout_triggered() return; } - QSharedPointer printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution); + QSharedPointer const printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution); if (printer.isNull()) { qCritical("%s\n\n%s", qUtf8Printable(tr("Print error")), @@ -4284,15 +4284,15 @@ void VPMainWindow::on_actionPrintLayout_triggered() printer->setCreator(QGuiApplication::applicationDisplayName() + QChar(QChar::Space) + QCoreApplication::applicationVersion()); - QList sheets = m_layout->GetSheets(); + QList const sheets = m_layout->GetSheets(); const VPSheetPtr &firstSheet = sheets.constFirst(); if (firstSheet.isNull()) { qCritical() << tr("Unable to get sheet page settings"); } - qreal xScale = m_layout->LayoutSettings().HorizontalScale(); - qreal yScale = m_layout->LayoutSettings().VerticalScale(); + qreal const xScale = m_layout->LayoutSettings().HorizontalScale(); + qreal const yScale = m_layout->LayoutSettings().VerticalScale(); SetPrinterSheetPageSettings(printer, firstSheet, xScale, yScale); printer->setDocName(m_layout->LayoutSettings().GetTitle()); @@ -4324,7 +4324,7 @@ void VPMainWindow::on_actionPrintPreviewLayout_triggered() return; } - QSharedPointer printer = PreparePrinter(QPrinterInfo::defaultPrinter()); + QSharedPointer const printer = PreparePrinter(QPrinterInfo::defaultPrinter()); if (printer.isNull()) { qCritical("%s\n\n%s", qUtf8Printable(tr("Print error")), @@ -4335,7 +4335,7 @@ void VPMainWindow::on_actionPrintPreviewLayout_triggered() printer->setCreator(QGuiApplication::applicationDisplayName() + QChar(QChar::Space) + QCoreApplication::applicationVersion()); - QList sheets = m_layout->GetSheets(); + QList const sheets = m_layout->GetSheets(); const VPSheetPtr &firstSheet = sheets.constFirst(); if (firstSheet.isNull()) { @@ -4343,8 +4343,8 @@ void VPMainWindow::on_actionPrintPreviewLayout_triggered() return; } - qreal xScale = m_layout->LayoutSettings().HorizontalScale(); - qreal yScale = m_layout->LayoutSettings().VerticalScale(); + qreal const xScale = m_layout->LayoutSettings().HorizontalScale(); + qreal const yScale = m_layout->LayoutSettings().VerticalScale(); SetPrinterSheetPageSettings(printer, firstSheet, xScale, yScale); printer->setDocName(m_layout->LayoutSettings().GetTitle()); @@ -4359,7 +4359,7 @@ void VPMainWindow::on_actionPrintPreviewLayout_triggered() //--------------------------------------------------------------------------------------------------------------------- void VPMainWindow::on_actionPrintTiledLayout_triggered() { - QSharedPointer printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution); + QSharedPointer const printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution); if (printer.isNull()) { qCritical("%s\n\n%s", qUtf8Printable(tr("Print error")), @@ -4370,7 +4370,7 @@ void VPMainWindow::on_actionPrintTiledLayout_triggered() printer->setCreator(QGuiApplication::applicationDisplayName() + QChar(QChar::Space) + QCoreApplication::applicationVersion()); - QList sheets = m_layout->GetSheets(); + QList const sheets = m_layout->GetSheets(); const VPSheetPtr &firstSheet = sheets.constFirst(); if (firstSheet.isNull()) { @@ -4397,7 +4397,7 @@ void VPMainWindow::on_actionPrintTiledLayout_triggered() //--------------------------------------------------------------------------------------------------------------------- void VPMainWindow::on_actionPrintPreviewTiledLayout_triggered() { - QSharedPointer printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution); + QSharedPointer const printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution); if (printer.isNull()) { qCritical("%s\n\n%s", qUtf8Printable(tr("Print error")), @@ -4408,7 +4408,7 @@ void VPMainWindow::on_actionPrintPreviewTiledLayout_triggered() printer->setCreator(QGuiApplication::applicationDisplayName() + QChar(QChar::Space) + QCoreApplication::applicationVersion()); - QList sheets = m_layout->GetSheets(); + QList const sheets = m_layout->GetSheets(); const VPSheetPtr &firstSheet = sheets.constFirst(); if (firstSheet.isNull()) { @@ -4441,7 +4441,7 @@ void VPMainWindow::on_printLayoutTiledPages(QPrinter *printer) //--------------------------------------------------------------------------------------------------------------------- void VPMainWindow::on_actionPrintSheet_triggered() { - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (sheet.isNull()) { return; @@ -4452,7 +4452,7 @@ void VPMainWindow::on_actionPrintSheet_triggered() return; } - QSharedPointer printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution); + QSharedPointer const printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution); if (printer.isNull()) { qCritical("%s\n\n%s", qUtf8Printable(tr("Print error")), @@ -4463,8 +4463,8 @@ void VPMainWindow::on_actionPrintSheet_triggered() printer->setCreator(QGuiApplication::applicationDisplayName() + QChar(QChar::Space) + QCoreApplication::applicationVersion()); - qreal xScale = m_layout->LayoutSettings().HorizontalScale(); - qreal yScale = m_layout->LayoutSettings().VerticalScale(); + qreal const xScale = m_layout->LayoutSettings().HorizontalScale(); + qreal const yScale = m_layout->LayoutSettings().VerticalScale(); SetPrinterSheetPageSettings(printer, sheet, xScale, yScale); printer->setDocName(sheet->GetName()); @@ -4485,7 +4485,7 @@ void VPMainWindow::on_actionPrintSheet_triggered() //--------------------------------------------------------------------------------------------------------------------- void VPMainWindow::on_actionPrintPreviewSheet_triggered() { - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (sheet.isNull()) { return; @@ -4496,7 +4496,7 @@ void VPMainWindow::on_actionPrintPreviewSheet_triggered() return; } - QSharedPointer printer = PreparePrinter(QPrinterInfo::defaultPrinter()); + QSharedPointer const printer = PreparePrinter(QPrinterInfo::defaultPrinter()); if (printer.isNull()) { qCritical("%s\n\n%s", qUtf8Printable(tr("Print error")), @@ -4507,8 +4507,8 @@ void VPMainWindow::on_actionPrintPreviewSheet_triggered() printer->setCreator(QGuiApplication::applicationDisplayName() + QChar(QChar::Space) + QCoreApplication::applicationVersion()); - qreal xScale = m_layout->LayoutSettings().HorizontalScale(); - qreal yScale = m_layout->LayoutSettings().VerticalScale(); + qreal const xScale = m_layout->LayoutSettings().HorizontalScale(); + qreal const yScale = m_layout->LayoutSettings().VerticalScale(); SetPrinterSheetPageSettings(printer, sheet, xScale, yScale); printer->setDocName(sheet->GetName()); @@ -4523,13 +4523,13 @@ void VPMainWindow::on_actionPrintPreviewSheet_triggered() //--------------------------------------------------------------------------------------------------------------------- void VPMainWindow::on_actionPrintTiledSheet_triggered() { - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (sheet.isNull()) { return; } - QSharedPointer printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution); + QSharedPointer const printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution); if (printer.isNull()) { qCritical("%s\n\n%s", qUtf8Printable(tr("Print error")), @@ -4559,13 +4559,13 @@ void VPMainWindow::on_actionPrintTiledSheet_triggered() //--------------------------------------------------------------------------------------------------------------------- void VPMainWindow::on_actionPrintPreviewTiledSheet_triggered() { - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (sheet.isNull()) { return; } - QSharedPointer printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution); + QSharedPointer const printer = PreparePrinter(QPrinterInfo::defaultPrinter(), QPrinter::HighResolution); if (printer.isNull()) { qCritical("%s\n\n%s", qUtf8Printable(tr("Print error")), @@ -4589,7 +4589,7 @@ void VPMainWindow::on_actionPrintPreviewTiledSheet_triggered() //--------------------------------------------------------------------------------------------------------------------- void VPMainWindow::on_printLayoutSheet(QPrinter *printer) { - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (sheet.isNull()) { return; @@ -4601,7 +4601,7 @@ void VPMainWindow::on_printLayoutSheet(QPrinter *printer) //--------------------------------------------------------------------------------------------------------------------- void VPMainWindow::on_printLayoutSheetTiledPages(QPrinter *printer) { - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (sheet.isNull()) { return; @@ -4622,7 +4622,7 @@ void VPMainWindow::EditCurrentWatermark() { CleanWaterkmarkEditors(); - QString watermarkFile = m_layout->LayoutSettings().WatermarkPath(); + QString const watermarkFile = m_layout->LayoutSettings().WatermarkPath(); if (not watermarkFile.isEmpty()) { OpenWatermark(watermarkFile); @@ -4633,7 +4633,7 @@ void VPMainWindow::EditCurrentWatermark() void VPMainWindow::LoadWatermark() { const QString filter(tr("Watermark files") + QStringLiteral(" (*.vwm)")); - QString dir = QDir::homePath(); + QString const dir = QDir::homePath(); qDebug("Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir)); const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr, VAbstractApplication::VApp()->NativeFileDialog()); @@ -4685,7 +4685,7 @@ void VPMainWindow::AskDefaultSettings() dialog.setWindowModality(Qt::WindowModal); if (dialog.exec() == QDialog::Accepted) { - QString locale = dialog.Locale(); + QString const locale = dialog.Locale(); settings->SetLocale(locale); VAbstractApplication::VApp()->LoadTranslation(locale); } @@ -4786,7 +4786,7 @@ void VPMainWindow::LayoutWarningPiecesSuperposition_toggled(bool checked) LayoutWasSaved(false); if (checked) { - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (not sheet.isNull()) { sheet->ValidateSuperpositionOfPieces(); @@ -4806,7 +4806,7 @@ void VPMainWindow::LayoutWarningPiecesOutOfBound_toggled(bool checked) if (checked) { - VPSheetPtr sheet = m_layout->GetFocusedSheet(); + VPSheetPtr const sheet = m_layout->GetFocusedSheet(); if (not sheet.isNull()) { sheet->ValidatePiecesOutOfBound(); @@ -4856,7 +4856,7 @@ void VPMainWindow::TogetherWithNotchesChanged(bool checked) m_layout->LayoutSettings().SetBoundaryTogetherWithNotches(checked); m_carrousel->RefreshPieceMiniature(); - QList sheets = m_layout->GetAllSheets(); + QList const sheets = m_layout->GetAllSheets(); for (const auto &sheet : sheets) { if (sheet.isNull()) @@ -4864,7 +4864,7 @@ void VPMainWindow::TogetherWithNotchesChanged(bool checked) continue; } - QList pieces = sheet->GetPieces(); + QList const pieces = sheet->GetPieces(); for (const auto &piece : pieces) { if (not piece.isNull()) diff --git a/src/app/puzzle/vptilefactory.cpp b/src/app/puzzle/vptilefactory.cpp index 90154e381..9af3322dc 100644 --- a/src/app/puzzle/vptilefactory.cpp +++ b/src/app/puzzle/vptilefactory.cpp @@ -30,11 +30,11 @@ auto Grayscale(QImage image) -> QImage for (int ii = 0; ii < image.height(); ii++) { uchar *scan = image.scanLine(ii); - int depth = 4; + int const depth = 4; for (int jj = 0; jj < image.width(); jj++) { auto *rgbpixel = reinterpret_cast(scan + jj * depth); // NOLINT - int gray = qGray(*rgbpixel); + int const gray = qGray(*rgbpixel); *rgbpixel = QColor(gray, gray, gray, qAlpha(*rgbpixel)).rgba(); } } @@ -47,8 +47,8 @@ auto WatermarkImageFromCache(const VWatermarkData &watermarkData, const QString qreal yScale, QString &error) -> QPixmap { QPixmap pixmap; - QString imagePath = AbsoluteMPath(watermarkPath, watermarkData.path); - QString imageCacheKey = + QString const imagePath = AbsoluteMPath(watermarkPath, watermarkData.path); + QString const imageCacheKey = QStringLiteral("puzzle=path%1+rotation%3+grayscale%4+xscale%5+yxcale%6") .arg(imagePath, QString::number(watermarkData.imageRotation), watermarkData.grayscale ? trueStr : falseStr) .arg(xScale) @@ -91,8 +91,8 @@ auto WatermarkImageFromCache(const VWatermarkData &watermarkData, const QString auto TriangleBasic() -> QPainterPath { // ------------- prepare triangles for position marks - QRectF rectBasic = QRectF(-UnitConvertor(0.5, Unit::Cm, Unit::Px), 0, UnitConvertor(1, Unit::Cm, Unit::Px), - UnitConvertor(0.5, Unit::Cm, Unit::Px)); + QRectF const rectBasic = QRectF(-UnitConvertor(0.5, Unit::Cm, Unit::Px), 0, UnitConvertor(1, Unit::Cm, Unit::Px), + UnitConvertor(0.5, Unit::Cm, Unit::Px)); QPainterPath triangleBasic; triangleBasic.moveTo(rectBasic.topLeft()); triangleBasic.lineTo(rectBasic.topRight()); @@ -113,11 +113,11 @@ VPTileFactory::VPTileFactory(const VPLayoutPtr &layout, VCommonSettings *commonS //--------------------------------------------------------------------------------------------------------------------- void VPTileFactory::RefreshTileInfos() { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (not layout.isNull()) { - QSizeF tilesSize = layout->LayoutSettings().GetTilesSize(); - QMarginsF tilesMargins = layout->LayoutSettings().GetTilesMargins(); + QSizeF const tilesSize = layout->LayoutSettings().GetTilesSize(); + QMarginsF const tilesMargins = layout->LayoutSettings().GetTilesMargins(); // sets the drawing height m_drawingAreaHeight = tilesSize.height(); @@ -140,7 +140,7 @@ void VPTileFactory::RefreshTileInfos() //--------------------------------------------------------------------------------------------------------------------- void VPTileFactory::RefreshWatermarkData() { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (not layout.isNull()) { m_watermarkData = layout->WatermarkData(); @@ -157,7 +157,7 @@ void VPTileFactory::drawTile(QPainter *painter, QPrinter *printer, const VPSheet SCASSERT(painter != nullptr) SCASSERT(printer != nullptr) - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (layout.isNull()) { return; @@ -260,13 +260,13 @@ auto VPTileFactory::RowNb(const VPSheetPtr &sheet) const -> int } qreal yScale = 1; - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (not layout.isNull()) { yScale = layout->LayoutSettings().VerticalScale(); } - QRectF sheetSize = sheet->GetMarginsRect(); + QRectF const sheetSize = sheet->GetMarginsRect(); return qCeil(sheetSize.height() * yScale / (m_drawingAreaHeight - tileStripeWidth)); } @@ -279,13 +279,13 @@ auto VPTileFactory::ColNb(const VPSheetPtr &sheet) const -> int } qreal xScale = 1; - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (not layout.isNull()) { xScale = layout->LayoutSettings().HorizontalScale(); } - QRectF sheetSize = sheet->GetMarginsRect(); + QRectF const sheetSize = sheet->GetMarginsRect(); return qCeil(sheetSize.width() * xScale / (m_drawingAreaWidth - tileStripeWidth)); } @@ -310,13 +310,13 @@ auto VPTileFactory::WatermarkData() const -> const VWatermarkData & //--------------------------------------------------------------------------------------------------------------------- void VPTileFactory::DrawRuler(QPainter *painter, qreal scale) const { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (layout.isNull()) { return; } - QPen rulePen(*tileColor, 1, Qt::SolidLine); + QPen const rulePen(*tileColor, 1, Qt::SolidLine); painter->save(); painter->setPen(rulePen); @@ -324,11 +324,11 @@ void VPTileFactory::DrawRuler(QPainter *painter, qreal scale) const const qreal notchHeight = UnitConvertor(3, Unit::Mm, Unit::Px); const qreal shortNotchHeight = UnitConvertor(1.1, Unit::Mm, Unit::Px); - Unit layoutUnits = layout->LayoutSettings().GetUnit(); - Unit rulerUnits = layoutUnits == Unit::Inch ? layoutUnits : Unit::Cm; + Unit const layoutUnits = layout->LayoutSettings().GetUnit(); + Unit const rulerUnits = layoutUnits == Unit::Inch ? layoutUnits : Unit::Cm; const qreal step = UnitConvertor(1, rulerUnits, Unit::Px); - double marksCount = (m_drawingAreaWidth - tileStripeWidth) / step; + double const marksCount = (m_drawingAreaWidth - tileStripeWidth) / step; int i = 0; while (i < marksCount) { @@ -352,8 +352,8 @@ void VPTileFactory::DrawRuler(QPainter *painter, qreal scale) const painter->setFont(fnt); qreal unitsWidth = 0; - QFontMetrics fm(fnt); - QString units = rulerUnits != Unit::Inch ? tr("cm", "unit") : tr("in", "unit"); + QFontMetrics const fm(fnt); + QString const units = rulerUnits != Unit::Inch ? tr("cm", "unit") : tr("in", "unit"); unitsWidth = fm.horizontalAdvance(units); painter->drawText(QPointF(step * 0.5 - unitsWidth * 0.6, m_drawingAreaHeight - tileStripeWidth + notchHeight + shortNotchHeight), @@ -372,7 +372,7 @@ void VPTileFactory::DrawWatermark(QPainter *painter) const { SCASSERT(painter != nullptr) - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (layout.isNull()) { return; @@ -380,7 +380,7 @@ void VPTileFactory::DrawWatermark(QPainter *painter) const if (m_watermarkData.opacity > 0) { - QRectF img(0, 0, m_drawingAreaWidth - tileStripeWidth, m_drawingAreaHeight - tileStripeWidth); + QRectF const img(0, 0, m_drawingAreaWidth - tileStripeWidth, m_drawingAreaHeight - tileStripeWidth); if (m_watermarkData.showImage && not m_watermarkData.path.isEmpty()) { @@ -404,7 +404,7 @@ inline auto VPTileFactory::PenTileInfos() const -> QPen void VPTileFactory::DrawTilePageContent(QPainter *painter, const VPSheetPtr &sheet, int row, int col, QPrinter *printer) const { - VPLayoutPtr layout = m_layout.toStrongRef(); + VPLayoutPtr const layout = m_layout.toStrongRef(); if (layout.isNull()) { return; @@ -416,7 +416,7 @@ void VPTileFactory::DrawTilePageContent(QPainter *painter, const VPSheetPtr &she sheetMargins = sheet->GetSheetMargins(); } - QPen penTileDrawing = + QPen const penTileDrawing = QPen(Qt::black, m_commonSettings->WidthMainLine(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); painter->setPen(penTileDrawing); @@ -424,11 +424,11 @@ void VPTileFactory::DrawTilePageContent(QPainter *painter, const VPSheetPtr &she // paint the content of the page const qreal xScale = layout->LayoutSettings().HorizontalScale(); const qreal yScale = layout->LayoutSettings().VerticalScale(); - QRectF source = QRectF(sheetMargins.left() + col * (m_drawingAreaWidth - tileStripeWidth) / xScale, - sheetMargins.top() + row * (m_drawingAreaHeight - tileStripeWidth) / yScale, - m_drawingAreaWidth / xScale, m_drawingAreaHeight / yScale); + QRectF const source = QRectF(sheetMargins.left() + col * (m_drawingAreaWidth - tileStripeWidth) / xScale, + sheetMargins.top() + row * (m_drawingAreaHeight - tileStripeWidth) / yScale, + m_drawingAreaWidth / xScale, m_drawingAreaHeight / yScale); - QRectF target = QRectF(0, 0, m_drawingAreaWidth, m_drawingAreaHeight); + QRectF const target = QRectF(0, 0, m_drawingAreaWidth, m_drawingAreaHeight); sheet->SceneData()->Scene()->render(painter, VPrintLayout::SceneTargetRect(printer, target), source, Qt::IgnoreAspectRatio); } @@ -436,34 +436,35 @@ void VPTileFactory::DrawTilePageContent(QPainter *painter, const VPSheetPtr &she //--------------------------------------------------------------------------------------------------------------------- void VPTileFactory::DrawTopTriangle(QPainter *painter) const { - QPainterPath triangleTop = QTransform().translate(m_drawingAreaWidth / 2, 0).map(TriangleBasic()); + QPainterPath const triangleTop = QTransform().translate(m_drawingAreaWidth / 2, 0).map(TriangleBasic()); painter->fillPath(triangleTop, *triangleBush); } //--------------------------------------------------------------------------------------------------------------------- void VPTileFactory::DrawLeftTriangle(QPainter *painter) const { - QPainterPath triangleLeft = QTransform().translate(0, m_drawingAreaHeight / 2).rotate(-90).map(TriangleBasic()); + QPainterPath const triangleLeft = + QTransform().translate(0, m_drawingAreaHeight / 2).rotate(-90).map(TriangleBasic()); painter->fillPath(triangleLeft, *triangleBush); } //--------------------------------------------------------------------------------------------------------------------- void VPTileFactory::DrawBottomTriangle(QPainter *painter) const { - QPainterPath triangleBottom = QTransform() - .translate(m_drawingAreaWidth / 2, m_drawingAreaHeight - tileStripeWidth) - .rotate(180) - .map(TriangleBasic()); + QPainterPath const triangleBottom = QTransform() + .translate(m_drawingAreaWidth / 2, m_drawingAreaHeight - tileStripeWidth) + .rotate(180) + .map(TriangleBasic()); painter->fillPath(triangleBottom, *triangleBush); } //--------------------------------------------------------------------------------------------------------------------- void VPTileFactory::DrawRightTriangle(QPainter *painter) const { - QPainterPath triangleRight = QTransform() - .translate(m_drawingAreaWidth - tileStripeWidth, m_drawingAreaHeight / 2) - .rotate(90) - .map(TriangleBasic()); + QPainterPath const triangleRight = QTransform() + .translate(m_drawingAreaWidth - tileStripeWidth, m_drawingAreaHeight / 2) + .rotate(90) + .map(TriangleBasic()); painter->fillPath(triangleRight, *triangleBush); } @@ -623,9 +624,9 @@ void VPTileFactory::DrawTextInformation(QPainter *painter, int row, int col, int td.setPageSize(QSizeF(m_drawingAreaHeight - UnitConvertor(2, Unit::Cm, Unit::Px), m_drawingAreaWidth)); - QFontMetrics metrix = QFontMetrics(td.defaultFont()); - int maxWidth = metrix.horizontalAdvance(QString().fill('z', 50)); - QString clippedSheetName = metrix.elidedText(sheetName, Qt::ElideMiddle, maxWidth); + QFontMetrics const metrix = QFontMetrics(td.defaultFont()); + int const maxWidth = metrix.horizontalAdvance(QString().fill('z', 50)); + QString const clippedSheetName = metrix.elidedText(sheetName, Qt::ElideMiddle, maxWidth); td.setHtml(QStringLiteral("" "" @@ -670,7 +671,7 @@ void VPTileFactory::PaintWatermarkText(QPainter *painter, const QRectF &img, con text = t.map(text); - QPointF center = img.center() - text.boundingRect().center(); + QPointF const center = img.center() - text.boundingRect().center(); t = QTransform(); t.translate(center.x(), center.y()); @@ -699,15 +700,15 @@ void VPTileFactory::PaintWatermarkImage(QPainter *painter, const QRectF &img, co } QPixmap watermark; - QString imagePath = + QString const imagePath = QStringLiteral("puzzle=colorScheme%1+path%2+opacity%3_broken") .arg(colorScheme, AbsoluteMPath(watermarkPath, watermarkData.path), QString::number(opacity)); if (not QPixmapCache::find(imagePath, &watermark)) { - QScopedPointer svgRenderer(new QSvgRenderer()); + QScopedPointer const svgRenderer(new QSvgRenderer()); - QRect imageRect(0, 0, qRound(img.width() / 4.), qRound(img.width() / 4.)); + QRect const imageRect(0, 0, qRound(img.width() / 4.), qRound(img.width() / 4.)); watermark = QPixmap(imageRect.size()); watermark.fill(Qt::transparent); @@ -725,15 +726,15 @@ void VPTileFactory::PaintWatermarkImage(QPainter *painter, const QRectF &img, co return watermark; }; - QString imagePath = AbsoluteMPath(watermarkPath, watermarkData.path); - QFileInfo f(imagePath); + QString const imagePath = AbsoluteMPath(watermarkPath, watermarkData.path); + QFileInfo const f(imagePath); QImageReader imageReader(imagePath); - QImage watermarkImage = imageReader.read(); + QImage const watermarkImage = imageReader.read(); if (watermarkImage.isNull()) { - QPixmap watermarkPixmap = BrokenImage(); + QPixmap const watermarkPixmap = BrokenImage(); if (watermarkPixmap.width() < img.width() && watermarkPixmap.height() < img.height()) { @@ -749,21 +750,21 @@ void VPTileFactory::PaintWatermarkImage(QPainter *painter, const QRectF &img, co return; } - qint64 fileSize = watermarkImage.sizeInBytes(); - qint64 pixelSize = fileSize / watermarkImage.height() / watermarkImage.width(); - QSize scaledSize(qRound(watermarkImage.width() / xScale), qRound(watermarkImage.height() / yScale)); - qint64 scaledImageSize = pixelSize * scaledSize.width() * scaledSize.height() / 1024; - int limit = QPixmapCache::cacheLimit(); + qint64 const fileSize = watermarkImage.sizeInBytes(); + qint64 const pixelSize = fileSize / watermarkImage.height() / watermarkImage.width(); + QSize const scaledSize(qRound(watermarkImage.width() / xScale), qRound(watermarkImage.height() / yScale)); + qint64 const scaledImageSize = pixelSize * scaledSize.width() * scaledSize.height() / 1024; + int const limit = QPixmapCache::cacheLimit(); if (scaledImageSize > limit && (xScale < 1 || yScale < 1)) { - QScopedPointer svgRenderer(new QSvgRenderer()); + QScopedPointer const svgRenderer(new QSvgRenderer()); painter->save(); painter->setOpacity(opacity); painter->restore(); - QString grayscale = watermarkData.grayscale ? QStringLiteral("_grayscale") : QString(); + QString const grayscale = watermarkData.grayscale ? QStringLiteral("_grayscale") : QString(); svgRenderer->load(QStringLiteral("://puzzleicon/svg/watermark_placeholder%1.svg").arg(grayscale)); QRect imageRect(0, 0, qRound(watermarkImage.width() / xScale), qRound(watermarkImage.height() / yScale)); imageRect.translate(img.center().toPoint() - imageRect.center()); @@ -799,8 +800,8 @@ void VPTileFactory::PaintWatermarkImage(QPainter *painter, const QRectF &img, co } else { - QRect croppedRect = imagePosition.intersected(img.toRect()); - QPixmap cropped = watermark.copy(croppedRect.translated(-imagePosition.x(), -imagePosition.y())); + QRect const croppedRect = imagePosition.intersected(img.toRect()); + QPixmap const cropped = watermark.copy(croppedRect.translated(-imagePosition.x(), -imagePosition.y())); painter->drawPixmap(croppedRect, cropped); } diff --git a/src/app/puzzle/xml/vplayoutfilereader.cpp b/src/app/puzzle/xml/vplayoutfilereader.cpp index 9e31a21d8..c1438d982 100644 --- a/src/app/puzzle/xml/vplayoutfilereader.cpp +++ b/src/app/puzzle/xml/vplayoutfilereader.cpp @@ -65,18 +65,18 @@ namespace //--------------------------------------------------------------------------------------------------------------------- auto StringToTransfrom(const QString &matrix) -> QTransform { - QStringList elements = matrix.split(ML::groupSep); + QStringList const elements = matrix.split(ML::groupSep); if (elements.count() == 9) { - qreal m11 = elements.at(0).toDouble(); - qreal m12 = elements.at(1).toDouble(); - qreal m13 = elements.at(2).toDouble(); - qreal m21 = elements.at(3).toDouble(); - qreal m22 = elements.at(4).toDouble(); - qreal m23 = elements.at(5).toDouble(); - qreal m31 = elements.at(6).toDouble(); - qreal m32 = elements.at(7).toDouble(); - qreal m33 = elements.at(8).toDouble(); + qreal const m11 = elements.at(0).toDouble(); + qreal const m12 = elements.at(1).toDouble(); + qreal const m13 = elements.at(2).toDouble(); + qreal const m21 = elements.at(3).toDouble(); + qreal const m22 = elements.at(4).toDouble(); + qreal const m23 = elements.at(5).toDouble(); + qreal const m31 = elements.at(6).toDouble(); + qreal const m32 = elements.at(7).toDouble(); + qreal const m33 = elements.at(8).toDouble(); return {m11, m12, m13, m21, m22, m23, m31, m32, m33}; } @@ -86,7 +86,7 @@ auto StringToTransfrom(const QString &matrix) -> QTransform //--------------------------------------------------------------------------------------------------------------------- auto StringToPoint(const QString &point) -> QPointF { - QStringList coordinates = point.split(ML::coordintatesSep); + QStringList const coordinates = point.split(ML::coordintatesSep); if (coordinates.count() == 2) { return {coordinates.at(0).toDouble(), coordinates.at(1).toDouble()}; @@ -104,7 +104,7 @@ auto StringToPath(const QString &path) -> QVector return p; } - QStringList points = path.split(ML::pointsSep); + QStringList const points = path.split(ML::pointsSep); p.reserve(points.size()); for (const auto &point : points) { @@ -179,7 +179,7 @@ auto StringToGrainlineArrowDirrection(const QString &dirrection) -> GrainlineArr //--------------------------------------------------------------------------------------------------------------------- auto StringToLine(const QString &string) -> QLineF { - QStringList points = string.split(ML::groupSep); + QStringList const points = string.split(ML::groupSep); if (points.count() == 2) { return {StringToPoint(points.at(0)), StringToPoint(points.at(1))}; @@ -191,13 +191,13 @@ auto StringToLine(const QString &string) -> QLineF //--------------------------------------------------------------------------------------------------------------------- auto StringToLines(const QString &string) -> QVector { - QStringList lines = string.split(ML::itemsSep); + QStringList const lines = string.split(ML::itemsSep); QVector path; path.reserve(lines.size()); for (const auto &line : lines) { - QLineF l = StringToLine(line); + QLineF const l = StringToLine(line); if (not l.isNull()) { path.append(StringToLine(line)); @@ -210,7 +210,7 @@ auto StringToLines(const QString &string) -> QVector //--------------------------------------------------------------------------------------------------------------------- auto StringToRect(const QString &string) -> QRectF { - QStringList points = string.split(ML::groupSep); + QStringList const points = string.split(ML::groupSep); if (points.count() == 4) { return {points.at(0).toDouble(), points.at(1).toDouble(), points.at(2).toDouble(), points.at(3).toDouble()}; @@ -334,7 +334,7 @@ void VPLayoutFileReader::ReadControl(const VPLayoutPtr &layout) { AssertRootTag(ML::TagControl); - QXmlStreamAttributes attribs = attributes(); + QXmlStreamAttributes const attribs = attributes(); layout->LayoutSettings().SetWarningSuperpositionOfPieces( ReadAttributeBool(attribs, ML::AttrWarningSuperposition, trueStr)); layout->LayoutSettings().SetWarningPiecesOutOfBound(ReadAttributeBool(attribs, ML::AttrWarningOutOfBound, trueStr)); @@ -361,7 +361,7 @@ void VPLayoutFileReader::ReadTiles(const VPLayoutPtr &layout) { AssertRootTag(ML::TagTiles); - QXmlStreamAttributes attribs = attributes(); + QXmlStreamAttributes const attribs = attributes(); layout->LayoutSettings().SetShowTiles(ReadAttributeBool(attribs, ML::AttrVisible, falseStr)); layout->LayoutSettings().SetPrintTilesScheme(ReadAttributeBool(attribs, ML::AttrPrintScheme, falseStr)); layout->LayoutSettings().SetShowTileNumber(ReadAttributeBool(attribs, ML::AttrTileNumber, falseStr)); @@ -397,7 +397,7 @@ void VPLayoutFileReader::ReadScale(const VPLayoutPtr &layout) { AssertRootTag(ML::TagScale); - QXmlStreamAttributes attribs = attributes(); + QXmlStreamAttributes const attribs = attributes(); layout->LayoutSettings().SetHorizontalScale(ReadAttributeDouble(attribs, ML::AttrXScale, QChar('1'))); layout->LayoutSettings().SetVerticalScale(ReadAttributeDouble(attribs, ML::AttrYScale, QChar('1'))); @@ -428,9 +428,9 @@ void VPLayoutFileReader::ReadSheet(const VPLayoutPtr &layout) { AssertRootTag(ML::TagSheet); - VPSheetPtr sheet(new VPSheet(layout)); + VPSheetPtr const sheet(new VPSheet(layout)); - QXmlStreamAttributes attribs = attributes(); + QXmlStreamAttributes const attribs = attributes(); sheet->SetGrainlineType(StrToGrainlineType(ReadAttributeEmptyString(attribs, ML::AttrGrainlineType))); const QStringList tags{ @@ -475,7 +475,7 @@ void VPLayoutFileReader::ReadPieces(const VPLayoutPtr &layout, const VPSheetPtr { if (name() == ML::TagPiece) { - VPPiecePtr piece(new VPPiece()); + VPPiecePtr const piece(new VPPiece()); ReadPiece(piece); QString error; @@ -500,10 +500,10 @@ void VPLayoutFileReader::ReadPiece(const VPPiecePtr &piece) { AssertRootTag(ML::TagPiece); - QXmlStreamAttributes attribs = attributes(); + QXmlStreamAttributes const attribs = attributes(); piece->SetName(ReadAttributeString(attribs, ML::AttrName, tr("Piece"))); - QString uuidStr = ReadAttributeString(attribs, ML::AttrUID, QUuid::createUuid().toString()); + QString const uuidStr = ReadAttributeString(attribs, ML::AttrUID, QUuid::createUuid().toString()); piece->SetUUID(QUuid(uuidStr)); piece->SetGradationId(ReadAttributeEmptyString(attribs, ML::AttrGradationLabel)); @@ -575,7 +575,7 @@ auto VPLayoutFileReader::ReadLayoutPoint() -> VLayoutPoint VLayoutPoint point; - QXmlStreamAttributes attribs = attributes(); + QXmlStreamAttributes const attribs = attributes(); point.setX(ReadAttributeDouble(attribs, ML::AttrX, QChar('0'))); point.setY(ReadAttributeDouble(attribs, ML::AttrY, QChar('0'))); point.SetTurnPoint(ReadAttributeBool(attribs, ML::AttrTurnPoint, falseStr)); @@ -619,14 +619,14 @@ void VPLayoutFileReader::ReadSeamAllowance(const VPPiecePtr &piece) { AssertRootTag(ML::TagSeamAllowance); - QXmlStreamAttributes attribs = attributes(); - bool enabled = ReadAttributeBool(attribs, ML::AttrEnabled, falseStr); + QXmlStreamAttributes const attribs = attributes(); + bool const enabled = ReadAttributeBool(attribs, ML::AttrEnabled, falseStr); piece->SetSeamAllowance(enabled); - bool builtIn = ReadAttributeBool(attribs, ML::AttrBuiltIn, falseStr); + bool const builtIn = ReadAttributeBool(attribs, ML::AttrBuiltIn, falseStr); piece->SetSeamAllowanceBuiltIn(builtIn); - QVector path = ReadLayoutPoints(); + QVector const path = ReadLayoutPoints(); if (enabled && not builtIn) { @@ -645,14 +645,14 @@ void VPLayoutFileReader::ReadGrainline(const VPPiecePtr &piece) VPieceGrainline grainline; - QXmlStreamAttributes attribs = attributes(); - bool enabled = ReadAttributeBool(attribs, ML::AttrEnabled, falseStr); + QXmlStreamAttributes const attribs = attributes(); + bool const enabled = ReadAttributeBool(attribs, ML::AttrEnabled, falseStr); grainline.SetEnabled(enabled); - QLineF mainLine = StringToLine(readElementText()); + QLineF const mainLine = StringToLine(readElementText()); if (enabled) { - QString arrowDirection = ReadAttributeEmptyString(attribs, ML::AttrArrowDirection); + QString const arrowDirection = ReadAttributeEmptyString(attribs, ML::AttrArrowDirection); grainline.SetArrowType(StringToGrainlineArrowDirrection(arrowDirection)); if (mainLine.isNull()) @@ -693,7 +693,7 @@ auto VPLayoutFileReader::ReadNotch() -> VLayoutPassmark { AssertRootTag(ML::TagNotch); - QXmlStreamAttributes attribs = attributes(); + QXmlStreamAttributes const attribs = attributes(); QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wnoexcept") @@ -704,7 +704,7 @@ auto VPLayoutFileReader::ReadNotch() -> VLayoutPassmark passmark.lines = StringToLines(ReadAttributeEmptyString(attribs, ML::AttrPath)); passmark.isClockwiseOpening = ReadAttributeBool(attribs, ML::AttrClockwiseOpening, falseStr); - QString defaultType = QString::number(static_cast(PassmarkLineType::OneLine)); + QString const defaultType = QString::number(static_cast(PassmarkLineType::OneLine)); passmark.type = static_cast(ReadAttributeUInt(attribs, ML::AttrType, defaultType)); QT_WARNING_POP @@ -839,7 +839,7 @@ void VPLayoutFileReader::ReadPieceLabel(const VPPiecePtr &piece) { AssertRootTag(ML::TagPieceLabel); - QXmlStreamAttributes attribs = attributes(); + QXmlStreamAttributes const attribs = attributes(); piece->SetPieceLabelRect(StringToPath(ReadAttributeEmptyString(attribs, ML::AttrShape))); while (readNextStartElement()) @@ -861,7 +861,7 @@ void VPLayoutFileReader::ReadPatternLabel(const VPPiecePtr &piece) { AssertRootTag(ML::TagPatternLabel); - QXmlStreamAttributes attribs = attributes(); + QXmlStreamAttributes const attribs = attributes(); piece->SetPatternLabelRect(StringToPath(ReadAttributeEmptyString(attribs, ML::AttrShape))); while (readNextStartElement()) @@ -886,10 +886,10 @@ auto VPLayoutFileReader::ReadLabelLines() -> VTextManager VTextManager text; QVector lines; - QXmlStreamAttributes attribs = attributes(); + QXmlStreamAttributes const attribs = attributes(); text.SetFont(FontFromString(ReadAttributeEmptyString(attribs, ML::AttrFont))); - QStringList svgFontData = ReadAttributeEmptyString(attribs, ML::AttrSVGFont).split(','); + QStringList const svgFontData = ReadAttributeEmptyString(attribs, ML::AttrSVGFont).split(','); if (!svgFontData.isEmpty()) { text.SetSVGFontFamily(svgFontData.constFirst()); @@ -925,13 +925,14 @@ auto VPLayoutFileReader::ReadLabelLine() -> TextLine TextLine line; - QXmlStreamAttributes attribs = attributes(); + QXmlStreamAttributes const attribs = attributes(); line.m_iFontSize = ReadAttributeInt(attribs, ML::AttrFontSize, QString::number(VCommonSettings::MinPieceLabelFontPointSize())); line.m_bold = ReadAttributeBool(attribs, ML::AttrBold, falseStr); line.m_italic = ReadAttributeBool(attribs, ML::AttrItalic, falseStr); - int alignment = ReadAttributeInt(attribs, ML::AttrAlignment, QString::number(static_cast(Qt::AlignCenter))); + int const alignment = + ReadAttributeInt(attribs, ML::AttrAlignment, QString::number(static_cast(Qt::AlignCenter))); line.m_eAlign = static_cast(alignment); line.m_qsText = readElementText(); @@ -943,7 +944,7 @@ void VPLayoutFileReader::ReadWatermark(const VPLayoutPtr &layout) { AssertRootTag(ML::TagWatermark); - QXmlStreamAttributes attribs = attributes(); + QXmlStreamAttributes const attribs = attributes(); layout->LayoutSettings().SetShowWatermark(ReadAttributeBool(attribs, ML::AttrShowPreview, falseStr)); layout->LayoutSettings().SetWatermarkPath(readElementText()); } @@ -999,7 +1000,7 @@ void VPLayoutFileReader::ReadMirrorLines(const VPPiecePtr &piece) //--------------------------------------------------------------------------------------------------------------------- void VPLayoutFileReader::ReadLayoutMargins(const VPLayoutPtr &layout) { - QXmlStreamAttributes attribs = attributes(); + QXmlStreamAttributes const attribs = attributes(); QMarginsF margins = QMarginsF(); margins.setLeft(ReadAttributeDouble(attribs, ML::AttrLeft, QChar('0'))); @@ -1016,7 +1017,7 @@ void VPLayoutFileReader::ReadLayoutMargins(const VPLayoutPtr &layout) //--------------------------------------------------------------------------------------------------------------------- void VPLayoutFileReader::ReadSheetMargins(const VPSheetPtr &sheet) { - QXmlStreamAttributes attribs = attributes(); + QXmlStreamAttributes const attribs = attributes(); QMarginsF margins = QMarginsF(); margins.setLeft(ReadAttributeDouble(attribs, ML::AttrLeft, QChar('0'))); @@ -1035,7 +1036,7 @@ auto VPLayoutFileReader::ReadSize() -> QSizeF { QSizeF size; - QXmlStreamAttributes attribs = attributes(); + QXmlStreamAttributes const attribs = attributes(); size.setWidth(ReadAttributeDouble(attribs, ML::AttrWidth, QChar('0'))); size.setHeight(ReadAttributeDouble(attribs, ML::AttrLength, QChar('0'))); diff --git a/src/app/puzzle/xml/vplayoutfilewriter.cpp b/src/app/puzzle/xml/vplayoutfilewriter.cpp index fcf2d11a6..bb7f01da6 100644 --- a/src/app/puzzle/xml/vplayoutfilewriter.cpp +++ b/src/app/puzzle/xml/vplayoutfilewriter.cpp @@ -51,9 +51,9 @@ template auto NumberToString(T number) -> QString //--------------------------------------------------------------------------------------------------------------------- auto TransformToString(const QTransform &m) -> QString { - QStringList matrix{NumberToString(m.m11()), NumberToString(m.m12()), NumberToString(m.m13()), - NumberToString(m.m21()), NumberToString(m.m22()), NumberToString(m.m23()), - NumberToString(m.m31()), NumberToString(m.m32()), NumberToString(m.m33())}; + QStringList const matrix{NumberToString(m.m11()), NumberToString(m.m12()), NumberToString(m.m13()), + NumberToString(m.m21()), NumberToString(m.m22()), NumberToString(m.m23()), + NumberToString(m.m31()), NumberToString(m.m32()), NumberToString(m.m33())}; return matrix.join(ML::groupSep); } @@ -201,7 +201,7 @@ void VPLayoutFileWriter::WriteSheets(const VPLayoutPtr &layout) { writeStartElement(ML::TagSheets); - QList sheets = layout->GetSheets(); + QList const sheets = layout->GetSheets(); for (const auto &sheet : sheets) { if (not sheet.isNull()) @@ -292,7 +292,7 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece) [](bool show) noexcept { return show; }); writeStartElement(ML::TagSeamLine); - QVector contourPoints = piece->GetContourPoints(); + QVector const contourPoints = piece->GetContourPoints(); for (auto &point : contourPoints) { WriteLayoutPoint(point); @@ -306,7 +306,7 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece) [](bool builtin) noexcept { return not builtin; }); if (piece->IsSeamAllowance() && not piece->IsSeamAllowanceBuiltIn()) { - QVector seamAllowancePoints = piece->GetSeamAllowancePoints(); + QVector const seamAllowancePoints = piece->GetSeamAllowancePoints(); for (auto &point : seamAllowancePoints) { WriteLayoutPoint(point); @@ -325,7 +325,7 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece) writeEndElement(); writeStartElement(ML::TagNotches); - QVector passmarks = piece->GetPassmarks(); + QVector const passmarks = piece->GetPassmarks(); for (const auto &passmark : passmarks) { writeStartElement(ML::TagNotch); @@ -340,7 +340,7 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece) writeEndElement(); writeStartElement(ML::TagInternalPaths); - QVector internalPaths = piece->GetInternalPaths(); + QVector const internalPaths = piece->GetInternalPaths(); for (const auto &path : internalPaths) { writeStartElement(ML::TagInternalPath); @@ -349,7 +349,7 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece) SetAttributeOrRemoveIf(ML::AttrNotMirrored, path.IsNotMirrored(), [](bool mirrored) noexcept { return mirrored; }); - QVector points = path.Points(); + QVector const points = path.Points(); for (auto &point : points) { WriteLayoutPoint(point); @@ -360,7 +360,7 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece) writeEndElement(); writeStartElement(ML::TagMarkers); - QVector placelabels = piece->GetPlaceLabels(); + QVector const placelabels = piece->GetPlaceLabels(); for (const auto &label : placelabels) { writeStartElement(ML::TagMarker); diff --git a/src/app/tape/dialogs/configpages/tapepreferencespathpage.cpp b/src/app/tape/dialogs/configpages/tapepreferencespathpage.cpp index 73ddd768f..5438f1b1f 100644 --- a/src/app/tape/dialogs/configpages/tapepreferencespathpage.cpp +++ b/src/app/tape/dialogs/configpages/tapepreferencespathpage.cpp @@ -117,7 +117,7 @@ void TapePreferencesPathPage::EditPath() } bool usedNotExistedDir = false; - QDir directory(path); + QDir const directory(path); if (not directory.exists()) { usedNotExistedDir = directory.mkpath(QChar('.')); diff --git a/src/app/tape/dialogs/dialogdimensioncustomnames.cpp b/src/app/tape/dialogs/dialogdimensioncustomnames.cpp index 2d22c65c2..2c626d6de 100644 --- a/src/app/tape/dialogs/dialogdimensioncustomnames.cpp +++ b/src/app/tape/dialogs/dialogdimensioncustomnames.cpp @@ -72,8 +72,8 @@ void DialogDimensionCustomNames::InitTable(const QMapType()), - i.value()->Axis()); + QString const name = QStringLiteral("%1 (%2)").arg( + VAbstartMeasurementDimension::DimensionName(i.value()->Type()), i.value()->Axis()); auto *itemValue = new QTableWidgetItem(name); itemValue->setTextAlignment(Qt::AlignHCenter | Qt::AlignCenter); diff --git a/src/app/tape/dialogs/dialogdimensionlabels.cpp b/src/app/tape/dialogs/dialogdimensionlabels.cpp index 6f4f343be..e59611877 100644 --- a/src/app/tape/dialogs/dialogdimensionlabels.cpp +++ b/src/app/tape/dialogs/dialogdimensionlabels.cpp @@ -58,12 +58,12 @@ void DialogDimensionLabels::changeEvent(QEvent *event) // retranslate designer form (single inheritance approach) ui->retranslateUi(this); - MeasurementDimension type = + MeasurementDimension const type = static_cast(ui->comboBoxDimensionLabels->currentData().toInt()); InitDimensions(); - int index = ui->comboBoxDimensionLabels->findData(static_cast(type)); + int const index = ui->comboBoxDimensionLabels->findData(static_cast(type)); if (index != -1) { ui->comboBoxDimensionLabels->blockSignals(true); @@ -94,9 +94,9 @@ void DialogDimensionLabels::LabelChanged(QTableWidgetItem *item) { if (item != nullptr) { - MeasurementDimension type = + MeasurementDimension const type = static_cast(ui->comboBoxDimensionLabels->currentData().toInt()); - qreal value = item->data(Qt::UserRole).toDouble(); + qreal const value = item->data(Qt::UserRole).toDouble(); DimesionLabels labels = m_labels.value(type); labels.insert(value, item->text()); diff --git a/src/app/tape/dialogs/dialogmdatabase.cpp b/src/app/tape/dialogs/dialogmdatabase.cpp index 21784850c..ddfd80b79 100644 --- a/src/app/tape/dialogs/dialogmdatabase.cpp +++ b/src/app/tape/dialogs/dialogmdatabase.cpp @@ -181,7 +181,7 @@ void DialogMDataBase::UpdateChecks(QTreeWidgetItem *item, int column) if (item->childCount() != 0 && item->checkState(0) != Qt::PartiallyChecked && column != -1) { bool flag = false; // Check if we could change atleast one children - Qt::CheckState checkState = item->checkState(0); + Qt::CheckState const checkState = item->checkState(0); for (int i = 0; i < item->childCount(); ++i) { if (not m_usedMeasurements.contains(item->child(i)->data(0, Qt::UserRole).toString())) @@ -303,19 +303,19 @@ void DialogMDataBase::InitDataBase(const QStringList &usedMeasurements) } VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase(); - VKnownMeasurements knownDB = db->KnownMeasurements(m_knownId); + VKnownMeasurements const knownDB = db->KnownMeasurements(m_knownId); - QMap measurements = knownDB.OrderedGroupMeasurements(QString()); + QMap const measurements = knownDB.OrderedGroupMeasurements(QString()); if (!measurements.isEmpty()) { m_generalGroup = InitGroup(tr("General", "Measurement section"), measurements, usedMeasurements); m_groups.append(m_generalGroup); } - QStringList groups = knownDB.Groups(); + QStringList const groups = knownDB.Groups(); for (auto &group : groups) { - QMap groupMeasurements = knownDB.OrderedGroupMeasurements(group); + QMap const groupMeasurements = knownDB.OrderedGroupMeasurements(group); m_groups.append(InitGroup(group, groupMeasurements, usedMeasurements)); } } @@ -431,8 +431,8 @@ auto DialogMDataBase::ItemFullDescription(QTreeWidgetItem *item, bool showImage) } VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase(); - VKnownMeasurements knownDB = db->KnownMeasurements(m_knownId); - VKnownMeasurement known = knownDB.Measurement(name); + VKnownMeasurements const knownDB = db->KnownMeasurements(m_knownId); + VKnownMeasurement const known = knownDB.Measurement(name); QString imgTag; if (showImage) diff --git a/src/app/tape/dialogs/dialogmeasurementscsvcolumns.cpp b/src/app/tape/dialogs/dialogmeasurementscsvcolumns.cpp index 3de9439cf..e573946cc 100644 --- a/src/app/tape/dialogs/dialogmeasurementscsvcolumns.cpp +++ b/src/app/tape/dialogs/dialogmeasurementscsvcolumns.cpp @@ -264,7 +264,7 @@ auto DialogMeasurementsCSVColumns::ColumnHeader(int column) const -> QString case MultisizeMeasurementsColumns::ShiftA: if (not m_dimensions.empty()) { - MeasurementDimension_p dimension = m_dimensions.at(0); + MeasurementDimension_p const dimension = m_dimensions.at(0); return QCoreApplication::translate("DialogMeasurementsCSVColumns", "Shift", "measurement column") + suffix.arg(dimension->Name()); } @@ -275,7 +275,7 @@ auto DialogMeasurementsCSVColumns::ColumnHeader(int column) const -> QString case MultisizeMeasurementsColumns::ShiftB: if (m_dimensions.size() > 1) { - MeasurementDimension_p dimension = m_dimensions.at(1); + MeasurementDimension_p const dimension = m_dimensions.at(1); return QCoreApplication::translate("DialogMeasurementsCSVColumns", "Shift", "measurement column") + suffix.arg(dimension->Name()); } @@ -286,7 +286,7 @@ auto DialogMeasurementsCSVColumns::ColumnHeader(int column) const -> QString case MultisizeMeasurementsColumns::ShiftC: if (m_dimensions.size() > 2) { - MeasurementDimension_p dimension = m_dimensions.at(2); + MeasurementDimension_p const dimension = m_dimensions.at(2); return QCoreApplication::translate("DialogMeasurementsCSVColumns", "Shift", "measurement column") + suffix.arg(dimension->Name()); } @@ -433,7 +433,7 @@ void DialogMeasurementsCSVColumns::ClearColumnCollor() //--------------------------------------------------------------------------------------------------------------------- void DialogMeasurementsCSVColumns::InitColumnsMap() { - QSharedPointer csv = DialogMeasurementsCSVColumns::CSVModel(); + QSharedPointer const csv = DialogMeasurementsCSVColumns::CSVModel(); m_columnsMap.clear(); auto InitColumn = [this, csv](int column, int &index, bool forceSkip = false) @@ -618,7 +618,7 @@ void DialogMeasurementsCSVColumns::ShowInputPreview() return; } - QSharedPointer csv = DialogMeasurementsCSVColumns::CSVModel(); + QSharedPointer const csv = DialogMeasurementsCSVColumns::CSVModel(); const int columns = csv->columnCount(); const int rows = csv->rowCount(); @@ -667,7 +667,7 @@ void DialogMeasurementsCSVColumns::ShowImportPreview() return; } - QSharedPointer csv = DialogMeasurementsCSVColumns::CSVModel(); + QSharedPointer const csv = DialogMeasurementsCSVColumns::CSVModel(); const int importColumns = ImportColumnCount(); const int columns = csv->columnCount(); @@ -750,7 +750,7 @@ void DialogMeasurementsCSVColumns::RetranslateLabels() if (not m_dimensions.empty()) { - MeasurementDimension_p dimension = m_dimensions.at(0); + MeasurementDimension_p const dimension = m_dimensions.at(0); ui->labelShiftA->setText( QCoreApplication::translate("DialogMeasurementsCSVColumns", "Shift", "measurement column") + suffix.arg(dimension->Name())); @@ -758,7 +758,7 @@ void DialogMeasurementsCSVColumns::RetranslateLabels() if (m_dimensions.size() > 1) { - MeasurementDimension_p dimension = m_dimensions.at(1); + MeasurementDimension_p const dimension = m_dimensions.at(1); ui->labelShiftB->setText( QCoreApplication::translate("DialogMeasurementsCSVColumns", "Shift", "measurement column") + suffix.arg(dimension->Name())); @@ -766,7 +766,7 @@ void DialogMeasurementsCSVColumns::RetranslateLabels() if (m_dimensions.size() > 2) { - MeasurementDimension_p dimension = m_dimensions.at(2); + MeasurementDimension_p const dimension = m_dimensions.at(2); ui->labelShiftC->setText( QCoreApplication::translate("DialogMeasurementsCSVColumns", "Shift", "measurement column") + suffix.arg(dimension->Name())); @@ -781,7 +781,7 @@ void DialogMeasurementsCSVColumns::SetDefaultColumns() { SCASSERT(control != nullptr) - int index = control->findData(m_columnsMap.at(column)); + int const index = control->findData(m_columnsMap.at(column)); if (index != -1) { control->setCurrentIndex(index); @@ -838,7 +838,7 @@ void DialogMeasurementsCSVColumns::CheckStatus() return; } - QSharedPointer csv = DialogMeasurementsCSVColumns::CSVModel(); + QSharedPointer const csv = DialogMeasurementsCSVColumns::CSVModel(); const int columns = csv->columnCount(); if (columns < MinimumColumns()) @@ -881,7 +881,7 @@ template void DialogMeasurementsCSVColumns::HackWidget(T **widget) template auto DialogMeasurementsCSVColumns::ColumnValid(T column) const -> bool { const int columnNumber = static_cast(column); - int value = m_columnsMap.at(columnNumber); + int const value = m_columnsMap.at(columnNumber); if (value == -1 && not ColumnMandatory(columnNumber)) { diff --git a/src/app/tape/dialogs/dialognewmeasurements.cpp b/src/app/tape/dialogs/dialognewmeasurements.cpp index 5835629ce..c1002a09a 100644 --- a/src/app/tape/dialogs/dialognewmeasurements.cpp +++ b/src/app/tape/dialogs/dialognewmeasurements.cpp @@ -112,7 +112,7 @@ void DialogNewMeasurements::InitMTypes() ui->comboBoxMType->addItem(tr("Multisize"), static_cast(MeasurementsType::Multisize)); ui->comboBoxMType->blockSignals(false); - int index = ui->comboBoxMType->findData(val); + int const index = ui->comboBoxMType->findData(val); if (index != -1) { ui->comboBoxMType->setCurrentIndex(index); diff --git a/src/app/tape/dialogs/dialogrestrictdimension.cpp b/src/app/tape/dialogs/dialogrestrictdimension.cpp index 3b182675d..7991b55ce 100644 --- a/src/app/tape/dialogs/dialogrestrictdimension.cpp +++ b/src/app/tape/dialogs/dialogrestrictdimension.cpp @@ -188,7 +188,7 @@ void DialogRestrictDimension::changeEvent(QEvent *event) if (m_dimensions.size() > index) { - MeasurementDimension_p dimension = m_dimensions.at(index); + MeasurementDimension_p const dimension = m_dimensions.at(index); name->setText(dimension->Name() + ':'_L1); name->setToolTip(VAbstartMeasurementDimension::DimensionToolTip(dimension, m_fullCircumference)); @@ -240,7 +240,7 @@ void DialogRestrictDimension::RowSelected() } } - VDimensionRestriction restriction = m_restrictions.value(VMeasurement::CorrectionHash(base1, base2)); + VDimensionRestriction const restriction = m_restrictions.value(VMeasurement::CorrectionHash(base1, base2)); if (dimension.isNull()) { @@ -251,7 +251,8 @@ void DialogRestrictDimension::RowSelected() ui->comboBoxMin->blockSignals(true); ui->comboBoxMin->clear(); - QVector filtered = FilterByMinimum(FilterByMaximum(bases, restriction.GetMax()), restriction.GetMin()); + QVector const filtered = + FilterByMinimum(FilterByMaximum(bases, restriction.GetMax()), restriction.GetMin()); FillBases(filtered, dimension, ui->comboBoxMin); int index = ui->comboBoxMin->findData(restriction.GetMin()); ui->comboBoxMin->setCurrentIndex(index != -1 ? index : 0); @@ -380,7 +381,7 @@ void DialogRestrictDimension::CellContextMenu(QPoint pos) dimension = m_dimensions.at(1); columnValue = dimension->ValidBases().at(item->column()); - qreal base1 = m_dimensions.at(0)->ValidBases().at(item->row()); + qreal const base1 = m_dimensions.at(0)->ValidBases().at(item->row()); coordinates = VMeasurement::CorrectionHash(base1); } else if (m_restrictionType == RestrictDimension::Third) @@ -392,14 +393,14 @@ void DialogRestrictDimension::CellContextMenu(QPoint pos) dimension = m_dimensions.at(2); columnValue = dimension->ValidBases().at(item->column()); - qreal base1 = ui->comboBoxDimensionA->currentData().toDouble(); - qreal base2 = m_dimensions.at(1)->ValidBases().at(item->row()); + qreal const base1 = ui->comboBoxDimensionA->currentData().toDouble(); + qreal const base2 = m_dimensions.at(1)->ValidBases().at(item->row()); coordinates = VMeasurement::CorrectionHash(base1, base2); } VDimensionRestriction restriction = m_restrictions.value(coordinates); - bool exclude = not VFuzzyContains(restriction.GetExcludeValues(), columnValue); - QScopedPointer menu(new QMenu()); + bool const exclude = not VFuzzyContains(restriction.GetExcludeValues(), columnValue); + QScopedPointer const menu(new QMenu()); QAction *actionExclude = menu->addAction(exclude ? tr("Exclude") : tr("Include")); if (m_restrictionType == RestrictDimension::Second || m_restrictionType == RestrictDimension::Third) @@ -453,7 +454,7 @@ void DialogRestrictDimension::InitDimensionsBaseValues() if (m_dimensions.size() > index) { - MeasurementDimension_p dimension = m_dimensions.at(index); + MeasurementDimension_p const dimension = m_dimensions.at(index); name->setText(dimension->Name() + ':'_L1); name->setToolTip(VAbstartMeasurementDimension::DimensionToolTip(dimension, m_fullCircumference)); @@ -502,7 +503,7 @@ void DialogRestrictDimension::InitDimensionGradation(const MeasurementDimension_ FillBases(DimensionRestrictedValues(dimension), dimension, control); - int i = control->findData(current); + int const i = control->findData(current); if (i != -1) { control->setCurrentIndex(i); @@ -525,7 +526,7 @@ void DialogRestrictDimension::InitTable() { if (m_dimensions.size() > index) { - MeasurementDimension_p dimension = m_dimensions.at(index); + MeasurementDimension_p const dimension = m_dimensions.at(index); const QVector bases = dimension->ValidBases(); ui->tableWidget->setRowCount(static_cast(bases.size())); ui->tableWidget->setVerticalHeaderLabels(DimensionLabels(bases, dimension)); @@ -536,7 +537,7 @@ void DialogRestrictDimension::InitTable() { if (m_dimensions.size() > index) { - MeasurementDimension_p dimension = m_dimensions.at(index); + MeasurementDimension_p const dimension = m_dimensions.at(index); const QVector bases = dimension->ValidBases(); ui->tableWidget->setColumnCount(static_cast(bases.size())); ui->tableWidget->setHorizontalHeaderLabels(DimensionLabels(bases, dimension)); @@ -575,7 +576,7 @@ void DialogRestrictDimension::RefreshTable() { if (not m_dimensions.empty()) { - MeasurementDimension_p dimensionA = m_dimensions.at(0); + MeasurementDimension_p const dimensionA = m_dimensions.at(0); basesColumn = dimensionA->ValidBases(); } else @@ -587,10 +588,10 @@ void DialogRestrictDimension::RefreshTable() { if (m_dimensions.size() >= 2) { - MeasurementDimension_p dimensionA = m_dimensions.at(0); + MeasurementDimension_p const dimensionA = m_dimensions.at(0); basesRow = dimensionA->ValidBases(); - MeasurementDimension_p dimensionB = m_dimensions.at(1); + MeasurementDimension_p const dimensionB = m_dimensions.at(1); basesColumn = dimensionB->ValidBases(); } else @@ -602,10 +603,10 @@ void DialogRestrictDimension::RefreshTable() { if (m_dimensions.size() >= 3) { - MeasurementDimension_p dimensionB = m_dimensions.at(1); + MeasurementDimension_p const dimensionB = m_dimensions.at(1); basesRow = dimensionB->ValidBases(); - MeasurementDimension_p dimensionC = m_dimensions.at(2); + MeasurementDimension_p const dimensionC = m_dimensions.at(2); basesColumn = dimensionC->ValidBases(); } else @@ -653,7 +654,7 @@ void DialogRestrictDimension::AddCell(int row, int column, qreal rowValue, qreal if (m_restrictionType == RestrictDimension::First) { - VDimensionRestriction restriction = m_restrictions.value(QChar('0')); + VDimensionRestriction const restriction = m_restrictions.value(QChar('0')); item->setIcon(QIcon(VFuzzyContains(restriction.GetExcludeValues(), columnValue) ? QStringLiteral("://icon/24x24/close.png") : QStringLiteral("://icon/24x24/star.png"))); @@ -690,7 +691,7 @@ void DialogRestrictDimension::AddCell(int row, int column, qreal rowValue, qreal } } - VDimensionRestriction restriction = m_restrictions.value(VMeasurement::CorrectionHash(base1, base2)); + VDimensionRestriction const restriction = m_restrictions.value(VMeasurement::CorrectionHash(base1, base2)); qreal min = INT32_MIN; qreal max = INT32_MAX; @@ -745,7 +746,7 @@ void DialogRestrictDimension::FillBase(double base, const MeasurementDimension_p if (dimension->Type() == MeasurementDimension::X) { - QString item = useLabel ? label : QStringLiteral("%1 %2").arg(base).arg(units); + QString const item = useLabel ? label : QStringLiteral("%1 %2").arg(base).arg(units); control->addItem(item, base); } else if (dimension->Type() == MeasurementDimension::Y) @@ -756,15 +757,16 @@ void DialogRestrictDimension::FillBase(double base, const MeasurementDimension_p } else { - QString item = dimension->IsBodyMeasurement() - ? QStringLiteral("%1 %2").arg(m_fullCircumference ? base * 2 : base).arg(units) - : QString::number(base); + QString const item = dimension->IsBodyMeasurement() + ? QStringLiteral("%1 %2").arg(m_fullCircumference ? base * 2 : base).arg(units) + : QString::number(base); control->addItem(item, base); } } else if (dimension->Type() == MeasurementDimension::W || dimension->Type() == MeasurementDimension::Z) { - QString item = useLabel ? label : QStringLiteral("%1 %2").arg(m_fullCircumference ? base * 2 : base).arg(units); + QString const item = + useLabel ? label : QStringLiteral("%1 %2").arg(m_fullCircumference ? base * 2 : base).arg(units); control->addItem(item, base); } } @@ -888,7 +890,7 @@ auto DialogRestrictDimension::DimensionRestrictedValues(const MeasurementDimensi } else if (m_restrictionType == RestrictDimension::Third) { - qreal base1 = ui->comboBoxDimensionA->currentData().toDouble(); + qreal const base1 = ui->comboBoxDimensionA->currentData().toDouble(); restriction = m_restrictions.value(VMeasurement::CorrectionHash(base1)); } @@ -918,10 +920,10 @@ auto DialogRestrictDimension::StartRow() const -> int if (m_dimensions.size() >= 3) { - MeasurementDimension_p dimensionB = m_dimensions.at(1); + MeasurementDimension_p const dimensionB = m_dimensions.at(1); basesRow = dimensionB->ValidBases(); - QVector validRows = DimensionRestrictedValues(dimensionB); + QVector const validRows = DimensionRestrictedValues(dimensionB); for (int i = 0; i < basesRow.size(); ++i) { diff --git a/src/app/tape/dialogs/dialogsetupmultisize.cpp b/src/app/tape/dialogs/dialogsetupmultisize.cpp index 2ebf0e71a..2115c1471 100644 --- a/src/app/tape/dialogs/dialogsetupmultisize.cpp +++ b/src/app/tape/dialogs/dialogsetupmultisize.cpp @@ -300,7 +300,7 @@ void DialogSetupMultisize::ShowFullCircumference() //--------------------------------------------------------------------------------------------------------------------- void DialogSetupMultisize::XDimensionBodyMeasurementChanged() { - bool checked = ui->checkBoxXDimensionBodyMeasurement->isChecked(); + bool const checked = ui->checkBoxXDimensionBodyMeasurement->isChecked(); m_xDimension->SetBodyMeasurement(checked); InitDimension(ui->doubleSpinBoxXDimensionMinValue, ui->doubleSpinBoxXDimensionMaxValue, ui->comboBoxXDimensionStep, @@ -322,7 +322,7 @@ void DialogSetupMultisize::XDimensionBodyMeasurementChanged() //--------------------------------------------------------------------------------------------------------------------- void DialogSetupMultisize::YDimensionBodyMeasurementChanged() { - bool checked = ui->checkBoxYDimensionBodyMeasurement->isChecked(); + bool const checked = ui->checkBoxYDimensionBodyMeasurement->isChecked(); m_yDimension->SetBodyMeasurement(checked); InitDimension(ui->doubleSpinBoxYDimensionMinValue, ui->doubleSpinBoxYDimensionMaxValue, ui->comboBoxYDimensionStep, @@ -344,7 +344,7 @@ void DialogSetupMultisize::YDimensionBodyMeasurementChanged() //--------------------------------------------------------------------------------------------------------------------- void DialogSetupMultisize::WDimensionBodyMeasurementChanged() { - bool checked = ui->checkBoxWDimensionBodyMeasurement->isChecked(); + bool const checked = ui->checkBoxWDimensionBodyMeasurement->isChecked(); m_wDimension->SetBodyMeasurement(checked); InitDimension(ui->doubleSpinBoxWDimensionMinValue, ui->doubleSpinBoxWDimensionMaxValue, ui->comboBoxWDimensionStep, @@ -366,7 +366,7 @@ void DialogSetupMultisize::WDimensionBodyMeasurementChanged() //--------------------------------------------------------------------------------------------------------------------- void DialogSetupMultisize::ZDimensionBodyMeasurementChanged() { - bool checked = ui->checkBoxZDimensionBodyMeasurement->isChecked(); + bool const checked = ui->checkBoxZDimensionBodyMeasurement->isChecked(); m_zDimension->SetBodyMeasurement(checked); InitDimension(ui->doubleSpinBoxZDimensionMinValue, ui->doubleSpinBoxZDimensionMaxValue, ui->comboBoxZDimensionStep, diff --git a/src/app/tape/dialogs/dialogtapepreferences.cpp b/src/app/tape/dialogs/dialogtapepreferences.cpp index ce0077f4d..441ec0b3c 100644 --- a/src/app/tape/dialogs/dialogtapepreferences.cpp +++ b/src/app/tape/dialogs/dialogtapepreferences.cpp @@ -94,7 +94,7 @@ void DialogTapePreferences::showEvent(QShowEvent *event) } // do your init stuff here - QSize sz = VAbstractApplication::VApp()->Settings()->GetPreferenceDialogSize(); + QSize const sz = VAbstractApplication::VApp()->Settings()->GetPreferenceDialogSize(); if (not sz.isEmpty()) { resize(sz); @@ -169,6 +169,6 @@ void DialogTapePreferences::PageChanged(QListWidgetItem *current, QListWidgetIte { current = previous; } - int rowIndex = ui->contentsWidget->row(current); + int const rowIndex = ui->contentsWidget->row(current); ui->pagesWidget->setCurrentIndex(rowIndex); } diff --git a/src/app/tape/mapplication.cpp b/src/app/tape/mapplication.cpp index 10df0bf65..2c2787b11 100644 --- a/src/app/tape/mapplication.cpp +++ b/src/app/tape/mapplication.cpp @@ -313,7 +313,7 @@ MApplication::~MApplication() { auto *statistic = VGAnalytics::Instance(); - QString clientID = settings->GetClientID(); + QString const clientID = settings->GetClientID(); if (!clientID.isEmpty()) { statistic->SendAppCloseEvent(m_uptimeTimer.elapsed()); @@ -468,7 +468,7 @@ void MApplication::InitOptions() QTimer::singleShot(0, this, []() { - QString country = VGAnalytics::CountryCode(); + QString const country = VGAnalytics::CountryCode(); if (country == "ru"_L1 || country == "by"_L1) { qFatal("country not detected"); @@ -639,7 +639,7 @@ void MApplication::ParseCommandLine(const SocketConnection &connection, const QS } const QStringList args = parser.positionalArguments(); - bool success = args.count() > 0 ? StartWithFiles(parser) : SingleStart(parser); + bool const success = args.count() > 0 ? StartWithFiles(parser) : SingleStart(parser); if (not success) { @@ -686,7 +686,7 @@ void MApplication::Preferences(QWidget *parent) QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); auto *preferences = new DialogTapePreferences(parent); // QScopedPointer needs to be sure any exception will never block guard - QScopedPointer dlg(preferences); + QScopedPointer const dlg(preferences); guard = preferences; // Must be first diff --git a/src/app/tape/tkmmainwindow.cpp b/src/app/tape/tkmmainwindow.cpp index 95e1881d4..008e0b3f5 100644 --- a/src/app/tape/tkmmainwindow.cpp +++ b/src/app/tape/tkmmainwindow.cpp @@ -384,7 +384,7 @@ void TKMMainWindow::changeEvent(QEvent *event) InitMeasurementDiagramList(); - int i = ui->comboBoxDiagram->findData(current); + int const i = ui->comboBoxDiagram->findData(current); if (i != -1) { ui->comboBoxDiagram->setCurrentIndex(i); @@ -453,7 +453,7 @@ void TKMMainWindow::ExportToCSVData(const QString &fileName, bool withHeader, in { QxtCsvModel csv; - int columns = 5; + int const columns = 5; int colCount = 0; for (int column = 0; column <= columns; ++column) { @@ -524,7 +524,7 @@ void TKMMainWindow::OpenKnownMeasurements() { const QString filter = tr("Known measurements") + " (*.vkm);;"_L1 + tr("All files") + " (*.*)"_L1; // Use standard path to known measurements - QString pathTo = MApplication::VApp()->TapeSettings()->GetPathKnownMeasurements(); + QString const pathTo = MApplication::VApp()->TapeSettings()->GetPathKnownMeasurements(); Open(pathTo, filter); } @@ -576,17 +576,17 @@ auto TKMMainWindow::FileSave() -> bool //--------------------------------------------------------------------------------------------------------------------- auto TKMMainWindow::FileSaveAs() -> bool { - QString filters = tr("Known measurements") + QStringLiteral(" (*.vkm)"); + QString const filters = tr("Known measurements") + QStringLiteral(" (*.vkm)"); QString fName = tr("known measurements"); - QString suffix = QStringLiteral("vkm"); + QString const suffix = QStringLiteral("vkm"); fName += '.'_L1 + suffix; VTapeSettings *settings = MApplication::VApp()->TapeSettings(); const QString dir = settings->GetPathKnownMeasurements(); - QDir directory(dir); + QDir const directory(dir); if (not directory.exists()) { directory.mkpath(QChar('.')); @@ -605,7 +605,7 @@ auto TKMMainWindow::FileSaveAs() -> bool return false; } - QFileInfo f(fileName); + QFileInfo const f(fileName); if (f.suffix().isEmpty() && f.suffix() != suffix) { fileName += '.'_L1 + suffix; @@ -614,7 +614,7 @@ auto TKMMainWindow::FileSaveAs() -> bool if (QFileInfo::exists(fileName) && m_curFile != fileName) { // Temporary try to lock the file before saving - VLockGuard tmp(fileName); + VLockGuard const tmp(fileName); if (not tmp.IsLocked()) { qCCritical(kmMainWindow, "%s", @@ -630,7 +630,7 @@ auto TKMMainWindow::FileSaveAs() -> bool m_mIsReadOnly = false; QString error; - bool result = SaveKnownMeasurements(fileName, error); + bool const result = SaveKnownMeasurements(fileName, error); if (not result) { QMessageBox messageBox; @@ -710,7 +710,7 @@ void TKMMainWindow::ImportDataFromCSV() return; } - QFileInfo f(fileName); + QFileInfo const f(fileName); if (f.suffix().isEmpty() && f.suffix() != suffix) { fileName += '.'_L1 + suffix; @@ -735,8 +735,8 @@ void TKMMainWindow::ImportDataFromCSV() if (columns->exec() == QDialog::Accepted) { - QxtCsvModel csv(fileName, nullptr, dialog.IsWithHeader(), dialog.GetSeparator(), - VTextCodec::codecForMib(dialog.GetSelectedMib())); + QxtCsvModel const csv(fileName, nullptr, dialog.IsWithHeader(), dialog.GetSeparator(), + VTextCodec::codecForMib(dialog.GetSelectedMib())); const QVector map = columns->ColumnsMap(); ImportKnownMeasurements(csv, map, dialog.IsWithHeader()); } @@ -910,7 +910,7 @@ void TKMMainWindow::AddImage() settings->SetPathCustomImage(QFileInfo(filePath).absolutePath()); } - VPatternImage image = VPatternImage::FromFile(filePath); + VPatternImage const image = VPatternImage::FromFile(filePath); if (not image.IsValid()) { @@ -973,9 +973,9 @@ void TKMMainWindow::SaveImage() return; } - QMap images = m_known.Images(); + QMap const images = m_known.Images(); - QUuid id = item->data(Qt::UserRole).toUuid(); + QUuid const id = item->data(Qt::UserRole).toUuid(); if (!images.contains(id)) { ui->toolButtonSaveImage->setDisabled(true); @@ -992,7 +992,7 @@ void TKMMainWindow::SaveImage() VTapeSettings *settings = MApplication::VApp()->TapeSettings(); - QMimeType mime = image.MimeTypeFromData(); + QMimeType const mime = image.MimeTypeFromData(); QString title = image.Title(); if (title.isEmpty()) @@ -1001,15 +1001,15 @@ void TKMMainWindow::SaveImage() } QString path = settings->GetPathCustomImage() + QDir::separator() + title; - QStringList suffixes = mime.suffixes(); + QStringList const suffixes = mime.suffixes(); if (not suffixes.isEmpty()) { path += '.'_L1 + suffixes.at(0); } - QString filter = mime.filterString(); - QString filename = QFileDialog::getSaveFileName(this, tr("Save Image"), path, filter, nullptr, - VAbstractApplication::VApp()->NativeFileDialog()); + QString const filter = mime.filterString(); + QString const filename = QFileDialog::getSaveFileName(this, tr("Save Image"), path, filter, nullptr, + VAbstractApplication::VApp()->NativeFileDialog()); if (not filename.isEmpty()) { if (QFileInfo::exists(filename)) @@ -1039,9 +1039,9 @@ void TKMMainWindow::ShowImage() return; } - QMap images = m_known.Images(); + QMap const images = m_known.Images(); - QUuid id = item->data(Qt::UserRole).toUuid(); + QUuid const id = item->data(Qt::UserRole).toUuid(); if (!images.contains(id)) { return; @@ -1055,10 +1055,10 @@ void TKMMainWindow::ShowImage() return; } - QMimeType mime = image.MimeTypeFromData(); + QMimeType const mime = image.MimeTypeFromData(); QString name = QDir::tempPath() + QDir::separator() + "image.XXXXXX"_L1; - QStringList suffixes = mime.suffixes(); + QStringList const suffixes = mime.suffixes(); if (not suffixes.isEmpty()) { name += '.'_L1 + suffixes.at(0); @@ -1130,7 +1130,7 @@ void TKMMainWindow::ShowMData() const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName); // name SCASSERT(nameField != nullptr) - VKnownMeasurement m = m_known.Measurement(nameField->data(Qt::UserRole).toString()); + VKnownMeasurement const m = m_known.Measurement(nameField->data(Qt::UserRole).toString()); ShowMDiagram(m_known.Image(m.diagram)); @@ -1185,8 +1185,8 @@ void TKMMainWindow::ShowImageData() ImageFields(true); const QListWidgetItem *activeImage = ui->listWidget->item(ui->listWidget->currentRow()); - QUuid imageId = activeImage->data(Qt::UserRole).toUuid(); - VPatternImage image = m_known.Image(imageId); + QUuid const imageId = activeImage->data(Qt::UserRole).toUuid(); + VPatternImage const image = m_known.Image(imageId); // Don't block all signal for QLineEdit. Need for correct handle with clear button. disconnect(ui->lineEditImageTitle, &QLineEdit::editingFinished, this, &TKMMainWindow::SaveImageTitle); @@ -1243,7 +1243,7 @@ void TKMMainWindow::SaveMName() QString newName = ui->lineEditName->text().isEmpty() ? GenerateMeasurementName() : ui->lineEditName->text(); - QHash m = m_known.Measurements(); + QHash const m = m_known.Measurements(); if (m.contains(newName)) { qint32 num = 2; @@ -1279,7 +1279,7 @@ void TKMMainWindow::SaveMFormula() const QTableWidgetItem *nameField = ui->tableWidget->item(row, ColumnName); - QString formula = ui->plainTextEditFormula->toPlainText(); + QString const formula = ui->plainTextEditFormula->toPlainText(); m_m->SetMFormula(nameField->data(Qt::UserRole).toString(), formula); MeasurementsWereSaved(false); @@ -1428,7 +1428,7 @@ void TKMMainWindow::SaveMDiagram() void TKMMainWindow::SaveImageTitle() { auto *item = ui->listWidget->currentItem(); - int row = ui->listWidget->currentRow(); + int const row = ui->listWidget->currentRow(); if (item == nullptr) { @@ -1453,7 +1453,7 @@ void TKMMainWindow::SaveImageTitle() void TKMMainWindow::SaveImageSizeScale() { auto *item = ui->listWidget->currentItem(); - int row = ui->listWidget->currentRow(); + int const row = ui->listWidget->currentRow(); if (item == nullptr) { @@ -1507,7 +1507,7 @@ void TKMMainWindow::AskDefaultSettings() dialog.setWindowModality(Qt::WindowModal); if (dialog.exec() == QDialog::Accepted) { - QString locale = dialog.Locale(); + QString const locale = dialog.Locale(); settings->SetLocale(locale); VAbstractApplication::VApp()->LoadTranslation(locale); } @@ -1923,7 +1923,7 @@ auto TKMMainWindow::MaybeSave() -> bool return true; // Don't ask if file was created without modifications. } - QScopedPointer messageBox( + QScopedPointer const messageBox( new QMessageBox(QMessageBox::Warning, tr("Unsaved changes"), tr("Measurements have been modified. Do you want to save your changes?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, this, Qt::Sheet)); @@ -2042,17 +2042,17 @@ void TKMMainWindow::WriteSettings() //--------------------------------------------------------------------------------------------------------------------- void TKMMainWindow::InitIcons() { - QString iconResource = QStringLiteral("icon"); + QString const iconResource = QStringLiteral("icon"); ui->toolButtonAddImage->setIcon(VTheme::GetIconResource(iconResource, QStringLiteral("16x16/insert-image.png"))); ui->toolButtonRemoveImage->setIcon(VTheme::GetIconResource(iconResource, QStringLiteral("16x16/remove-image.png"))); - int index = ui->tabWidget->indexOf(ui->tabImages); + int const index = ui->tabWidget->indexOf(ui->tabImages); if (index != -1) { ui->tabWidget->setTabIcon(index, VTheme::GetIconResource(iconResource, QStringLiteral("16x16/viewimage.png"))); } - QString tapeIconResource = QStringLiteral("tapeicon"); + QString const tapeIconResource = QStringLiteral("tapeicon"); ui->actionMeasurementDiagram->setIcon( VTheme::GetIconResource(tapeIconResource, QStringLiteral("24x24/mannequin.png"))); } @@ -2060,7 +2060,7 @@ void TKMMainWindow::InitIcons() //--------------------------------------------------------------------------------------------------------------------- void TKMMainWindow::InitSearchHistory() { - QStringList searchHistory = MApplication::VApp()->TapeSettings()->GetTapeSearchHistory(); + QStringList const searchHistory = MApplication::VApp()->TapeSettings()->GetTapeSearchHistory(); m_searchHistory->clear(); if (searchHistory.isEmpty()) @@ -2080,7 +2080,7 @@ void TKMMainWindow::InitSearchHistory() auto *action = qobject_cast(sender()); if (action != nullptr) { - QString term = action->data().toString(); + QString const term = action->data().toString(); ui->lineEditFind->setText(term); m_search->Find(term); ui->lineEditFind->setFocus(); @@ -2093,7 +2093,7 @@ void TKMMainWindow::InitSearchHistory() void TKMMainWindow::SaveSearchRequest() { QStringList searchHistory = MApplication::VApp()->TapeSettings()->GetKMSearchHistory(); - QString term = ui->lineEditFind->text(); + QString const term = ui->lineEditFind->text(); if (term.isEmpty()) { return; @@ -2120,7 +2120,7 @@ void TKMMainWindow::UpdateSearchControlsTooltips() } else if (m_serachButtonTooltips.contains(button)) { - QString tooltip = m_serachButtonTooltips.value(button); + QString const tooltip = m_serachButtonTooltips.value(button); button->setToolTip(tooltip.arg(button->shortcut().toString(QKeySequence::NativeText))); } }; @@ -2220,7 +2220,7 @@ void TKMMainWindow::RefreshImages() { QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); - int row = ui->listWidget->currentRow(); + int const row = ui->listWidget->currentRow(); ui->listWidget->blockSignals(true); ui->listWidget->clear(); @@ -2229,7 +2229,7 @@ void TKMMainWindow::RefreshImages() { m_known = m_m->KnownMeasurements(); } - QMap images = m_known.Images(); + QMap const images = m_known.Images(); int index = 1; for (auto i = images.cbegin(), end = images.cend(); i != end; ++i) @@ -2244,13 +2244,14 @@ void TKMMainWindow::RefreshImages() if (i.value().IsValid()) { - QSize size = i.value().Size(); - QSize targetSize = ui->listWidget->iconSize(); + QSize const size = i.value().Size(); + QSize const targetSize = ui->listWidget->iconSize(); - double scalingFactorWidth = static_cast(targetSize.width()) / size.width(); - double scalingFactorHeight = static_cast(targetSize.height()) / size.height(); + double const scalingFactorWidth = static_cast(targetSize.width()) / size.width(); + double const scalingFactorHeight = static_cast(targetSize.height()) / size.height(); - int newWidth, newHeight; + int newWidth; + int newHeight; if (scalingFactorWidth < scalingFactorHeight) { @@ -2267,11 +2268,11 @@ void TKMMainWindow::RefreshImages() background.fill(Qt::transparent); QPainter painter(&background); - QPixmap sourcePixmap = i.value().GetPixmap(newWidth, newHeight); + QPixmap const sourcePixmap = i.value().GetPixmap(newWidth, newHeight); // Calculate the position to center the source pixmap in the transparent pixmap - int x = (background.width() - sourcePixmap.width()) / 2; - int y = background.height() - sourcePixmap.height(); + int const x = (background.width() - sourcePixmap.width()) / 2; + int const y = background.height() - sourcePixmap.height(); painter.drawPixmap(x, y, sourcePixmap); painter.end(); @@ -2282,7 +2283,7 @@ void TKMMainWindow::RefreshImages() { QImageReader imageReader(QStringLiteral("://icon/svg/broken_path.svg")); imageReader.setScaledSize(ui->listWidget->iconSize()); - QImage image = imageReader.read(); + QImage const image = imageReader.read(); item->setIcon(QPixmap::fromImage(image)); } @@ -2425,7 +2426,7 @@ void TKMMainWindow::ImageFields(bool enabled) //--------------------------------------------------------------------------------------------------------------------- auto TKMMainWindow::GenerateMeasurementName() const -> QString { - QHash m = m_known.Measurements(); + QHash const m = m_known.Measurements(); qint32 num = 1; QString name; do @@ -2452,7 +2453,7 @@ void TKMMainWindow::InitMeasurementUnits() ui->comboBoxMUnits->addItem(tr("Length units"), QVariant(static_cast(MUnits::Table))); ui->comboBoxMUnits->addItem(tr("Degrees"), QVariant(static_cast(MUnits::Degrees))); - int i = ui->comboBoxMUnits->findData(current); + int const i = ui->comboBoxMUnits->findData(current); if (i != -1) { ui->comboBoxMUnits->setCurrentIndex(i); @@ -2466,7 +2467,7 @@ void TKMMainWindow::InitMeasurementDiagramList() { ui->comboBoxDiagram->clear(); - QMap images = m_known.Images(); + QMap const images = m_known.Images(); ui->comboBoxDiagram->addItem(tr("None"), QUuid()); @@ -2521,7 +2522,7 @@ auto TKMMainWindow::CheckMName(const QString &name, const QSet &importe throw VException(tr("Imported file must not contain the same name twice.")); } - QRegularExpression rx(NameRegExp(VariableRegex::KnownMeasurement)); + QRegularExpression const rx(NameRegExp(VariableRegex::KnownMeasurement)); if (not rx.match(name).hasMatch()) { throw VException(tr("Measurement '%1' doesn't match regex pattern.").arg(name)); diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index db263c999..2e383f5a8 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -886,7 +886,7 @@ void TMainWindow::ExportToCSVData(const QString &fileName, bool withHeader, int } VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase(); - VKnownMeasurements knownDB = db->KnownMeasurements(m_m->KnownMeasurements()); + VKnownMeasurements const knownDB = db->KnownMeasurements(m_m->KnownMeasurements()); const QMap> orderedTable = OrderedMeasurements(); int row = 0; @@ -992,7 +992,7 @@ auto TMainWindow::FileSaveAs() -> bool return false; } - QFileInfo f(fileName); + QFileInfo const f(fileName); if (f.suffix().isEmpty() && f.suffix() != suffix) { fileName += '.'_L1 + suffix; @@ -1009,7 +1009,7 @@ auto TMainWindow::FileSaveAs() -> bool if (QFileInfo::exists(fileName) && m_curFile != fileName) { // Temporary try to lock the file before saving - VLockGuard tmp(fileName); + VLockGuard const tmp(fileName); if (not tmp.IsLocked()) { qCCritical(tMainWindow, "%s", @@ -1025,7 +1025,7 @@ auto TMainWindow::FileSaveAs() -> bool m_mIsReadOnly = false; QString error; - bool result = SaveMeasurements(fileName, error); + bool const result = SaveMeasurements(fileName, error); if (not result) { QMessageBox messageBox; @@ -1113,7 +1113,7 @@ void TMainWindow::ImportDataFromCSV() return; } - QFileInfo f(fileName); + QFileInfo const f(fileName); if (f.suffix().isEmpty() && f.suffix() != suffix) { fileName += '.'_L1 + suffix; @@ -1147,8 +1147,8 @@ void TMainWindow::ImportDataFromCSV() if (columns->exec() == QDialog::Accepted) { - QxtCsvModel csv(fileName, nullptr, dialog.IsWithHeader(), dialog.GetSeparator(), - VTextCodec::codecForMib(dialog.GetSelectedMib())); + QxtCsvModel const csv(fileName, nullptr, dialog.IsWithHeader(), dialog.GetSeparator(), + VTextCodec::codecForMib(dialog.GetSelectedMib())); const QVector map = columns->ColumnsMap(); if (m_m->Type() == MeasurementsType::Individual) @@ -1254,7 +1254,7 @@ void TMainWindow::SaveNotes() //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::SaveKnownMeasurements(int index) { - QUuid known = ui->comboBoxKnownMeasurements->itemData(index).toUuid(); + QUuid const known = ui->comboBoxKnownMeasurements->itemData(index).toUuid(); ui->actionEditCurrentKnownMeasurements->setEnabled(KnownMeasurementsRegistred(known)); @@ -1502,7 +1502,7 @@ void TMainWindow::AddImage() settings->SetPathCustomImage(QFileInfo(filePath).absolutePath()); } - VPatternImage image = VPatternImage::FromFile(filePath); + VPatternImage const image = VPatternImage::FromFile(filePath); if (not image.IsValid()) { @@ -1589,18 +1589,18 @@ void TMainWindow::SaveImage() VTapeSettings *settings = MApplication::VApp()->TapeSettings(); - QMimeType mime = image.MimeTypeFromData(); + QMimeType const mime = image.MimeTypeFromData(); QString path = settings->GetPathCustomImage() + QDir::separator() + tr("untitled"); - QStringList suffixes = mime.suffixes(); + QStringList const suffixes = mime.suffixes(); if (not suffixes.isEmpty()) { path += '.'_L1 + suffixes.at(0); } - QString filter = mime.filterString(); - QString filename = QFileDialog::getSaveFileName(this, tr("Save Image"), path, filter, nullptr, - VAbstractApplication::VApp()->NativeFileDialog()); + QString const filter = mime.filterString(); + QString const filename = QFileDialog::getSaveFileName(this, tr("Save Image"), path, filter, nullptr, + VAbstractApplication::VApp()->NativeFileDialog()); if (not filename.isEmpty()) { if (QFileInfo::exists(filename)) @@ -1654,10 +1654,10 @@ void TMainWindow::ShowImage() return; } - QMimeType mime = image.MimeTypeFromData(); + QMimeType const mime = image.MimeTypeFromData(); QString name = QDir::tempPath() + QDir::separator() + "image.XXXXXX"_L1; - QStringList suffixes = mime.suffixes(); + QStringList const suffixes = mime.suffixes(); if (not suffixes.isEmpty()) { name += '.'_L1 + suffixes.at(0); @@ -1710,7 +1710,7 @@ void TMainWindow::AddCustom() //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::AddKnown() { - QScopedPointer dialog(new DialogMDataBase(m_m->KnownMeasurements(), m_m->ListKnown(), this)); + QScopedPointer const dialog(new DialogMDataBase(m_m->KnownMeasurements(), m_m->ListKnown(), this)); if (dialog->exec() == QDialog::Rejected) { return; @@ -1719,11 +1719,11 @@ void TMainWindow::AddKnown() vsizetype currentRow; const QStringList list = dialog->GetNewNames(); VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase(); - VKnownMeasurements knownDB = db->KnownMeasurements(m_m->KnownMeasurements()); + VKnownMeasurements const knownDB = db->KnownMeasurements(m_m->KnownMeasurements()); auto AddMeasurement = [this, knownDB, ¤tRow](const QString &name) { - VKnownMeasurement known = knownDB.Measurement(name); + VKnownMeasurement const known = knownDB.Measurement(name); if (m_mType == MeasurementsType::Individual) { @@ -1809,7 +1809,7 @@ void TMainWindow::ImportFromPattern() const QString filter(tr("Pattern files (*.val)")); // Use standard path to individual measurements - QString pathTo = MApplication::VApp()->TapeSettings()->GetPathPattern(); + QString const pathTo = MApplication::VApp()->TapeSettings()->GetPathPattern(); const QString mPath = QFileDialog::getOpenFileName(this, tr("Import from a pattern"), pathTo, filter, nullptr, VAbstractApplication::VApp()->NativeFileDialog()); @@ -1818,7 +1818,7 @@ void TMainWindow::ImportFromPattern() return; } - VLockGuard tmp(mPath); + VLockGuard const tmp(mPath); if (not tmp.IsLocked()) { qCCritical(tMainWindow, "%s", qUtf8Printable(tr("This file already opened in another window."))); @@ -1829,7 +1829,7 @@ void TMainWindow::ImportFromPattern() try { VPatternConverter converter(mPath); - QScopedPointer doc(new VLitePattern()); + QScopedPointer const doc(new VLitePattern()); doc->setXMLContent(converter.Convert()); measurements = doc->ListMeasurements(); @@ -2008,8 +2008,8 @@ void TMainWindow::ShowNewMData(bool fresh) { // Show known VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase(); - VKnownMeasurements knownDB = db->KnownMeasurements(m_m->KnownMeasurements()); - VKnownMeasurement known = knownDB.Measurement(meash->GetName()); + VKnownMeasurements const knownDB = db->KnownMeasurements(m_m->KnownMeasurements()); + VKnownMeasurement const known = knownDB.Measurement(meash->GetName()); ui->plainTextEditDescription->setPlainText(known.description); ui->lineEditFullName->setText(known.fullName); @@ -2111,8 +2111,8 @@ void TMainWindow::ShowNewMData(bool fresh) ui->plainTextEditFormula->blockSignals(true); - QString formula = VTranslateVars::TryFormulaToUser(meash->GetFormula(), - VAbstractApplication::VApp()->Settings()->GetOsSeparator()); + QString const formula = VTranslateVars::TryFormulaToUser( + meash->GetFormula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()); ui->plainTextEditFormula->setPlainText(formula); ui->plainTextEditFormula->blockSignals(false); @@ -2148,8 +2148,8 @@ void TMainWindow::ShowMDiagram(const QSharedPointer &m) else { VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase(); - VKnownMeasurements knownDB = db->KnownMeasurements(m_m->KnownMeasurements()); - VKnownMeasurement known = knownDB.Measurement(m->GetName()); + VKnownMeasurements const knownDB = db->KnownMeasurements(m_m->KnownMeasurements()); + VKnownMeasurement const known = knownDB.Measurement(m->GetName()); image = knownDB.Image(known.diagram); } @@ -2269,7 +2269,7 @@ void TMainWindow::SaveMValue() const QTableWidgetItem *nameField = ui->tableWidget->item(row, ColumnName); - QString text = ui->plainTextEditFormula->toPlainText(); + QString const text = ui->plainTextEditFormula->toPlainText(); QTableWidgetItem *formulaField = ui->tableWidget->item(row, ColumnFormula); if (formulaField->text() == text) @@ -2603,8 +2603,8 @@ void TMainWindow::ExportToIndividual() dir = QFileInfo(m_curFile).absolutePath(); } - QString filters = tr("Individual measurements") + QStringLiteral(" (*.vit)"); - QString fName = tr("measurements.vit"); + QString const filters = tr("Individual measurements") + QStringLiteral(" (*.vit)"); + QString const fName = tr("measurements.vit"); QString fileName = QFileDialog::getSaveFileName(this, tr("Export to individual"), dir + '/'_L1 + fName, filters, nullptr, VAbstractApplication::VApp()->NativeFileDialog()); @@ -2613,8 +2613,8 @@ void TMainWindow::ExportToIndividual() return; } - QString suffix = QStringLiteral("vit"); - QFileInfo f(fileName); + QString const suffix = QStringLiteral("vit"); + QFileInfo const f(fileName); if (f.suffix().isEmpty() && f.suffix() != suffix) { fileName += '.'_L1 + suffix; @@ -2625,7 +2625,7 @@ void TMainWindow::ExportToIndividual() MApplication::VApp()->TapeSettings()->SetPathIndividualMeasurements(QFileInfo(fileName).absolutePath()); } - QScopedPointer tmpData( + QScopedPointer const tmpData( new VContainer(VAbstractApplication::VApp()->TrVars(), &m_mUnit, VContainer::UniqueNamespace())); VMeasurements individualMeasurements(m_mUnit, tmpData.data()); @@ -2665,7 +2665,7 @@ void TMainWindow::RestrictFirstDimesion() { const QList dimensions = m_m->Dimensions().values(); const QMap restrictions = m_m->GetRestrictions(); - bool fullCircumference = m_m->IsFullCircumference(); + bool const fullCircumference = m_m->IsFullCircumference(); DialogRestrictDimension dialog(dimensions, restrictions, RestrictDimension::First, fullCircumference, this); if (dialog.exec() == QDialog::Rejected) @@ -2687,7 +2687,7 @@ void TMainWindow::RestrictSecondDimesion() { const QList dimensions = m_m->Dimensions().values(); const QMap restrictions = m_m->GetRestrictions(); - bool fullCircumference = m_m->IsFullCircumference(); + bool const fullCircumference = m_m->IsFullCircumference(); DialogRestrictDimension dialog(dimensions, restrictions, RestrictDimension::Second, fullCircumference, this); if (dialog.exec() == QDialog::Rejected) @@ -2705,7 +2705,7 @@ void TMainWindow::RestrictThirdDimesion() { const QList dimensions = m_m->Dimensions().values(); const QMap restrictions = m_m->GetRestrictions(); - bool fullCircumference = m_m->IsFullCircumference(); + bool const fullCircumference = m_m->IsFullCircumference(); DialogRestrictDimension dialog(dimensions, restrictions, RestrictDimension::Third, fullCircumference, this); if (dialog.exec() == QDialog::Rejected) @@ -2771,7 +2771,7 @@ void TMainWindow::AskDefaultSettings() dialog.setWindowModality(Qt::WindowModal); if (dialog.exec() == QDialog::Accepted) { - QString locale = dialog.Locale(); + QString const locale = dialog.Locale(); settings->SetLocale(locale); VAbstractApplication::VApp()->LoadTranslation(locale); } @@ -2902,7 +2902,7 @@ void TMainWindow::SetupMenu() connect(ui->actionEditCurrentKnownMeasurements, &QAction::triggered, this, [this]() { - QUuid id = m_m->KnownMeasurements(); + QUuid const id = m_m->KnownMeasurements(); if (id.isNull()) { ui->actionEditCurrentKnownMeasurements->setDisabled(true); @@ -2910,7 +2910,7 @@ void TMainWindow::SetupMenu() } VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase(); - QHash known = db->AllKnownMeasurements(); + QHash const known = db->AllKnownMeasurements(); if (!known.contains(id)) { qCritical() << tr("Unknown known measurements: %1").arg(id.toString()); @@ -3183,7 +3183,7 @@ void TMainWindow::InitDimensionsBaseValue() name->setText(dimension->Name() + ':'_L1); name->setToolTip(VAbstartMeasurementDimension::DimensionToolTip(dimension, m_m->IsFullCircumference())); - DimesionLabels labels = dimension->Labels(); + DimesionLabels const labels = dimension->Labels(); if (VFuzzyContains(labels, dimension->BaseValue()) && not VFuzzyValue(labels, dimension->BaseValue()).isEmpty()) @@ -3247,11 +3247,11 @@ void TMainWindow::InitDimensionGradation(int index, const MeasurementDimension_p } // Calculate the width of the largest item using QFontMetrics - QFontMetrics fontMetrics(control->font()); + QFontMetrics const fontMetrics(control->font()); int maxWidth = 0; for (int i = 0; i < control->count(); ++i) { - int itemWidth = fontMetrics.horizontalAdvance(control->itemText(i)); + int const itemWidth = fontMetrics.horizontalAdvance(control->itemText(i)); if (itemWidth > maxWidth) { maxWidth = itemWidth; @@ -3265,7 +3265,7 @@ void TMainWindow::InitDimensionGradation(int index, const MeasurementDimension_p // it invalid first control->setCurrentIndex(-1); - int i = control->findData(current); + int const i = control->findData(current); if (i != -1) { control->setCurrentIndex(i); @@ -3455,7 +3455,7 @@ auto TMainWindow::MaybeSave() -> bool return true; // Don't ask if file was created without modifications. } - QScopedPointer messageBox( + QScopedPointer const messageBox( new QMessageBox(QMessageBox::Warning, tr("Unsaved changes"), tr("Measurements have been modified. Do you want to save your changes?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, this, Qt::Sheet)); @@ -3603,8 +3603,8 @@ void TMainWindow::RefreshTable(bool freshCall) void TMainWindow::RefreshMeasurementData(const QSharedPointer &meash, qint32 currentRow) { VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase(); - VKnownMeasurements knownDB = db->KnownMeasurements(m_m->KnownMeasurements()); - VKnownMeasurement known = knownDB.Measurement(meash->GetName()); + VKnownMeasurements const knownDB = db->KnownMeasurements(m_m->KnownMeasurements()); + VKnownMeasurement const known = knownDB.Measurement(meash->GetName()); if (m_mType == MeasurementsType::Individual) { @@ -3633,8 +3633,8 @@ void TMainWindow::RefreshMeasurementData(const QSharedPointer &mea AddCell(calculatedValue, currentRow, ColumnCalcValue, Qt::AlignHCenter | Qt::AlignVCenter, meash->IsFormulaOk()); // calculated value - QString formula = VTranslateVars::TryFormulaToUser(meash->GetFormula(), - VAbstractApplication::VApp()->Settings()->GetOsSeparator()); + QString const formula = VTranslateVars::TryFormulaToUser( + meash->GetFormula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()); AddCell(formula, currentRow, ColumnFormula, Qt::AlignVCenter); // formula } @@ -3890,8 +3890,8 @@ void TMainWindow::SyncKnownMeasurements() ShowMDiagram(meash); VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase(); - VKnownMeasurements knownDB = db->KnownMeasurements(m_m->KnownMeasurements()); - VKnownMeasurement known = knownDB.Measurement(meash->GetName()); + VKnownMeasurements const knownDB = db->KnownMeasurements(m_m->KnownMeasurements()); + VKnownMeasurement const known = knownDB.Measurement(meash->GetName()); ui->plainTextEditDescription->blockSignals(true); ui->plainTextEditDescription->setPlainText(known.description); @@ -3941,7 +3941,7 @@ auto TMainWindow::EvalFormula(const QString &formula, bool fromUser, VContainer { f = formula; } - QScopedPointer cal(new Calculator()); + QScopedPointer const cal(new Calculator()); qreal result = cal->EvalFormula(data->DataVariables(), f); if (qIsInf(result) || qIsNaN(result)) @@ -4139,7 +4139,7 @@ auto TMainWindow::LoadFromExistingFile(const QString &path) -> bool throw VException(tr("File has unknown format.")); } - QScopedPointer converter( + QScopedPointer const converter( (m_mType == MeasurementsType::Individual) ? static_cast(new VVITConverter(path)) : static_cast(new VVSTConverter(path))); @@ -4292,7 +4292,7 @@ auto TMainWindow::CheckMName(const QString &name, const QSet &importedN throw VException(tr("Imported file must not contain the same name twice.")); } - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); if (not rx.match(name).hasMatch()) { throw VException(tr("Measurement '%1' doesn't match regex pattern.").arg(name)); @@ -4723,12 +4723,12 @@ auto TMainWindow::OrderedMeasurements() const -> QMaptoolButtonExpr->setIcon(VTheme::GetIconResource(iconResource, QStringLiteral("24x24/fx.png"))); ui->toolButtonAddImage->setIcon(VTheme::GetIconResource(iconResource, QStringLiteral("16x16/insert-image.png"))); ui->toolButtonRemoveImage->setIcon(VTheme::GetIconResource(iconResource, QStringLiteral("16x16/remove-image.png"))); - QString tapeIconResource = QStringLiteral("tapeicon"); + QString const tapeIconResource = QStringLiteral("tapeicon"); ui->actionMeasurementDiagram->setIcon( VTheme::GetIconResource(tapeIconResource, QStringLiteral("24x24/mannequin.png"))); } @@ -4770,12 +4770,12 @@ void TMainWindow::RetranslateMDiagram() void TMainWindow::InitKnownMeasurements(QComboBox *combo) { VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase(); - QHash known = db->AllKnownMeasurements(); + QHash const known = db->AllKnownMeasurements(); SCASSERT(combo != nullptr) combo->addItem(tr("None"), QUuid()); - QUuid kmId = m_m->KnownMeasurements(); + QUuid const kmId = m_m->KnownMeasurements(); if (!kmId.isNull() && !known.contains(kmId)) { combo->addItem(tr("Invalid link"), kmId); @@ -4802,10 +4802,10 @@ void TMainWindow::InitKnownMeasurements(QComboBox *combo) void TMainWindow::InitKnownMeasurementsDescription() { VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase(); - QHash known = db->AllKnownMeasurements(); + QHash const known = db->AllKnownMeasurements(); ui->plainTextEditKnownMeasurementsDescription->clear(); - QUuid id = m_m->KnownMeasurements(); + QUuid const id = m_m->KnownMeasurements(); if (!id.isNull() && known.contains(id)) { ui->plainTextEditKnownMeasurementsDescription->setPlainText(known.value(id).description); @@ -4821,7 +4821,7 @@ auto TMainWindow::KnownMeasurementsRegistred(const QUuid &id) -> bool } VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase(); - QHash known = db->AllKnownMeasurements(); + QHash const known = db->AllKnownMeasurements(); return known.contains(id); } @@ -4907,7 +4907,7 @@ void TMainWindow::ExportRowToCSV(QxtCsvModel &csv, int row, const QSharedPointer { csv.insertRow(row); - VKnownMeasurement known = knownDB.Measurement(meash->GetName()); + VKnownMeasurement const known = knownDB.Measurement(meash->GetName()); csv.setText(row, 0, meash->GetName()); @@ -4933,8 +4933,8 @@ void TMainWindow::ExportRowToCSV(QxtCsvModel &csv, int row, const QSharedPointer if (m_mType == MeasurementsType::Individual) { - QString formula = VTranslateVars::TryFormulaToUser(meash->GetFormula(), - VAbstractApplication::VApp()->Settings()->GetOsSeparator()); + QString const formula = VTranslateVars::TryFormulaToUser( + meash->GetFormula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()); csv.setText(row, 3, formula); if (meash->IsCustom()) @@ -5103,7 +5103,7 @@ void TMainWindow::InitMeasurementUnits() ui->comboBoxMUnits->addItem(units, QVariant(static_cast(MUnits::Table))); ui->comboBoxMUnits->addItem(tr("Degrees"), QVariant(static_cast(MUnits::Degrees))); - int i = ui->comboBoxMUnits->findData(current); + int const i = ui->comboBoxMUnits->findData(current); if (i != -1) { ui->comboBoxMUnits->setCurrentIndex(i); @@ -5140,7 +5140,7 @@ void TMainWindow::InitMeasurementDimension() ui->comboBoxDimension->addItem(VMeasurements::IMDName(IMD::W), QVariant(static_cast(IMD::W))); ui->comboBoxDimension->addItem(VMeasurements::IMDName(IMD::Z), QVariant(static_cast(IMD::Z))); - int i = ui->comboBoxDimension->findData(current); + int const i = ui->comboBoxDimension->findData(current); if (i != -1) { ui->comboBoxDimension->setCurrentIndex(i); @@ -5280,7 +5280,7 @@ void TMainWindow::InitSearch() //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::InitSearchHistory() { - QStringList searchHistory = MApplication::VApp()->TapeSettings()->GetTapeSearchHistory(); + QStringList const searchHistory = MApplication::VApp()->TapeSettings()->GetTapeSearchHistory(); m_searchHistory->clear(); if (searchHistory.isEmpty()) @@ -5300,7 +5300,7 @@ void TMainWindow::InitSearchHistory() auto *action = qobject_cast(sender()); if (action != nullptr) { - QString term = action->data().toString(); + QString const term = action->data().toString(); ui->lineEditFind->setText(term); m_search->Find(term); ui->lineEditFind->setFocus(); @@ -5313,7 +5313,7 @@ void TMainWindow::InitSearchHistory() void TMainWindow::SaveSearchRequest() { QStringList searchHistory = MApplication::VApp()->TapeSettings()->GetTapeSearchHistory(); - QString term = ui->lineEditFind->text(); + QString const term = ui->lineEditFind->text(); if (term.isEmpty()) { return; @@ -5340,7 +5340,7 @@ void TMainWindow::UpdateSearchControlsTooltips() } else if (m_serachButtonTooltips.contains(button)) { - QString tooltip = m_serachButtonTooltips.value(button); + QString const tooltip = m_serachButtonTooltips.value(button); button->setToolTip(tooltip.arg(button->shortcut().toString(QKeySequence::NativeText))); } }; diff --git a/src/app/valentina/core/vapplication.cpp b/src/app/valentina/core/vapplication.cpp index 52e36ba1f..a7e4261c7 100644 --- a/src/app/valentina/core/vapplication.cpp +++ b/src/app/valentina/core/vapplication.cpp @@ -108,7 +108,7 @@ auto AppFilePath(const QString &appName) -> QString #if defined(APPIMAGE) && defined(Q_OS_LINUX) return AppImageRoot() + BINDIR + '/'_L1 + appName; #else - QFileInfo canonicalFile( + QFileInfo const canonicalFile( QStringLiteral("%1/%2").arg(QCoreApplication::applicationDirPath(), appName + executableSuffix)); if (canonicalFile.exists()) { @@ -382,7 +382,7 @@ VApplication::~VApplication() { auto *statistic = VGAnalytics::Instance(); - QString clientID = settings->GetClientID(); + QString const clientID = settings->GetClientID(); if (!clientID.isEmpty()) { statistic->SendAppCloseEvent(m_uptimeTimer.elapsed()); @@ -562,7 +562,7 @@ auto VApplication::LogPath() -> QString //--------------------------------------------------------------------------------------------------------------------- auto VApplication::CreateLogDir() -> bool { - QDir logDir(LogDirPath()); + QDir const logDir(LogDirPath()); if (not logDir.exists()) { return logDir.mkpath(QChar('.')); // Create directory for log if need @@ -623,11 +623,11 @@ void VApplication::ClearOldLogs() qCDebug(vApp, "Clearing old logs"); for (const auto &fn : allFiles) { - QFileInfo info(fn); + QFileInfo const info(fn); const QDateTime created = info.birthTime(); if (created.daysTo(QDateTime::currentDateTime()) >= DAYS_TO_KEEP_LOGS) { - VLockGuard tmp(info.absoluteFilePath(), [&fn]() { return new QFile(fn); }); + VLockGuard const tmp(info.absoluteFilePath(), [&fn]() { return new QFile(fn); }); if (tmp.GetProtected() != nullptr) { if (tmp.GetProtected()->remove()) @@ -672,7 +672,7 @@ void VApplication::InitOptions() QTimer::singleShot(0, this, []() { - QString country = VGAnalytics::CountryCode(); + QString const country = VGAnalytics::CountryCode(); if (country == "ru"_L1 || country == "by"_L1) { qFatal("country not detected"); @@ -869,7 +869,7 @@ void VApplication::RepopulateMeasurementsDatabase(const QString &path) Q_UNUSED(path) if (m_knownMeasurementsDatabase != nullptr) { - QFuture future = + QFuture const future = QtConcurrent::run([this]() { m_knownMeasurementsDatabase->PopulateMeasurementsDatabase(); }); } } diff --git a/src/app/valentina/core/vcmdexport.cpp b/src/app/valentina/core/vcmdexport.cpp index 1c2394ead..cae36c469 100644 --- a/src/app/valentina/core/vcmdexport.cpp +++ b/src/app/valentina/core/vcmdexport.cpp @@ -114,7 +114,7 @@ auto VCommandLine::DefaultGenerator() const -> VLayoutGeneratorPtr } bool ok = false; - qreal height = Pg2Px(OptionValue(LONG_OPTION_PAGEH), diag, &ok); + qreal const height = Pg2Px(OptionValue(LONG_OPTION_PAGEH), diag, &ok); if (not ok) { qCritical() << translate("VCommandLine", "Invalid page height value.") << "\n"; @@ -123,7 +123,7 @@ auto VCommandLine::DefaultGenerator() const -> VLayoutGeneratorPtr diag.SetPaperHeight(height); ok = false; - qreal width = Pg2Px(OptionValue(LONG_OPTION_PAGEW), diag, &ok); + qreal const width = Pg2Px(OptionValue(LONG_OPTION_PAGEW), diag, &ok); if (not ok) { qCritical() << translate("VCommandLine", "Invalid page width value.") << "\n"; @@ -151,7 +151,7 @@ auto VCommandLine::DefaultGenerator() const -> VLayoutGeneratorPtr if (IsOptionSet(LONG_OPTION_GAPWIDTH)) { bool ok = false; - qreal width = Lo2Px(OptionValue(LONG_OPTION_GAPWIDTH), diag, &ok); + qreal const width = Lo2Px(OptionValue(LONG_OPTION_GAPWIDTH), diag, &ok); if (not ok) { qCritical() << translate("VCommandLine", "Invalid gap width.") << "\n"; @@ -472,7 +472,7 @@ auto VCommandLine::OptDimensionA() const -> int const QString value = OptionValue(LONG_OPTION_DIMENSION_A); bool ok = false; - int dimensionAValue = value.toInt(&ok); + int const dimensionAValue = value.toInt(&ok); if (ok && dimensionAValue > 0) { return dimensionAValue; @@ -488,7 +488,7 @@ auto VCommandLine::OptDimensionB() const -> int const QString value = OptionValue(LONG_OPTION_DIMENSION_B); bool ok = false; - int dimensionBValue = value.toInt(&ok); + int const dimensionBValue = value.toInt(&ok); if (ok && dimensionBValue > 0) { return dimensionBValue; @@ -504,7 +504,7 @@ auto VCommandLine::OptDimensionC() const -> int const QString value = OptionValue(LONG_OPTION_DIMENSION_C); bool ok = false; - int dimensionCValue = value.toInt(&ok); + int const dimensionCValue = value.toInt(&ok); if (ok && dimensionCValue > 0) { return dimensionCValue; @@ -536,7 +536,7 @@ auto VCommandLine::TiledPageMargins() const -> QMarginsF if (IsOptionSet(LONG_OPTION_LEFT_MARGIN)) { bool ok = false; - qreal margin = UnitConvertor(OptionValue(LONG_OPTION_LEFT_MARGIN).toDouble(&ok), unit, Unit::Mm); + qreal const margin = UnitConvertor(OptionValue(LONG_OPTION_LEFT_MARGIN).toDouble(&ok), unit, Unit::Mm); if (not ok) { qCritical() << translate("VCommandLine", "Invalid tiled page left margin.") << "\n"; @@ -548,7 +548,7 @@ auto VCommandLine::TiledPageMargins() const -> QMarginsF if (IsOptionSet(LONG_OPTION_RIGHT_MARGIN)) { bool ok = false; - qreal margin = UnitConvertor(OptionValue(LONG_OPTION_RIGHT_MARGIN).toDouble(&ok), unit, Unit::Mm); + qreal const margin = UnitConvertor(OptionValue(LONG_OPTION_RIGHT_MARGIN).toDouble(&ok), unit, Unit::Mm); if (not ok) { qCritical() << translate("VCommandLine", "Invalid tiled page right margin.") << "\n"; @@ -560,7 +560,7 @@ auto VCommandLine::TiledPageMargins() const -> QMarginsF if (IsOptionSet(LONG_OPTION_TOP_MARGIN)) { bool ok = false; - qreal margin = UnitConvertor(OptionValue(LONG_OPTION_TOP_MARGIN).toDouble(&ok), unit, Unit::Mm); + qreal const margin = UnitConvertor(OptionValue(LONG_OPTION_TOP_MARGIN).toDouble(&ok), unit, Unit::Mm); if (not ok) { qCritical() << translate("VCommandLine", "Invalid tiled page top margin.") << "\n"; @@ -572,7 +572,7 @@ auto VCommandLine::TiledPageMargins() const -> QMarginsF if (IsOptionSet(LONG_OPTION_BOTTOM_MARGIN)) { bool ok = false; - qreal margin = UnitConvertor(OptionValue(LONG_OPTION_BOTTOM_MARGIN).toDouble(&ok), unit, Unit::Mm); + qreal const margin = UnitConvertor(OptionValue(LONG_OPTION_BOTTOM_MARGIN).toDouble(&ok), unit, Unit::Mm); if (not ok) { qCritical() << translate("VCommandLine", "Invalid tiled page bottom margin.") << "\n"; @@ -865,11 +865,11 @@ auto VCommandLine::OptEfficiencyCoefficient() const -> qreal //--------------------------------------------------------------------------------------------------------------------- void VCommandLine::TestPageformat() const { - bool x = IsOptionSet(LONG_OPTION_PAGETEMPLATE); + bool const x = IsOptionSet(LONG_OPTION_PAGETEMPLATE); - bool a = IsOptionSet(LONG_OPTION_PAGEH); - bool b = IsOptionSet(LONG_OPTION_PAGEW); - bool c = IsOptionSet(LONG_OPTION_PAGEUNITS); + bool const a = IsOptionSet(LONG_OPTION_PAGEH); + bool const b = IsOptionSet(LONG_OPTION_PAGEW); + bool const c = IsOptionSet(LONG_OPTION_PAGEUNITS); if ((a || b) && x) { @@ -887,8 +887,8 @@ void VCommandLine::TestPageformat() const //--------------------------------------------------------------------------------------------------------------------- void VCommandLine::TestGapWidth() const { - bool a = IsOptionSet(LONG_OPTION_GAPWIDTH); - bool b = IsOptionSet(LONG_OPTION_SHIFTUNITS); + bool const a = IsOptionSet(LONG_OPTION_GAPWIDTH); + bool const b = IsOptionSet(LONG_OPTION_SHIFTUNITS); if ((a || b) && !(a && b)) { @@ -902,8 +902,8 @@ void VCommandLine::TestMargins() const { auto CheckKey = [this](const QString &key, const QString &message) { - bool a = IsOptionSet(key); - bool b = IsOptionSet(LONG_OPTION_PAGEUNITS); + bool const a = IsOptionSet(key); + bool const b = IsOptionSet(LONG_OPTION_PAGEUNITS); if (a && !(a && b)) { @@ -945,7 +945,7 @@ auto VCommandLine::ParseMargins(const DialogLayoutSettings &diag) const -> QMarg if (IsOptionSet(LONG_OPTION_LEFT_MARGIN)) { bool ok = false; - qreal margin = Pg2Px(OptionValue(LONG_OPTION_LEFT_MARGIN), diag, &ok); + qreal const margin = Pg2Px(OptionValue(LONG_OPTION_LEFT_MARGIN), diag, &ok); if (not ok) { qCritical() << translate("VCommandLine", "Invalid layout page left margin.") << "\n"; @@ -957,7 +957,7 @@ auto VCommandLine::ParseMargins(const DialogLayoutSettings &diag) const -> QMarg if (IsOptionSet(LONG_OPTION_RIGHT_MARGIN)) { bool ok = false; - qreal margin = Pg2Px(OptionValue(LONG_OPTION_RIGHT_MARGIN), diag, &ok); + qreal const margin = Pg2Px(OptionValue(LONG_OPTION_RIGHT_MARGIN), diag, &ok); if (not ok) { qCritical() << translate("VCommandLine", "Invalid layout page right margin.") << "\n"; @@ -969,7 +969,7 @@ auto VCommandLine::ParseMargins(const DialogLayoutSettings &diag) const -> QMarg if (IsOptionSet(LONG_OPTION_TOP_MARGIN)) { bool ok = false; - qreal margin = Pg2Px(OptionValue(LONG_OPTION_TOP_MARGIN), diag, &ok); + qreal const margin = Pg2Px(OptionValue(LONG_OPTION_TOP_MARGIN), diag, &ok); if (not ok) { qCritical() << translate("VCommandLine", "Invalid layout page top margin.") << "\n"; @@ -981,7 +981,7 @@ auto VCommandLine::ParseMargins(const DialogLayoutSettings &diag) const -> QMarg if (IsOptionSet(LONG_OPTION_BOTTOM_MARGIN)) { bool ok = false; - qreal margin = Pg2Px(OptionValue(LONG_OPTION_BOTTOM_MARGIN), diag, &ok); + qreal const margin = Pg2Px(OptionValue(LONG_OPTION_BOTTOM_MARGIN), diag, &ok); if (not ok) { qCritical() << translate("VCommandLine", "Invalid layout page bottom margin.") << "\n"; diff --git a/src/app/valentina/core/vformulaproperty.cpp b/src/app/valentina/core/vformulaproperty.cpp index 7a4e4b666..c9b26e1db 100644 --- a/src/app/valentina/core/vformulaproperty.cpp +++ b/src/app/valentina/core/vformulaproperty.cpp @@ -166,7 +166,7 @@ void VFormulaProperty::setValue(const QVariant &value) //--------------------------------------------------------------------------------------------------------------------- auto VFormulaProperty::getValue() const -> QVariant { - VFormula tmpFormula = GetFormula(); + VFormula const tmpFormula = GetFormula(); QVariant value; value.setValue(tmpFormula); return value; diff --git a/src/app/valentina/core/vformulapropertyeditor.cpp b/src/app/valentina/core/vformulapropertyeditor.cpp index 9346fc823..854536f2e 100644 --- a/src/app/valentina/core/vformulapropertyeditor.cpp +++ b/src/app/valentina/core/vformulapropertyeditor.cpp @@ -89,7 +89,7 @@ void VFormulaPropertyEditor::SetFormula(const VFormula &formula) //--------------------------------------------------------------------------------------------------------------------- void VFormulaPropertyEditor::onToolButtonClicked() { - QScopedPointer tmpWidget(new DialogEditWrongFormula( + QScopedPointer const tmpWidget(new DialogEditWrongFormula( m_formula.getData(), m_formula.getToolId(), VAbstractValApplication::VApp()->getMainWindow())); tmpWidget->setCheckZero(m_formula.getCheckZero()); tmpWidget->setPostfix(m_formula.getPostfix()); diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.cpp b/src/app/valentina/core/vtooloptionspropertybrowser.cpp index 458d3fb82..73c74b00d 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.cpp +++ b/src/app/valentina/core/vtooloptionspropertybrowser.cpp @@ -807,10 +807,10 @@ void VToolOptionsPropertyBrowser::AddPropertyApproximationScale(const QString &p //--------------------------------------------------------------------------------------------------------------------- void VToolOptionsPropertyBrowser::AddPropertyOpacity(const QString &propertyName, int opacity) { - QMap settings{{QStringLiteral("Min"), 0}, - {QStringLiteral("Max"), 100}, - {QStringLiteral("Step"), 1}, - {QStringLiteral("Suffix"), QChar('%')}}; + QMap const settings{{QStringLiteral("Min"), 0}, + {QStringLiteral("Max"), 100}, + {QStringLiteral("Step"), 1}, + {QStringLiteral("Suffix"), QChar('%')}}; auto *opacityProperty = new VPE::VIntegerProperty(propertyName, settings); opacityProperty->setValue(opacity); @@ -822,7 +822,7 @@ template void VToolOptionsPropertyBrowser::SetName(VPE::VProperty * { if (auto *i = qgraphicsitem_cast(m_currentItem)) { - QString name = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); + QString const name = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); if (name == i->name()) { return; @@ -841,7 +841,7 @@ template void VToolOptionsPropertyBrowser::SetHold(VPE::VProperty * { if (auto *i = qgraphicsitem_cast(m_currentItem)) { - bool hold = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toBool(); + bool const hold = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toBool(); if (hold == i->IsHold()) { return; @@ -860,7 +860,7 @@ template void VToolOptionsPropertyBrowser::SetVisible(VPE::VPropert { if (auto *i = qgraphicsitem_cast(m_currentItem)) { - bool visible = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toBool(); + bool const visible = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toBool(); if (visible == i->IsVisible()) { return; @@ -898,13 +898,13 @@ template void VToolOptionsPropertyBrowser::SetPointName(VPE::VPrope { if (auto *i = qgraphicsitem_cast(m_currentItem)) { - QString name = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); + QString const name = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); if (name == i->name()) { return; } - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); if (name.isEmpty() || not VContainer::IsUnique(name, valentinaNamespace) || not rx.match(name).hasMatch()) { m_idToProperty[AttrName]->setValue(i->name()); @@ -925,13 +925,13 @@ template void VToolOptionsPropertyBrowser::SetPointName1(VPE::VProp { if (auto *i = qgraphicsitem_cast(m_currentItem)) { - QString name = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); + QString const name = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); if (name == i->nameP1()) { return; } - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); if (name.isEmpty() || not VContainer::IsUnique(name, valentinaNamespace) || not rx.match(name).hasMatch()) { m_idToProperty[AttrName1]->setValue(i->nameP1()); @@ -952,13 +952,13 @@ template void VToolOptionsPropertyBrowser::SetPointName2(VPE::VProp { if (auto *i = qgraphicsitem_cast(m_currentItem)) { - QString name = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); + QString const name = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); if (name == i->nameP2()) { return; } - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); if (name.isEmpty() || not VContainer::IsUnique(name, valentinaNamespace) || not rx.match(name).hasMatch()) { m_idToProperty[AttrName2]->setValue(i->nameP2()); @@ -979,7 +979,7 @@ template void VToolOptionsPropertyBrowser::SetOperationSuffix(VPE:: { if (auto *item = qgraphicsitem_cast(m_currentItem)) { - QString suffix = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); + QString const suffix = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); if (suffix == item->Suffix()) { @@ -992,7 +992,7 @@ template void VToolOptionsPropertyBrowser::SetOperationSuffix(VPE:: return; } - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); const QStringList uniqueNames = VContainer::AllUniqueNames(valentinaNamespace); for (const auto &uniqueName : uniqueNames) { @@ -1114,7 +1114,7 @@ template void VToolOptionsPropertyBrowser::SetNotes(VPE::VProperty { if (auto *i = qgraphicsitem_cast(m_currentItem)) { - QString notes = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); + QString const notes = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); if (notes == i->GetNotes()) { return; @@ -1133,7 +1133,7 @@ template void VToolOptionsPropertyBrowser::SetAlias(VPE::VProperty { if (auto *i = qgraphicsitem_cast(m_currentItem)) { - QString notes = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); + QString const notes = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); if (notes == i->GetAliasSuffix()) { return; @@ -1152,7 +1152,7 @@ template void VToolOptionsPropertyBrowser::SetAlias1(VPE::VProperty { if (auto *i = qgraphicsitem_cast(m_currentItem)) { - QString notes = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); + QString const notes = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); if (notes == i->GetAliasSuffix1()) { return; @@ -1171,7 +1171,7 @@ template void VToolOptionsPropertyBrowser::SetAlias2(VPE::VProperty { if (auto *i = qgraphicsitem_cast(m_currentItem)) { - QString notes = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); + QString const notes = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); if (notes == i->GetAliasSuffix2()) { return; @@ -1190,7 +1190,7 @@ template void VToolOptionsPropertyBrowser::SetLineType(VPE::VProper { if (auto *i = qgraphicsitem_cast(m_currentItem)) { - QString type = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); + QString const type = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); if (type == i->getLineType()) { return; @@ -1209,7 +1209,7 @@ template void VToolOptionsPropertyBrowser::SetLineColor(VPE::VPrope { if (auto *i = qgraphicsitem_cast(m_currentItem)) { - QString color = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); + QString const color = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); if (color == i->GetLineColor()) { return; @@ -1323,7 +1323,7 @@ template void VToolOptionsPropertyBrowser::SetPenStyle(VPE::VProper { if (auto *i = qgraphicsitem_cast(m_currentItem)) { - QString pen = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); + QString const pen = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString(); if (pen == i->GetPenStyle()) { return; @@ -1361,7 +1361,7 @@ template void VToolOptionsPropertyBrowser::SetApproximationScale(VP { if (auto *i = qgraphicsitem_cast(m_currentItem)) { - double scale = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toDouble(); + double const scale = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toDouble(); if (VFuzzyComparePossibleNulls(scale, i->GetApproximationScale())) { return; @@ -1394,7 +1394,7 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSinglePoint(VPE::VProperty *prop { if (auto *i = qgraphicsitem_cast(m_currentItem)) { - QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole); + QVariant const value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole); i->SetBasePointPos(value.toPointF()); } else @@ -1831,7 +1831,7 @@ void VToolOptionsPropertyBrowser::ChangeDataToolNormal(VPE::VProperty *property) { if (auto *i = qgraphicsitem_cast(m_currentItem)) { - double value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toDouble(); + double const value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toDouble(); if (VFuzzyComparePossibleNulls(value, i->GetAngle())) { return; @@ -2183,7 +2183,7 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSpline(VPE::VProperty *property) { SCASSERT(property != nullptr) - QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole); + QVariant const value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole); const QString id = m_propertyToId[property]; auto *i = qgraphicsitem_cast(m_currentItem); @@ -2318,7 +2318,7 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSplinePath(VPE::VProperty *prope auto *i = qgraphicsitem_cast(m_currentItem); SCASSERT(i != nullptr) - QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole); + QVariant const value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole); VSplinePath spl = i->getSplinePath(); spl.SetApproximationScale(value.toDouble()); i->setSplinePath(spl); @@ -2359,7 +2359,7 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCubicBezierPath(VPE::VProperty * auto *i = qgraphicsitem_cast(m_currentItem); SCASSERT(i != nullptr) - QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole); + QVariant const value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole); VCubicBezierPath spl = i->getSplinePath(); spl.SetApproximationScale(value.toDouble()); i->setSplinePath(spl); @@ -2741,7 +2741,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolEndLine(QGraphicsItem *item) i->ShowVisualization(true); m_formView->setTitle(tr("Point at distance and angle")); - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); AddPropertyObjectName(i, tr("Point label:")); AddPropertyParentPointName(i->BasePointName(), tr("Base point:"), AttrBasePoint); @@ -2760,7 +2760,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolAlongLine(QGraphicsItem *item) i->ShowVisualization(true); m_formView->setTitle(tr("Point at distance along line")); - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); AddPropertyObjectName(i, tr("Point label:")); AddPropertyParentPointName(i->BasePointName(), tr("First point:"), AttrBasePoint); @@ -2779,7 +2779,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolArc(QGraphicsItem *item) i->ShowVisualization(true); m_formView->setTitle(tr("Arc")); - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); AddPropertyObjectName(i, tr("Name:"), true); AddPropertyParentPointName(i->CenterPointName(), tr("Center point:"), AttrCenter); @@ -2802,7 +2802,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolArcWithLength(QGraphicsItem *it i->ShowVisualization(true); m_formView->setTitle(tr("Arc with given length")); - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); AddPropertyObjectName(i, tr("Name:"), true); AddPropertyParentPointName(i->CenterPointName(), tr("Center point:"), AttrCenter); @@ -2825,7 +2825,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolBisector(QGraphicsItem *item) i->ShowVisualization(true); m_formView->setTitle(tr("Point along bisector")); - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); AddPropertyObjectName(i, tr("Point label:")); AddPropertyParentPointName(i->FirstPointName(), tr("First point:"), AttrFirstPoint); @@ -2907,7 +2907,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolHeight(QGraphicsItem *item) i->ShowVisualization(true); m_formView->setTitle(tr("Perpendicular point along line")); - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); AddPropertyObjectName(i, tr("Point label:")); AddPropertyParentPointName(i->BasePointName(), tr("Base point:"), AttrBasePoint); @@ -2926,7 +2926,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolLine(QGraphicsItem *item) i->ShowVisualization(true); m_formView->setTitle(tr("Line between points")); - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); AddPropertyParentPointName(i->FirstPointName(), tr("First point:"), AttrFirstPoint); AddPropertyParentPointName(i->SecondPointName(), tr("Second point:"), AttrSecondPoint); @@ -2960,7 +2960,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolNormal(QGraphicsItem *item) i->ShowVisualization(true); m_formView->setTitle(tr("Point along perpendicular")); - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); AddPropertyFormula(tr("Length:"), i->GetFormulaLength(), AttrLength); AddPropertyObjectName(i, tr("Point label:")); @@ -3089,7 +3089,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolShoulderPoint(QGraphicsItem *it i->ShowVisualization(true); m_formView->setTitle(tr("Special point on shoulder")); - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); AddPropertyObjectName(i, tr("Point label:")); AddPropertyParentPointName(i->BasePointName(), tr("First point:"), AttrBasePoint); @@ -3137,7 +3137,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item) length2.Eval(); AddPropertyFormula(tr("C2: length:"), length2, AttrLength2); - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); AddPropertyAlias(i, tr("Alias:")); AddPropertyCurvePenStyle( @@ -3155,7 +3155,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCubicBezier(QGraphicsItem *item i->ShowVisualization(true); m_formView->setTitle(tr("Cubic bezier curve")); - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); AddPropertyObjectName(i, tr("Name:"), true); AddPropertyParentPointName(i->FirstPointName(), tr("First point:"), AttrPoint1); @@ -3178,7 +3178,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSplinePath(QGraphicsItem *item) i->ShowVisualization(true); m_formView->setTitle(tr("Tool for path curve")); - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); AddPropertyObjectName(i, tr("Name:"), true); AddPropertyAlias(i, tr("Alias:")); @@ -3197,7 +3197,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCubicBezierPath(QGraphicsItem * i->ShowVisualization(true); m_formView->setTitle(tr("Tool cubic bezier curve")); - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); AddPropertyObjectName(i, tr("Name:"), true); AddPropertyAlias(i, tr("Alias:")); @@ -3231,7 +3231,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolLineIntersectAxis(QGraphicsItem i->ShowVisualization(true); m_formView->setTitle(tr("Point intersection line and axis")); - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); AddPropertyObjectName(i, tr("Point label:")); AddPropertyParentPointName(i->BasePointName(), tr("Axis point:"), AttrBasePoint); @@ -3251,7 +3251,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCurveIntersectAxis(QGraphicsIte i->ShowVisualization(true); m_formView->setTitle(tr("Point intersection curve and axis")); - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); AddPropertyObjectName(i, tr("Point label:")); AddPropertyParentPointName(i->BasePointName(), tr("Axis point:"), AttrBasePoint); @@ -3377,7 +3377,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolEndLine() m_idToProperty[AttrName]->setValue(i->name()); { - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); const auto index = VPE::VLineTypeProperty::IndexOfStyle( LineStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)), i->getLineType()); @@ -3411,7 +3411,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolAlongLine() m_idToProperty[AttrName]->setValue(i->name()); { - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); const auto index = VPE::VLineTypeProperty::IndexOfStyle( LineStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)), i->getLineType()); @@ -3458,7 +3458,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolArc() m_idToProperty[AttrAngle2]->setValue(valueSecondAngle); { - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); const auto index = VPE::VLineTypeProperty::IndexOfStyle( CurvePenStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)), i->GetPenStyle()); @@ -3503,7 +3503,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolArcWithLength() m_idToProperty[AttrLength]->setValue(valueLength); { - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); const auto index = VPE::VLineTypeProperty::IndexOfStyle( CurvePenStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)), i->GetPenStyle()); @@ -3540,7 +3540,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolBisector() m_idToProperty[AttrLength]->setValue(valueFormula); { - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); const auto index = VPE::VLineTypeProperty::IndexOfStyle( LineStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)), i->getLineType()); @@ -3669,7 +3669,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolHeight() m_idToProperty[AttrName]->setValue(i->name()); { - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); const auto index = VPE::VLineTypeProperty::IndexOfStyle( LineStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)), i->getLineType()); @@ -3702,7 +3702,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolLine() auto *i = qgraphicsitem_cast(m_currentItem); { - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); const auto index = VPE::VLineTypeProperty::IndexOfStyle( LineStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)), i->getLineType()); @@ -3765,7 +3765,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolNormal() m_idToProperty[AttrAngle]->setValue(i->GetAngle()); { - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); const auto index = VPE::VLineTypeProperty::IndexOfStyle( LineStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)), i->getLineType()); @@ -3952,7 +3952,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolShoulderPoint() m_idToProperty[AttrName]->setValue(i->name()); { - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); const auto index = VPE::VLineTypeProperty::IndexOfStyle( LineStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)), i->getLineType()); @@ -4020,7 +4020,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline() m_idToProperty[AttrLength2]->setValue(length2); { - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); const auto index = VPE::VLineTypeProperty::IndexOfStyle( CurvePenStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)), i->GetPenStyle()); @@ -4047,7 +4047,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezier() m_idToProperty[AttrName]->setValue(i->name()); { - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); const auto index = VPE::VLineTypeProperty::IndexOfStyle( CurvePenStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)), i->GetPenStyle()); @@ -4090,7 +4090,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSplinePath() m_idToProperty[AttrName]->setValue(i->name()); { - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); const auto index = VPE::VLineTypeProperty::IndexOfStyle( CurvePenStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)), i->GetPenStyle()); @@ -4117,7 +4117,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezierPath() m_idToProperty[AttrName]->setValue(i->name()); { - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); const auto index = VPE::VLineTypeProperty::IndexOfStyle( CurvePenStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)), i->GetPenStyle()); @@ -4169,7 +4169,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolLineIntersectAxis() m_idToProperty[AttrName]->setValue(i->name()); { - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); const auto index = VPE::VLineTypeProperty::IndexOfStyle( LineStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)), i->getLineType()); @@ -4207,7 +4207,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCurveIntersectAxis() m_idToProperty[AttrName]->setValue(i->name()); { - QPalette comboBoxPalette = ComboBoxPalette(); + QPalette const comboBoxPalette = ComboBoxPalette(); const auto index = VPE::VLineTypeProperty::IndexOfStyle( LineStylesPics(comboBoxPalette.color(QPalette::Base), comboBoxPalette.color(QPalette::Text)), i->getLineType()); @@ -4375,7 +4375,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsBackgroundSVGItem() //--------------------------------------------------------------------------------------------------------------------- auto VToolOptionsPropertyBrowser::PropertiesList() -> QStringList { - static QStringList attr{ + static QStringList const attr{ AttrName, /* 0 */ "position"_L1, /* 1 */ AttrBasePoint, /* 2 */ diff --git a/src/app/valentina/dialogs/configpages/preferencespathpage.cpp b/src/app/valentina/dialogs/configpages/preferencespathpage.cpp index 830a4370c..265e388d0 100644 --- a/src/app/valentina/dialogs/configpages/preferencespathpage.cpp +++ b/src/app/valentina/dialogs/configpages/preferencespathpage.cpp @@ -139,7 +139,7 @@ void PreferencesPathPage::EditPath() } bool usedNotExistedDir = false; - QDir directory(path); + QDir const directory(path); if (not directory.exists()) { usedNotExistedDir = directory.mkpath(QChar('.')); diff --git a/src/app/valentina/dialogs/configpages/preferencespatternpage.cpp b/src/app/valentina/dialogs/configpages/preferencespatternpage.cpp index a80a746fb..e587d1ea0 100644 --- a/src/app/valentina/dialogs/configpages/preferencespatternpage.cpp +++ b/src/app/valentina/dialogs/configpages/preferencespatternpage.cpp @@ -134,7 +134,7 @@ PreferencesPatternPage::PreferencesPatternPage(QWidget *parent) ui->checkBoxHideMainPath->setChecked(settings->IsHideMainPath()); QFont labelFont = settings->GetLabelFont(); - int pointSize = settings->GetPieceLabelFontPointSize(); + int const pointSize = settings->GetPieceLabelFontPointSize(); labelFont.setPointSize(qMax(pointSize, 1)); ui->fontComboBoxLabelFont->setCurrentFont(labelFont); @@ -268,7 +268,7 @@ void PreferencesPatternPage::changeEvent(QEvent *event) if (event->type() == QEvent::PaletteChange) { - QString currentSingleLineFont = ui->comboBoxSingleLineFont->currentData().toString(); + QString const currentSingleLineFont = ui->comboBoxSingleLineFont->currentData().toString(); InitSingleLineFonts(); const qint32 indexFont = ui->comboBoxSingleLineFont->findData(currentSingleLineFont); if (indexFont != -1) @@ -353,8 +353,8 @@ void PreferencesPatternPage::InitSingleLineFonts() const qreal dpiY = primaryScreen->physicalDotsPerInchY(); const qreal scale = primaryScreen->devicePixelRatio(); - int previewWidth = 250; - int previewHeight = QFontMetrics(QGuiApplication::font()).height(); + int const previewWidth = 250; + int const previewHeight = QFontMetrics(QGuiApplication::font()).height(); // Calculate the desired image size in physical pixels const int desiredWidthInPixels = qRound(previewWidth * dpiX / 96.0); @@ -379,7 +379,7 @@ void PreferencesPatternPage::InitSingleLineFonts() { VSvgFontEngine engine = db->FontEngine(family, SVGFontStyle::Normal, SVGFontWeight::Normal); - VSvgFont svgFont = engine.Font(); + VSvgFont const svgFont = engine.Font(); if (!svgFont.IsValid()) { continue; @@ -412,7 +412,7 @@ void PreferencesPatternPage::InitComboBoxFormats(QComboBox *box, const QStringLi SCASSERT(box != nullptr) box->addItems(items); - int index = box->findText(currentFormat); + int const index = box->findText(currentFormat); if (index != -1) { box->setCurrentIndex(index); @@ -456,7 +456,7 @@ void PreferencesPatternPage::CallDateTimeFormatEditor(const T &type, const QStri box->clear(); box->addItems(dialog.GetFormats()); - int index = box->findText(currentFormat); + int const index = box->findText(currentFormat); if (index != -1) { box->setCurrentIndex(index); diff --git a/src/app/valentina/dialogs/dialogaboutapp.cpp b/src/app/valentina/dialogs/dialogaboutapp.cpp index 9a14ff4e8..ab638bae4 100644 --- a/src/app/valentina/dialogs/dialogaboutapp.cpp +++ b/src/app/valentina/dialogs/dialogaboutapp.cpp @@ -56,7 +56,7 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) ui->labelBuildRevision->setText(QStringLiteral("Build revision: %1").arg(QStringLiteral(BUILD_REVISION))); ui->label_QT_Version->setText(buildCompatibilityString()); - QDate date = QLocale::c().toDate(QStringLiteral(__DATE__).simplified(), QStringLiteral("MMM d yyyy")); + QDate const date = QLocale::c().toDate(QStringLiteral(__DATE__).simplified(), QStringLiteral("MMM d yyyy")); ui->label_Valentina_Built->setText(tr("Built on %1 at %2").arg(date.toString(), QStringLiteral(__TIME__))); ui->label_Legal_Stuff->setText(QApplication::translate("InternalStrings", diff --git a/src/app/valentina/dialogs/dialogfinalmeasurements.cpp b/src/app/valentina/dialogs/dialogfinalmeasurements.cpp index 23d9b3d39..1f6f056e2 100644 --- a/src/app/valentina/dialogs/dialogfinalmeasurements.cpp +++ b/src/app/valentina/dialogs/dialogfinalmeasurements.cpp @@ -388,7 +388,7 @@ void DialogFinalMeasurements::SaveFormula() } // Replace line return character with spaces for calc if exist - QString text = ui->plainTextEditFormula->toPlainText(); + QString const text = ui->plainTextEditFormula->toPlainText(); QTableWidgetItem *formulaField = ui->tableWidget->item(row, 2); if (formulaField->text() == text) @@ -472,7 +472,7 @@ void DialogFinalMeasurements::Fx() return; } - QScopedPointer dialog(new DialogEditWrongFormula(&m_data, NULL_ID, this)); + QScopedPointer const dialog(new DialogEditWrongFormula(&m_data, NULL_ID, this)); dialog->setWindowTitle(tr("Edit measurement")); dialog->SetFormula(VTranslateVars::TryFormulaFromUser(ui->plainTextEditFormula->toPlainText(), VAbstractApplication::VApp()->Settings()->GetOsSeparator())); @@ -610,7 +610,7 @@ auto DialogFinalMeasurements::EvalUserFormula(const QString &formula, bool fromU { f = formula; } - QScopedPointer cal(new Calculator()); + QScopedPointer const cal(new Calculator()); const qreal result = cal->EvalFormula(m_data.DataVariables(), f); if (qIsInf(result) || qIsNaN(result)) @@ -708,7 +708,7 @@ void DialogFinalMeasurements::EnableDetails(bool enabled) //--------------------------------------------------------------------------------------------------------------------- void DialogFinalMeasurements::UpdateTree() { - int row = ui->tableWidget->currentRow(); + int const row = ui->tableWidget->currentRow(); FillFinalMeasurements(); ui->tableWidget->blockSignals(true); ui->tableWidget->selectRow(row); @@ -730,7 +730,7 @@ auto DialogFinalMeasurements::EvalFormula(const QString &formula, bool &ok) -> q try { // Replace line return character with spaces for calc if exist - QScopedPointer cal(new Calculator()); + QScopedPointer const cal(new Calculator()); result = cal->EvalFormula(m_data.DataVariables(), formula); if (qIsInf(result) || qIsNaN(result)) @@ -882,7 +882,7 @@ void DialogFinalMeasurements::InitSearch() //--------------------------------------------------------------------------------------------------------------------- void DialogFinalMeasurements::InitSearchHistory() { - QStringList searchHistory = + QStringList const searchHistory = VAbstractValApplication::VApp()->ValentinaSettings()->GetFinalMeasurementsSearchHistory(); m_searchHistory->clear(); @@ -903,7 +903,7 @@ void DialogFinalMeasurements::InitSearchHistory() auto *action = qobject_cast(sender()); if (action != nullptr) { - QString term = action->data().toString(); + QString const term = action->data().toString(); ui->lineEditFind->setText(term); m_search->Find(term); ui->lineEditFind->setFocus(); @@ -917,7 +917,7 @@ void DialogFinalMeasurements::SaveSearchRequest() { QStringList searchHistory = VAbstractValApplication::VApp()->ValentinaSettings()->GetFinalMeasurementsSearchHistory(); - QString term = ui->lineEditFind->text(); + QString const term = ui->lineEditFind->text(); if (term.isEmpty()) { return; @@ -944,7 +944,7 @@ void DialogFinalMeasurements::UpdateSearchControlsTooltips() } else if (m_serachButtonTooltips.contains(button)) { - QString tooltip = m_serachButtonTooltips.value(button); + QString const tooltip = m_serachButtonTooltips.value(button); button->setToolTip(tooltip.arg(button->shortcut().toString(QKeySequence::NativeText))); } }; @@ -961,7 +961,7 @@ void DialogFinalMeasurements::UpdateSearchControlsTooltips() //--------------------------------------------------------------------------------------------------------------------- void DialogFinalMeasurements::InitIcons() { - QString resource = QStringLiteral("icon"); + QString const resource = QStringLiteral("icon"); ui->toolButtonExpr->setIcon(VTheme::GetIconResource(resource, QStringLiteral("24x24/fx.png"))); } diff --git a/src/app/valentina/dialogs/dialoghistory.cpp b/src/app/valentina/dialogs/dialoghistory.cpp index f8f99c862..67edc0ca5 100644 --- a/src/app/valentina/dialogs/dialoghistory.cpp +++ b/src/app/valentina/dialogs/dialoghistory.cpp @@ -202,15 +202,15 @@ void DialogHistory::UpdateHistory() void DialogHistory::FillTable() { ui->tableWidget->clear(); - QVector history = m_doc->getLocalHistory(); + QVector const history = m_doc->getLocalHistory(); qint32 currentRow = -1; qint32 count = 0; ui->tableWidget->setRowCount(static_cast(history.size())); // Make row count max possible number - std::function CreateRecord = [this](const VToolRecord &tool) + std::function const CreateRecord = [this](const VToolRecord &tool) { return Record(tool); }; - QVector historyRecords = QtConcurrent::blockingMapped(history, CreateRecord); + QVector const historyRecords = QtConcurrent::blockingMapped(history, CreateRecord); for (auto &record : historyRecords) { @@ -259,7 +259,7 @@ auto DialogHistory::Record(const VToolRecord &tool) const -> HistoryRecord HistoryRecord record; record.id = tool.getId(); - bool updateCache = false; + bool const updateCache = false; const QDomElement domElem = m_doc->elementById(tool.getId(), QString(), updateCache); if (not domElem.isElement()) { @@ -599,7 +599,7 @@ void DialogHistory::UpdateShortcuts() //--------------------------------------------------------------------------------------------------------------------- void DialogHistory::RetranslateUi() { - qint32 currentRow = m_cursorRow; + qint32 const currentRow = m_cursorRow; UpdateHistory(); QTableWidgetItem *item = ui->tableWidget->item(m_cursorRow, 0); @@ -766,7 +766,7 @@ void DialogHistory::InitSearch() //--------------------------------------------------------------------------------------------------------------------- void DialogHistory::InitSearchHistory() { - QStringList searchHistory = VAbstractValApplication::VApp()->ValentinaSettings()->GetHistorySearchHistory(); + QStringList const searchHistory = VAbstractValApplication::VApp()->ValentinaSettings()->GetHistorySearchHistory(); m_searchHistory->clear(); if (searchHistory.isEmpty()) @@ -786,7 +786,7 @@ void DialogHistory::InitSearchHistory() auto *action = qobject_cast(sender()); if (action != nullptr) { - QString term = action->data().toString(); + QString const term = action->data().toString(); ui->lineEditFind->setText(term); m_search->Find(term); ui->lineEditFind->setFocus(); @@ -799,7 +799,7 @@ void DialogHistory::InitSearchHistory() void DialogHistory::SaveSearchRequest() { QStringList searchHistory = VAbstractValApplication::VApp()->ValentinaSettings()->GetHistorySearchHistory(); - QString term = ui->lineEditFind->text(); + QString const term = ui->lineEditFind->text(); if (term.isEmpty()) { return; @@ -826,7 +826,7 @@ void DialogHistory::UpdateSearchControlsTooltips() } else if (m_serachButtonTooltips.contains(button)) { - QString tooltip = m_serachButtonTooltips.value(button); + QString const tooltip = m_serachButtonTooltips.value(button); button->setToolTip(tooltip.arg(button->shortcut().toString(QKeySequence::NativeText))); } }; diff --git a/src/app/valentina/dialogs/dialogincrements.cpp b/src/app/valentina/dialogs/dialogincrements.cpp index ed081a0c2..872fdc858 100644 --- a/src/app/valentina/dialogs/dialogincrements.cpp +++ b/src/app/valentina/dialogs/dialogincrements.cpp @@ -231,7 +231,7 @@ template void DialogIncrements::FillTable(const QMap &v while (i.hasNext()) { i.next(); - qreal length = *i.value()->GetValue(); + qreal const length = *i.value()->GetValue(); currentRow++; table->setRowCount(static_cast(varTable.size())); @@ -421,7 +421,7 @@ auto DialogIncrements::EvalIncrementFormula(const QString &formula, bool fromUse { f = formula; } - QScopedPointer cal(new Calculator()); + QScopedPointer const cal(new Calculator()); const qreal result = cal->EvalFormula(data->DataVariables(), f); if (qIsInf(result) || qIsNaN(result)) @@ -627,7 +627,7 @@ void DialogIncrements::EnableDetails(QTableWidget *table, bool enabled) { const QTableWidgetItem *nameField = table->item(table->currentRow(), 0); SCASSERT(nameField != nullptr) - QSharedPointer incr = m_data->GetVariable(nameField->text()); + QSharedPointer const incr = m_data->GetVariable(nameField->text()); const bool isSeparator = incr->GetIncrementType() == IncrementType::Separator; if (table == ui->tableWidgetIncrement) @@ -696,7 +696,7 @@ auto DialogIncrements::IncrementUsed(const QString &name) const -> bool // Eval formula try { - QScopedPointer cal( + QScopedPointer const cal( new qmu::QmuTokenParser(field.expression, false, false)); // Tokens (variables, measurements) @@ -793,8 +793,8 @@ void DialogIncrements::ShowTableIncrementDetails(QTableWidget *table) EvalIncrementFormula(incr->GetFormula(), false, incr->GetData(), labelCalculatedValue, incr->IsSpecialUnits()); plainTextEditFormula->blockSignals(true); - QString formula = VTranslateVars::TryFormulaToUser(incr->GetFormula(), - VAbstractApplication::VApp()->Settings()->GetOsSeparator()); + QString const formula = VTranslateVars::TryFormulaToUser( + incr->GetFormula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()); plainTextEditFormula->setPlainText(formula); plainTextEditFormula->blockSignals(false); @@ -1126,7 +1126,8 @@ void DialogIncrements::InitSearch() //--------------------------------------------------------------------------------------------------------------------- void DialogIncrements::InitIncrementsSearchHistory() { - QStringList searchHistory = VAbstractValApplication::VApp()->ValentinaSettings()->GetIncrementsSearchHistory(); + QStringList const searchHistory = + VAbstractValApplication::VApp()->ValentinaSettings()->GetIncrementsSearchHistory(); m_searchHistory->clear(); if (searchHistory.isEmpty()) @@ -1146,7 +1147,7 @@ void DialogIncrements::InitIncrementsSearchHistory() auto *action = qobject_cast(sender()); if (action != nullptr) { - QString term = action->data().toString(); + QString const term = action->data().toString(); ui->lineEditFind->setText(term); m_search->Find(term); ui->lineEditFind->setFocus(); @@ -1158,7 +1159,7 @@ void DialogIncrements::InitIncrementsSearchHistory() //--------------------------------------------------------------------------------------------------------------------- void DialogIncrements::InitPreviewCalculationsSearchHistory() { - QStringList searchHistory = + QStringList const searchHistory = VAbstractValApplication::VApp()->ValentinaSettings()->GetPreviewCalculationsSearchHistory(); m_searchHistoryPC->clear(); @@ -1179,7 +1180,7 @@ void DialogIncrements::InitPreviewCalculationsSearchHistory() auto *action = qobject_cast(sender()); if (action != nullptr) { - QString term = action->data().toString(); + QString const term = action->data().toString(); ui->lineEditFindPC->setText(term); m_searchPC->Find(term); ui->lineEditFindPC->setFocus(); @@ -1192,7 +1193,7 @@ void DialogIncrements::InitPreviewCalculationsSearchHistory() void DialogIncrements::SaveIncrementsSearchRequest() { QStringList searchHistory = VAbstractValApplication::VApp()->ValentinaSettings()->GetIncrementsSearchHistory(); - QString term = ui->lineEditFind->text(); + QString const term = ui->lineEditFind->text(); if (term.isEmpty()) { return; @@ -1212,7 +1213,7 @@ void DialogIncrements::SavePreviewCalculationsSearchRequest() { QStringList searchHistory = VAbstractValApplication::VApp()->ValentinaSettings()->GetPreviewCalculationsSearchHistory(); - QString term = ui->lineEditFindPC->text(); + QString const term = ui->lineEditFindPC->text(); if (term.isEmpty()) { return; @@ -1239,7 +1240,7 @@ void DialogIncrements::UpdateSearchControlsTooltips() } else if (m_serachButtonTooltips.contains(button)) { - QString tooltip = m_serachButtonTooltips.value(button); + QString const tooltip = m_serachButtonTooltips.value(button); button->setToolTip(tooltip.arg(button->shortcut().toString(QKeySequence::NativeText))); } }; @@ -1295,7 +1296,7 @@ void DialogIncrements::InitIncrementUnits(QComboBox *combo) combo->addItem(units, QVariant(static_cast(IncrUnits::Pattern))); combo->addItem(tr("Degrees"), QVariant(static_cast(IncrUnits::Degrees))); - int i = combo->findData(current); + int const i = combo->findData(current); if (i != -1) { combo->setCurrentIndex(i); @@ -1430,7 +1431,7 @@ void DialogIncrements::FillIncrementsTable(QTableWidget *table, } AddCell(table, calculatedValue, currentRow, 1, Qt::AlignCenter, incr->IsFormulaOk()); // calculated value - QString formula = VTranslateVars::TryFormulaToUser( + QString const formula = VTranslateVars::TryFormulaToUser( incr->GetFormula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()); AddCell(table, formula, currentRow, 2, Qt::AlignVCenter); // formula @@ -1783,8 +1784,8 @@ void DialogIncrements::SaveIncrFormula() const QTableWidgetItem *nameField = table->item(row, 0); - QString text = textEdit->toPlainText(); - QSharedPointer incr = m_data->GetVariable(nameField->text()); + QString const text = textEdit->toPlainText(); + QSharedPointer const incr = m_data->GetVariable(nameField->text()); QTableWidgetItem *formulaField = table->item(row, 2); if (formulaField->text() == text) @@ -1941,9 +1942,9 @@ void DialogIncrements::Fx() } const QTableWidgetItem *nameField = table->item(row, 0); - QSharedPointer incr = m_data->GetVariable(nameField->text()); + QSharedPointer const incr = m_data->GetVariable(nameField->text()); - QScopedPointer dialog(new DialogEditWrongFormula(incr->GetData(), NULL_ID, this)); + QScopedPointer const dialog(new DialogEditWrongFormula(incr->GetData(), NULL_ID, this)); dialog->setWindowTitle(tr("Edit increment")); incrementMode ? dialog->SetIncrementsMode() : dialog->SetPreviewCalculationsMode(); diff --git a/src/app/valentina/dialogs/dialoglayoutsettings.cpp b/src/app/valentina/dialogs/dialoglayoutsettings.cpp index c7750d059..a30e38655 100644 --- a/src/app/valentina/dialogs/dialoglayoutsettings.cpp +++ b/src/app/valentina/dialogs/dialoglayoutsettings.cpp @@ -519,7 +519,7 @@ void DialogLayoutSettings::ConvertPaperSize() //--------------------------------------------------------------------------------------------------------------------- auto DialogLayoutSettings::SelectPaperUnit(const QString &units) -> bool { - qint32 indexUnit = ui->comboBoxPaperSizeUnit->findData(units); + qint32 const indexUnit = ui->comboBoxPaperSizeUnit->findData(units); if (indexUnit != -1) { ui->comboBoxPaperSizeUnit->setCurrentIndex(indexUnit); @@ -530,7 +530,7 @@ auto DialogLayoutSettings::SelectPaperUnit(const QString &units) -> bool //--------------------------------------------------------------------------------------------------------------------- auto DialogLayoutSettings::SelectLayoutUnit(const QString &units) -> bool { - qint32 indexUnit = ui->comboBoxLayoutUnit->findData(units); + qint32 const indexUnit = ui->comboBoxLayoutUnit->findData(units); if (indexUnit != -1) { ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit); @@ -632,7 +632,7 @@ void DialogLayoutSettings::PaperSizeChanged() //--------------------------------------------------------------------------------------------------------------------- auto DialogLayoutSettings::SelectTemplate(const PaperSizeTemplate &id) -> bool { - int index = ui->comboBoxTemplates->findData(static_cast(id)); + int const index = ui->comboBoxTemplates->findData(static_cast(id)); if (index > -1) { ui->comboBoxTemplates->setCurrentIndex(index); @@ -689,7 +689,7 @@ void DialogLayoutSettings::DialogAccepted() } else { - QPrinterInfo printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText()); + QPrinterInfo const printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText()); if (printer.isNull()) { m_generator->SetPrinterFields(true, GetFields()); @@ -764,7 +764,7 @@ void DialogLayoutSettings::RestoreDefaults() //--------------------------------------------------------------------------------------------------------------------- void DialogLayoutSettings::PrinterMargins() { - QPrinterInfo printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText()); + QPrinterInfo const printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText()); if (not printer.isNull()) { SetFields(GetPrinterFields(QSharedPointer(new QPrinter(printer)))); @@ -958,7 +958,7 @@ auto DialogLayoutSettings::GetTemplateSize(const PaperSizeTemplate &tmpl, const //--------------------------------------------------------------------------------------------------------------------- auto DialogLayoutSettings::MinPrinterFields() const -> QMarginsF { - QPrinterInfo printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText()); + QPrinterInfo const printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText()); if (not printer.isNull()) { return GetMinPrinterFields(QSharedPointer(new QPrinter(printer))); @@ -970,7 +970,7 @@ auto DialogLayoutSettings::MinPrinterFields() const -> QMarginsF //--------------------------------------------------------------------------------------------------------------------- auto DialogLayoutSettings::GetDefPrinterFields() const -> QMarginsF { - QPrinterInfo printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText()); + QPrinterInfo const printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText()); if (not printer.isNull()) { return GetPrinterFields(QSharedPointer(new QPrinter(printer))); diff --git a/src/app/valentina/dialogs/dialogpatternproperties.cpp b/src/app/valentina/dialogs/dialogpatternproperties.cpp index 1b6ed3cfd..77aaa5ef9 100644 --- a/src/app/valentina/dialogs/dialogpatternproperties.cpp +++ b/src/app/valentina/dialogs/dialogpatternproperties.cpp @@ -101,7 +101,7 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *patt ui->comboBoxLabelLanguage->addItem(QLocale(name).nativeLanguageName(), name); } - int index = + int const index = ui->comboBoxLabelLanguage->findData(VAbstractValApplication::VApp()->ValentinaSettings()->GetLabelLanguage()); if (index != -1) { @@ -329,7 +329,7 @@ void DialogPatternProperties::ValidatePassmarkLength() const QPalette palette = ui->lineEditPassmarkLength->palette(); const QPalette::ColorRole foregroundRole = ui->lineEditPassmarkLength->foregroundRole(); - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); if (not text.isEmpty()) { palette.setColor(foregroundRole, rx.match(text).hasMatch() && m_variables.contains(text) @@ -351,7 +351,7 @@ void DialogPatternProperties::ValidatePassmarkWidth() const QPalette palette = ui->lineEditPassmarkWidth->palette(); const QPalette::ColorRole foregroundRole = ui->lineEditPassmarkWidth->foregroundRole(); - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); if (not text.isEmpty()) { palette.setColor(foregroundRole, rx.match(text).hasMatch() && m_variables.contains(text) @@ -405,7 +405,7 @@ void DialogPatternProperties::InitImage() const VPatternImage image = m_doc->GetImage(); if (image.IsValid()) { - QPixmap pixImage = image.GetPixmap(); + QPixmap const pixImage = image.GetPixmap(); ui->imageLabel->setPixmap( pixImage.scaled(ui->imageLabel->width(), ui->imageLabel->height(), Qt::KeepAspectRatio)); } @@ -432,7 +432,7 @@ void DialogPatternProperties::ChangeImage() settings->SetPathCustomImage(QFileInfo(fileName).absolutePath()); } - VPatternImage image = VPatternImage::FromFile(fileName); + VPatternImage const image = VPatternImage::FromFile(fileName); if (not image.IsValid()) { @@ -442,7 +442,7 @@ void DialogPatternProperties::ChangeImage() m_doc->SetImage(image); - QPixmap pixImage = image.GetPixmap(); + QPixmap const pixImage = image.GetPixmap(); ui->imageLabel->setPixmap( pixImage.scaled(ui->imageLabel->width(), ui->imageLabel->height(), Qt::KeepAspectRatio)); @@ -465,18 +465,18 @@ void DialogPatternProperties::SaveImage() VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings(); - QMimeType mime = image.MimeTypeFromData(); + QMimeType const mime = image.MimeTypeFromData(); QString path = settings->GetPathCustomImage() + QDir::separator() + tr("untitled"); - QStringList suffixes = mime.suffixes(); + QStringList const suffixes = mime.suffixes(); if (not suffixes.isEmpty()) { path += '.'_L1 + suffixes.at(0); } - QString filter = mime.filterString(); - QString filename = QFileDialog::getSaveFileName(this, tr("Save Image"), path, filter, nullptr, - VAbstractApplication::VApp()->NativeFileDialog()); + QString const filter = mime.filterString(); + QString const filename = QFileDialog::getSaveFileName(this, tr("Save Image"), path, filter, nullptr, + VAbstractApplication::VApp()->NativeFileDialog()); if (not filename.isEmpty()) { if (QFileInfo::exists(filename)) @@ -507,10 +507,10 @@ void DialogPatternProperties::ShowImage() return; } - QMimeType mime = image.MimeTypeFromData(); + QMimeType const mime = image.MimeTypeFromData(); QString name = QDir::tempPath() + QDir::separator() + QStringLiteral("image.XXXXXX"); - QStringList suffixes = mime.suffixes(); + QStringList const suffixes = mime.suffixes(); if (not suffixes.isEmpty()) { name += '.'_L1 + suffixes.at(0); @@ -541,7 +541,7 @@ void DialogPatternProperties::BrowseLabelPath() path = settings->GetPathLabelTemplate(); } - QString filters(tr("Label template") + "(*.xml)"_L1); + QString const filters(tr("Label template") + "(*.xml)"_L1); const QString filePath = QFileDialog::getOpenFileName(this, tr("Label template"), path, filters, nullptr, VAbstractApplication::VApp()->NativeFileDialog()); diff --git a/src/app/valentina/dialogs/dialogpreferences.cpp b/src/app/valentina/dialogs/dialogpreferences.cpp index caf664922..ef22f4e34 100644 --- a/src/app/valentina/dialogs/dialogpreferences.cpp +++ b/src/app/valentina/dialogs/dialogpreferences.cpp @@ -93,7 +93,7 @@ void DialogPreferences::showEvent(QShowEvent *event) } // do your init stuff here - QSize sz = VAbstractApplication::VApp()->Settings()->GetPreferenceDialogSize(); + QSize const sz = VAbstractApplication::VApp()->Settings()->GetPreferenceDialogSize(); if (not sz.isEmpty()) { resize(sz); @@ -140,7 +140,7 @@ void DialogPreferences::PageChanged(QListWidgetItem *current, QListWidgetItem *p { current = previous; } - int rowIndex = ui->contentsWidget->row(current); + int const rowIndex = ui->contentsWidget->row(current); ui->pagesWidget->setCurrentIndex(rowIndex); } diff --git a/src/app/valentina/dialogs/dialogsavelayout.cpp b/src/app/valentina/dialogs/dialogsavelayout.cpp index 9be9a4730..4c766e687 100644 --- a/src/app/valentina/dialogs/dialogsavelayout.cpp +++ b/src/app/valentina/dialogs/dialogsavelayout.cpp @@ -375,7 +375,7 @@ void DialogSaveLayout::Save() Path() + '/' + FileName() + QString::number(i + 1) + VLayoutExporter::ExportFormatSuffix(Format()); if (QFile::exists(name)) { - QMessageBox::StandardButton res = QMessageBox::question( + QMessageBox::StandardButton const res = QMessageBox::question( this, tr("Name conflict"), tr("Folder already contain file with name %1. Rewrite all conflict file names?").arg(name), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); @@ -570,8 +570,8 @@ void DialogSaveLayout::SetTiledMargins(QMarginsF margins) //--------------------------------------------------------------------------------------------------------------------- auto DialogSaveLayout::GetTiledMargins() const -> QMarginsF { - QMarginsF margins = QMarginsF(ui->doubleSpinBoxLeftField->value(), ui->doubleSpinBoxTopField->value(), - ui->doubleSpinBoxRightField->value(), ui->doubleSpinBoxBottomField->value()); + QMarginsF const margins = QMarginsF(ui->doubleSpinBoxLeftField->value(), ui->doubleSpinBoxTopField->value(), + ui->doubleSpinBoxRightField->value(), ui->doubleSpinBoxBottomField->value()); return UnitConvertor(margins, VAbstractValApplication::VApp()->patternUnits(), Unit::Mm); } @@ -579,7 +579,7 @@ auto DialogSaveLayout::GetTiledMargins() const -> QMarginsF //--------------------------------------------------------------------------------------------------------------------- void DialogSaveLayout::SetTiledPageFormat(PaperSizeTemplate format) { - int index = ui->comboBoxTemplates->findData(static_cast(format)); + int const index = ui->comboBoxTemplates->findData(static_cast(format)); if (index != -1) { ui->comboBoxTemplates->setCurrentIndex(index); @@ -811,8 +811,8 @@ void DialogSaveLayout::WriteSettings() const const Unit unit = VAbstractValApplication::VApp()->patternUnits(); // write Margins top, right, bottom, left - QMarginsF margins = QMarginsF(ui->doubleSpinBoxLeftField->value(), ui->doubleSpinBoxTopField->value(), - ui->doubleSpinBoxRightField->value(), ui->doubleSpinBoxBottomField->value()); + QMarginsF const margins = QMarginsF(ui->doubleSpinBoxLeftField->value(), ui->doubleSpinBoxTopField->value(), + ui->doubleSpinBoxRightField->value(), ui->doubleSpinBoxBottomField->value()); settings->SetTiledPDFMargins(margins, unit); // write Template diff --git a/src/app/valentina/dialogs/vwidgetbackgroundimages.cpp b/src/app/valentina/dialogs/vwidgetbackgroundimages.cpp index fa54ad82e..f4a8de08a 100644 --- a/src/app/valentina/dialogs/vwidgetbackgroundimages.cpp +++ b/src/app/valentina/dialogs/vwidgetbackgroundimages.cpp @@ -209,13 +209,13 @@ void VWidgetBackgroundImages::UpdateImages() //--------------------------------------------------------------------------------------------------------------------- void VWidgetBackgroundImages::UpdateImage(const QUuid &id) { - int row = ImageRow(id); + int const row = ImageRow(id); if (row == -1) { return; } - VBackgroundPatternImage image = m_doc->GetBackgroundImage(id); + VBackgroundPatternImage const image = m_doc->GetBackgroundImage(id); if (image.IsNull()) { return; @@ -238,7 +238,7 @@ void VWidgetBackgroundImages::UpdateImage(const QUuid &id) //--------------------------------------------------------------------------------------------------------------------- void VWidgetBackgroundImages::ImageSelected(const QUuid &id) { - int row = ImageRow(id); + int const row = ImageRow(id); ui->tableWidget->blockSignals(true); ui->tableWidget->setCurrentCell(row, ImageData::Name); @@ -308,7 +308,7 @@ void VWidgetBackgroundImages::ContextMenu(const QPoint &pos) const int row = item->row(); item = ui->tableWidget->item(row, 0); const QUuid id = item->data(Qt::UserRole).toUuid(); - VBackgroundPatternImage image = m_doc->GetBackgroundImage(id); + VBackgroundPatternImage const image = m_doc->GetBackgroundImage(id); if (image.IsNull()) { return; @@ -428,7 +428,7 @@ void VWidgetBackgroundImages::CurrentImageChanged(int currentRow, int currentCol //--------------------------------------------------------------------------------------------------------------------- void VWidgetBackgroundImages::MoveImageOnTop() { - int row = ui->tableWidget->currentRow(); + int const row = ui->tableWidget->currentRow(); if (row == -1) { return; @@ -437,7 +437,7 @@ void VWidgetBackgroundImages::MoveImageOnTop() QTableWidgetItem *item = ui->tableWidget->item(row, 0); if (item != nullptr) { - QUuid id = item->data(Qt::UserRole).toUuid(); + QUuid const id = item->data(Qt::UserRole).toUuid(); auto *command = new ZValueMoveBackgroundImage(id, ZValueMoveType::Top, m_doc); VAbstractApplication::VApp()->getUndoStack()->push(command); } @@ -446,7 +446,7 @@ void VWidgetBackgroundImages::MoveImageOnTop() //--------------------------------------------------------------------------------------------------------------------- void VWidgetBackgroundImages::MoveImageUp() { - int row = ui->tableWidget->currentRow(); + int const row = ui->tableWidget->currentRow(); if (row == -1) { return; @@ -455,7 +455,7 @@ void VWidgetBackgroundImages::MoveImageUp() QTableWidgetItem *item = ui->tableWidget->item(row, 0); if (item != nullptr) { - QUuid id = item->data(Qt::UserRole).toUuid(); + QUuid const id = item->data(Qt::UserRole).toUuid(); auto *command = new ZValueMoveBackgroundImage(id, ZValueMoveType::Up, m_doc); VAbstractApplication::VApp()->getUndoStack()->push(command); } @@ -464,7 +464,7 @@ void VWidgetBackgroundImages::MoveImageUp() //--------------------------------------------------------------------------------------------------------------------- void VWidgetBackgroundImages::MoveImageDown() { - int row = ui->tableWidget->currentRow(); + int const row = ui->tableWidget->currentRow(); if (row == -1) { return; @@ -473,7 +473,7 @@ void VWidgetBackgroundImages::MoveImageDown() QTableWidgetItem *item = ui->tableWidget->item(row, 0); if (item != nullptr) { - QUuid id = item->data(Qt::UserRole).toUuid(); + QUuid const id = item->data(Qt::UserRole).toUuid(); auto *command = new ZValueMoveBackgroundImage(id, ZValueMoveType::Down, m_doc); VAbstractApplication::VApp()->getUndoStack()->push(command); } @@ -482,7 +482,7 @@ void VWidgetBackgroundImages::MoveImageDown() //--------------------------------------------------------------------------------------------------------------------- void VWidgetBackgroundImages::MoveImageBottom() { - int row = ui->tableWidget->currentRow(); + int const row = ui->tableWidget->currentRow(); if (row == -1) { return; @@ -491,7 +491,7 @@ void VWidgetBackgroundImages::MoveImageBottom() QTableWidgetItem *item = ui->tableWidget->item(row, 0); if (item != nullptr) { - QUuid id = item->data(Qt::UserRole).toUuid(); + QUuid const id = item->data(Qt::UserRole).toUuid(); auto *command = new ZValueMoveBackgroundImage(id, ZValueMoveType::Bottom, m_doc); VAbstractApplication::VApp()->getUndoStack()->push(command); } @@ -500,7 +500,7 @@ void VWidgetBackgroundImages::MoveImageBottom() //--------------------------------------------------------------------------------------------------------------------- void VWidgetBackgroundImages::ApplyImageTransformation() { - int row = ui->tableWidget->currentRow(); + int const row = ui->tableWidget->currentRow(); if (row == -1) { return; @@ -512,8 +512,8 @@ void VWidgetBackgroundImages::ApplyImageTransformation() return; } - QUuid id = item->data(Qt::UserRole).toUuid(); - VBackgroundPatternImage image = m_doc->GetBackgroundImage(id); + QUuid const id = item->data(Qt::UserRole).toUuid(); + VBackgroundPatternImage const image = m_doc->GetBackgroundImage(id); if (image.IsNull() || image.Hold()) { @@ -528,7 +528,7 @@ void VWidgetBackgroundImages::ApplyImageTransformation() if (not ui->checkBoxRelativeTranslation->isChecked()) { - QRectF rect = image.BoundingRect(); + QRectF const rect = image.BoundingRect(); dx = dx - rect.topLeft().x(); dy = dy - rect.topLeft().y(); } @@ -538,14 +538,14 @@ void VWidgetBackgroundImages::ApplyImageTransformation() } else if (ui->tabWidgetImageTransformation->indexOf(ui->tabScale) == index) { // scale - qreal sx = + qreal const sx = WidthScaleUnitConvertor(ui->doubleSpinBoxScaleWidth->value(), CurrentScaleUnit(), ScaleUnit::Percent) / 100; - qreal sy = + qreal const sy = HeightScaleUnitConvertor(ui->doubleSpinBoxScaleHeight->value(), CurrentScaleUnit(), ScaleUnit::Percent) / 100; QTransform imageMatrix = image.Matrix(); - QPointF originPos = image.BoundingRect().center(); + QPointF const originPos = image.BoundingRect().center(); QTransform m; m.translate(originPos.x(), originPos.y()); @@ -567,7 +567,7 @@ void VWidgetBackgroundImages::ApplyImageTransformation() QTransform imageMatrix = image.Matrix(); - QPointF originPos = image.BoundingRect().center(); + QPointF const originPos = image.BoundingRect().center(); QTransform m; m.translate(originPos.x(), originPos.y()); @@ -600,7 +600,7 @@ void VWidgetBackgroundImages::ResetImageTransformationSettings() } } - int unitIndex = ui->comboBoxTranslateUnit->findData(QVariant(static_cast(Unit::Px))); + int const unitIndex = ui->comboBoxTranslateUnit->findData(QVariant(static_cast(Unit::Px))); if (unitIndex != -1) { ui->comboBoxTranslateUnit->setCurrentIndex(unitIndex); @@ -608,7 +608,7 @@ void VWidgetBackgroundImages::ResetImageTransformationSettings() } else if (ui->tabWidgetImageTransformation->indexOf(ui->tabScale) == index) { // scale - int unitIndex = ui->comboBoxScaleUnit->findData(QVariant(static_cast(ScaleUnit::Percent))); + int const unitIndex = ui->comboBoxScaleUnit->findData(QVariant(static_cast(ScaleUnit::Percent))); if (unitIndex != -1) { ui->comboBoxScaleUnit->setCurrentIndex(unitIndex); @@ -633,7 +633,7 @@ void VWidgetBackgroundImages::RelativeTranslationChanged(bool checked) } else { - int row = ui->tableWidget->currentRow(); + int const row = ui->tableWidget->currentRow(); if (row == -1) { return; @@ -642,7 +642,7 @@ void VWidgetBackgroundImages::RelativeTranslationChanged(bool checked) QTableWidgetItem *item = ui->tableWidget->item(row, 0); if (item != nullptr) { - QUuid id = item->data(Qt::UserRole).toUuid(); + QUuid const id = item->data(Qt::UserRole).toUuid(); SetAbsolutePisition(id); } } @@ -653,7 +653,7 @@ void VWidgetBackgroundImages::ScaleProportionallyChanged(bool checked) { if (checked) { - qreal value = ui->doubleSpinBoxScaleWidth->value(); + qreal const value = ui->doubleSpinBoxScaleWidth->value(); ui->doubleSpinBoxScaleHeight->setValue(value); } } @@ -663,7 +663,7 @@ void VWidgetBackgroundImages::ScaleWidthChanged(double value) { if (ui->checkBoxScaleProportionally->isChecked()) { - ScaleUnit unit = CurrentScaleUnit(); + ScaleUnit const unit = CurrentScaleUnit(); if (unit == ScaleUnit::Percent) { ui->doubleSpinBoxScaleHeight->blockSignals(true); @@ -672,9 +672,9 @@ void VWidgetBackgroundImages::ScaleWidthChanged(double value) } else { - qreal factor = WidthScaleUnitConvertor(value, unit, ScaleUnit::Percent) / 100.; - qreal heightPx = ImageHeight() * factor; - qreal height = HeightScaleUnitConvertor(heightPx, ScaleUnit::Px, unit); + qreal const factor = WidthScaleUnitConvertor(value, unit, ScaleUnit::Percent) / 100.; + qreal const heightPx = ImageHeight() * factor; + qreal const height = HeightScaleUnitConvertor(heightPx, ScaleUnit::Px, unit); ui->doubleSpinBoxScaleHeight->blockSignals(true); ui->doubleSpinBoxScaleHeight->setValue(height); @@ -688,7 +688,7 @@ void VWidgetBackgroundImages::ScaleHeightChanged(double value) { if (ui->checkBoxScaleProportionally->isChecked()) { - ScaleUnit unit = CurrentScaleUnit(); + ScaleUnit const unit = CurrentScaleUnit(); if (unit == ScaleUnit::Percent) { ui->doubleSpinBoxScaleWidth->blockSignals(true); @@ -697,9 +697,9 @@ void VWidgetBackgroundImages::ScaleHeightChanged(double value) } else { - qreal factor = HeightScaleUnitConvertor(value, unit, ScaleUnit::Percent) / 100.; - qreal widthPx = ImageWidth() * factor; - qreal width = WidthScaleUnitConvertor(widthPx, ScaleUnit::Px, unit); + qreal const factor = HeightScaleUnitConvertor(value, unit, ScaleUnit::Percent) / 100.; + qreal const widthPx = ImageWidth() * factor; + qreal const width = WidthScaleUnitConvertor(widthPx, ScaleUnit::Px, unit); ui->doubleSpinBoxScaleHeight->blockSignals(true); ui->doubleSpinBoxScaleHeight->setValue(width); @@ -716,7 +716,7 @@ void VWidgetBackgroundImages::ImagePositionChanged(const QUuid &id) return; } - int row = ui->tableWidget->currentRow(); + int const row = ui->tableWidget->currentRow(); if (row == -1) { return; @@ -725,7 +725,7 @@ void VWidgetBackgroundImages::ImagePositionChanged(const QUuid &id) QTableWidgetItem *item = ui->tableWidget->item(row, 0); if (item != nullptr) { - QUuid curentId = item->data(Qt::UserRole).toUuid(); + QUuid const curentId = item->data(Qt::UserRole).toUuid(); if (curentId != id) { return; @@ -788,7 +788,7 @@ void VWidgetBackgroundImages::FillTable(const QVector & //--------------------------------------------------------------------------------------------------------------------- void VWidgetBackgroundImages::ToggleImageHold(const QUuid &id) const { - VBackgroundPatternImage image = m_doc->GetBackgroundImage(id); + VBackgroundPatternImage const image = m_doc->GetBackgroundImage(id); if (not image.IsNull()) { auto *command = new HoldBackgroundImage(image.Id(), not image.Hold(), m_doc); @@ -799,7 +799,7 @@ void VWidgetBackgroundImages::ToggleImageHold(const QUuid &id) const //--------------------------------------------------------------------------------------------------------------------- void VWidgetBackgroundImages::ToggleImageVisibility(const QUuid &id) const { - VBackgroundPatternImage image = m_doc->GetBackgroundImage(id); + VBackgroundPatternImage const image = m_doc->GetBackgroundImage(id); if (not image.IsNull()) { auto *command = new HideBackgroundImage(image.Id(), image.Visible(), m_doc); @@ -972,14 +972,14 @@ auto VWidgetBackgroundImages::ImageWidth() const -> qreal { qreal width = 0; - int row = ui->tableWidget->currentRow(); + int const row = ui->tableWidget->currentRow(); if (row != -1) { QTableWidgetItem *item = ui->tableWidget->item(row, 0); if (item != nullptr) { - QUuid id = item->data(Qt::UserRole).toUuid(); - VBackgroundPatternImage image = m_doc->GetBackgroundImage(id); + QUuid const id = item->data(Qt::UserRole).toUuid(); + VBackgroundPatternImage const image = m_doc->GetBackgroundImage(id); width = image.Size().width(); } } @@ -992,14 +992,14 @@ auto VWidgetBackgroundImages::ImageHeight() const -> qreal { qreal height = 0; - int row = ui->tableWidget->currentRow(); + int const row = ui->tableWidget->currentRow(); if (row != -1) { QTableWidgetItem *item = ui->tableWidget->item(row, 0); if (item != nullptr) { - QUuid id = item->data(Qt::UserRole).toUuid(); - VBackgroundPatternImage image = m_doc->GetBackgroundImage(id); + QUuid const id = item->data(Qt::UserRole).toUuid(); + VBackgroundPatternImage const image = m_doc->GetBackgroundImage(id); height = image.Size().height(); } } @@ -1022,8 +1022,8 @@ auto VWidgetBackgroundImages::HeightScaleUnitConvertor(qreal value, ScaleUnit fr //--------------------------------------------------------------------------------------------------------------------- void VWidgetBackgroundImages::SetAbsolutePisition(const QUuid &id) { - VBackgroundPatternImage image = m_doc->GetBackgroundImage(id); - QRectF rect = image.BoundingRect(); + VBackgroundPatternImage const image = m_doc->GetBackgroundImage(id); + QRectF const rect = image.BoundingRect(); ui->doubleSpinBoxImageHorizontalTranslate->setValue( UnitConvertor(rect.topLeft().x(), Unit::Px, CurrentTranslateUnit())); diff --git a/src/app/valentina/dialogs/vwidgetdetails.cpp b/src/app/valentina/dialogs/vwidgetdetails.cpp index 898776af6..8645ccbd0 100644 --- a/src/app/valentina/dialogs/vwidgetdetails.cpp +++ b/src/app/valentina/dialogs/vwidgetdetails.cpp @@ -210,7 +210,7 @@ void VWidgetDetails::ToggledPieceItem(QTableWidgetItem *item) { SCASSERT(item != nullptr) - quint32 id = item->data(Qt::UserRole).toUInt(); + quint32 const id = item->data(Qt::UserRole).toUInt(); const QHash *details = m_data->DataPieces(); if (details->contains(id)) @@ -292,7 +292,7 @@ auto VWidgetDetails::PreparePieceNameColumnCell(const VPiece &det) -> QTableWidg //--------------------------------------------------------------------------------------------------------------------- void VWidgetDetails::ShowContextMenu(const QPoint &pos) { - QScopedPointer menu(new QMenu()); + QScopedPointer const menu(new QMenu()); QAction *actionSelectAll = menu->addAction(tr("Select all")); QAction *actionSelectNone = menu->addAction(tr("Select none")); diff --git a/src/app/valentina/dialogs/vwidgetgroups.cpp b/src/app/valentina/dialogs/vwidgetgroups.cpp index 5e57bfe47..c7c86f12c 100644 --- a/src/app/valentina/dialogs/vwidgetgroups.cpp +++ b/src/app/valentina/dialogs/vwidgetgroups.cpp @@ -70,7 +70,7 @@ void VWidgetGroups::SetGroupVisibility(vidtype id, bool visible) const connect(changeGroup, &ChangeGroupVisibility::UpdateGroup, this, [this](vidtype id, bool visible) { - int row = GroupRow(id); + int const row = GroupRow(id); if (row == -1) { return; @@ -97,7 +97,7 @@ void VWidgetGroups::SetMultipleGroupsVisibility(const QVector &groups, QMap::const_iterator i = groups.constBegin(); while (i != groups.constEnd()) { - int row = GroupRow(i.key()); + int const row = GroupRow(i.key()); if (row == -1) { ++i; @@ -122,7 +122,8 @@ void VWidgetGroups::SetMultipleGroupsVisibility(const QVector &groups, auto VWidgetGroups::FilterGroups(const QMap &groups) -> QMap { QMap filtered; - QSet filterCategories = ConvertToSet(VAbstractPattern::FilterGroupTags(ui->lineEditTags->text())); + QSet const filterCategories = + ConvertToSet(VAbstractPattern::FilterGroupTags(ui->lineEditTags->text())); if (filterCategories.isEmpty()) { @@ -133,7 +134,7 @@ auto VWidgetGroups::FilterGroups(const QMap &groups) -> QMa while (i != groups.constEnd()) { const VGroupData &data = i.value(); - QSet groupCategories = ConvertToSet(data.tags); + QSet const groupCategories = ConvertToSet(data.tags); if (filterCategories.intersects(groupCategories)) { filtered.insert(i.key(), data); @@ -164,10 +165,10 @@ auto VWidgetGroups::GroupRow(vidtype id) const -> int //--------------------------------------------------------------------------------------------------------------------- void VWidgetGroups::ActionPreferences(quint32 id) { - QScopedPointer fackeContainer(new VContainer(VAbstractApplication::VApp()->TrVars(), - VAbstractValApplication::VApp()->patternUnitsP(), - VContainer::UniqueNamespace())); - QScopedPointer dialog(new DialogGroup(fackeContainer.data(), m_doc, NULL_ID, this)); + QScopedPointer const fackeContainer(new VContainer(VAbstractApplication::VApp()->TrVars(), + VAbstractValApplication::VApp()->patternUnitsP(), + VContainer::UniqueNamespace())); + QScopedPointer const dialog(new DialogGroup(fackeContainer.data(), m_doc, NULL_ID, this)); dialog->SetName(m_doc->GetGroupName(id)); dialog->SetTags(m_doc->GetGroupTags(id)); dialog->SetGroupCategories(m_doc->GetGroupCategories()); @@ -194,7 +195,7 @@ void VWidgetGroups::ActionHideAll() for (int r = 0; r < ui->tableWidget->rowCount(); ++r) { QTableWidgetItem *rowItem = ui->tableWidget->item(r, 0); - quint32 i = rowItem->data(Qt::UserRole).toUInt(); + quint32 const i = rowItem->data(Qt::UserRole).toUInt(); if (m_doc->GetGroupVisibility(i)) { groups.append(i); @@ -220,7 +221,7 @@ void VWidgetGroups::ActionShowAll() for (int r = 0; r < ui->tableWidget->rowCount(); ++r) { QTableWidgetItem *rowItem = ui->tableWidget->item(r, 0); - quint32 i = rowItem->data(Qt::UserRole).toUInt(); + quint32 const i = rowItem->data(Qt::UserRole).toUInt(); if (not m_doc->GetGroupVisibility(i)) { groups.append(i); @@ -286,7 +287,7 @@ void VWidgetGroups::CtxMenu(const QPoint &pos) return false; }; - QScopedPointer menu(new QMenu()); + QScopedPointer const menu(new QMenu()); const QString resource = QStringLiteral("icon"); QAction *triggerVisibilityMenu = m_doc->GetGroupVisibility(id) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index ce78c9c06..4df603380 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -288,7 +288,7 @@ auto SortDetailsForLayout(const QHash *allDetails, const QStrin } else { - QRegularExpression nameRe(nameRegex); + QRegularExpression const nameRe(nameRegex); while (i != allDetails->constEnd()) { if (nameRe.match(i.value().GetName()).hasMatch()) @@ -852,8 +852,8 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons cursorResource = cursorHiDPIResource; } } - QPixmap pixmap(cursorResource); - QCursor cur(pixmap, 2, 2); + QPixmap const pixmap(cursorResource); + QCursor const cur(pixmap, 2, 2); ui->view->viewport()->setCursor(cur); ui->view->setCurrentCursorShape(); // Hack to fix problem with a cursor } @@ -1603,7 +1603,7 @@ void MainWindow::PlaceBackgroundImage(const QPointF &pos, const QString &fileNam //--------------------------------------------------------------------------------------------------------------------- void MainWindow::RemoveBackgroundImage(const QUuid &id) { - VBackgroundPatternImage image = doc->GetBackgroundImage(id); + VBackgroundPatternImage const image = doc->GetBackgroundImage(id); auto *deleteBackgroundImage = new DeleteBackgroundImage(image, doc); connect(deleteBackgroundImage, &DeleteBackgroundImage::AddItem, this, &MainWindow::AddBackgroundImageItem); @@ -1971,7 +1971,7 @@ void MainWindow::ExportToCSVData(const QString &fileName, bool withHeader, int m while (iMap.hasNext()) { iMap.next(); - QSharedPointer incr = increments.value(iMap.value()); + QSharedPointer const incr = increments.value(iMap.value()); currentRow++; csv.insertRow(currentRow); @@ -1979,7 +1979,7 @@ void MainWindow::ExportToCSVData(const QString &fileName, bool withHeader, int m csv.setText(currentRow, 1, VAbstractApplication::VApp()->LocaleToString(*incr->GetValue())); // calculated value - QString formula = VTranslateVars::TryFormulaToUser( + QString const formula = VTranslateVars::TryFormulaToUser( incr->GetFormula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()); csv.setText(currentRow, 2, formula); // formula } @@ -2062,7 +2062,7 @@ void MainWindow::LoadMultisize() const QString filter = tr("Multisize measurements") + QStringLiteral(" (*.vst);;") + tr("Individual measurements") + QStringLiteral("(*.vit)"); // Use standard path to multisize measurements - QString path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathMultisizeMeasurements(); + QString const path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathMultisizeMeasurements(); const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr, VAbstractApplication::VApp()->NativeFileDialog()); @@ -2204,7 +2204,7 @@ void MainWindow::ShowMeasurements() void MainWindow::MeasurementsChanged(const QString &path) { m_mChanges = false; - QFileInfo checkFile(path); + QFileInfo const checkFile(path); if (checkFile.exists()) { m_mChanges = true; @@ -2279,7 +2279,7 @@ void MainWindow::EditCurrentWatermark() { CleanWaterkmarkEditors(); - QString watermarkFile = doc->GetWatermarkPath(); + QString const watermarkFile = doc->GetWatermarkPath(); if (not watermarkFile.isEmpty()) { OpenWatermark(watermarkFile); @@ -2290,7 +2290,7 @@ void MainWindow::EditCurrentWatermark() void MainWindow::LoadWatermark() { const QString filter(tr("Watermark files") + QStringLiteral(" (*.vwm)")); - QString dir = QDir::homePath(); + QString const dir = QDir::homePath(); qDebug("Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir)); const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr, VAbstractApplication::VApp()->NativeFileDialog()); @@ -2322,7 +2322,7 @@ void MainWindow::CleanWaterkmarkEditors() QMutableListIterator> i(m_watermarkEditors); while (i.hasNext()) { - QPointer watermarkEditor = i.next(); + QPointer const watermarkEditor = i.next(); if (watermarkEditor.isNull()) { i.remove(); @@ -2335,7 +2335,7 @@ void MainWindow::StoreMultisizeMDimensions() { VAbstractValApplication::VApp()->SetMeasurementsUnits(m_m->Units()); - QList dimensions = m_m->Dimensions().values(); + QList const dimensions = m_m->Dimensions().values(); if (not dimensions.isEmpty()) { @@ -2369,7 +2369,7 @@ void MainWindow::StoreMultisizeMDimensions() //--------------------------------------------------------------------------------------------------------------------- void MainWindow::StoreIndividualMDimensions() { - QMap> measurements = pattern->DataMeasurements(); + QMap> const measurements = pattern->DataMeasurements(); StoreIndividualMDimension(measurements, IMD::X); StoreIndividualMDimension(measurements, IMD::Y); @@ -2549,10 +2549,10 @@ void MainWindow::ExportDraw(const QString &fileName) exporter.SetFileName(fileName); - int verticalScrollBarValue = ui->view->verticalScrollBar()->value(); - int horizontalScrollBarValue = ui->view->horizontalScrollBar()->value(); + int const verticalScrollBarValue = ui->view->verticalScrollBar()->value(); + int const horizontalScrollBarValue = ui->view->horizontalScrollBar()->value(); - QTransform viewTransform = ui->view->transform(); + QTransform const viewTransform = ui->view->transform(); ui->view->ZoomFitBest(); // Resize all labels ui->view->repaint(); ui->view->ZoomOriginal(); // Set to original scale @@ -2942,7 +2942,7 @@ void MainWindow::ToolBarDraws() [this]() { QString draw = doc->GetNameActivPP(); - bool ok = PatternPieceName(draw); + bool const ok = PatternPieceName(draw); if (not ok) { return; @@ -4087,8 +4087,8 @@ void MainWindow::ActionLayout(bool checked) auto MainWindow::on_actionSaveAs_triggered() -> bool { VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings(); - QString patternPath = VAbstractValApplication::VApp()->GetPatternPath(); - QString dir = patternPath.isEmpty() ? settings->GetPathPattern() : QFileInfo(patternPath).absolutePath(); + QString const patternPath = VAbstractValApplication::VApp()->GetPatternPath(); + QString const dir = patternPath.isEmpty() ? settings->GetPathPattern() : QFileInfo(patternPath).absolutePath(); QString newFileName = tr("pattern") + QStringLiteral(".val"); if (not patternPath.isEmpty()) @@ -4096,7 +4096,7 @@ auto MainWindow::on_actionSaveAs_triggered() -> bool newFileName = QFileInfo(patternPath).fileName(); } - QString filters(tr("Pattern files") + QStringLiteral("(*.val)")); + QString const filters(tr("Pattern files") + QStringLiteral("(*.val)")); QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + '/'_L1 + newFileName, filters, nullptr, VAbstractApplication::VApp()->NativeFileDialog()); @@ -4105,7 +4105,7 @@ auto MainWindow::on_actionSaveAs_triggered() -> bool return false; } - QFileInfo f(fileName); + QFileInfo const f(fileName); if (f.suffix().isEmpty() && f.suffix() != "val"_L1) { fileName += ".val"_L1; @@ -4120,7 +4120,7 @@ auto MainWindow::on_actionSaveAs_triggered() -> bool { // Temporary try to lock the file before saving // Also help to rewite current read-only pattern - VLockGuard tmp(fileName); + VLockGuard const tmp(fileName); if (not tmp.IsLocked()) { qCCritical(vMainWindow, "%s", @@ -4156,7 +4156,7 @@ auto MainWindow::on_actionSave_triggered() -> bool } QString error; - bool result = SavePattern(VAbstractValApplication::VApp()->GetPatternPath(), error); + bool const result = SavePattern(VAbstractValApplication::VApp()->GetPatternPath(), error); if (result) { QFile::remove(VAbstractValApplication::VApp()->GetPatternPath() + *autosavePrefix); @@ -4226,7 +4226,7 @@ void MainWindow::on_actionCreateManualLayout_triggered() QTemporaryFile rldFile(QDir::tempPath() + "/puzzle.rld.XXXXXX"_L1); if (rldFile.open()) { - QVector detailsInLayout = SortDetailsForLayout(pattern->DataPieces()); + QVector const detailsInLayout = SortDetailsForLayout(pattern->DataPieces()); if (detailsInLayout.count() == 0) { @@ -4306,7 +4306,7 @@ void MainWindow::on_actionUpdateManualLayout_triggered() rldFile.setAutoRemove(false); if (rldFile.open()) { - QVector detailsInLayout = SortDetailsForLayout(pattern->DataPieces()); + QVector const detailsInLayout = SortDetailsForLayout(pattern->DataPieces()); if (detailsInLayout.count() == 0) { @@ -4366,7 +4366,7 @@ void MainWindow::ActionAddBackgroundImage() nullptr, VAbstractApplication::VApp()->NativeFileDialog()); if (not fileName.isEmpty()) { - QRect viewportRect(0, 0, ui->view->viewport()->width(), ui->view->viewport()->height()); + QRect const viewportRect(0, 0, ui->view->viewport()->width(), ui->view->viewport()->height()); PlaceBackgroundImage(ui->view->mapToScene(viewportRect.center()), fileName); } } @@ -4379,7 +4379,7 @@ void MainWindow::ActionExportFontCorrections() const QString dirPath = settings->GetPathFontCorrections(); bool usedNotExistedDir = false; - QDir directory(dirPath); + QDir const directory(dirPath); if (not directory.exists()) { usedNotExistedDir = directory.mkpath(QChar('.')); @@ -4390,7 +4390,7 @@ void MainWindow::ActionExportFontCorrections() { if (usedNotExistedDir) { - QDir directory(dirPath); + QDir const directory(dirPath); directory.rmpath(QChar('.')); } }); @@ -4400,7 +4400,7 @@ void MainWindow::ActionExportFontCorrections() VAbstractApplication::VApp()->NativeFileDialog(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks)); if (not dir.isEmpty()) { - VSingleLineOutlineChar corrector(settings->GetLabelFont()); + VSingleLineOutlineChar const corrector(settings->GetLabelFont()); corrector.ExportCorrections(dir); } } @@ -4924,7 +4924,7 @@ void MainWindow::AskDefaultSettings() QGuiApplication::restoreOverrideCursor(); if (dialog.exec() == QDialog::Accepted) { - QString locale = dialog.Locale(); + QString const locale = dialog.Locale(); settings->SetLocale(locale); VAbstractApplication::VApp()->LoadTranslation(locale); } @@ -5004,7 +5004,7 @@ void MainWindow::ShowBackgroundImageInExplorer(const QUuid &id) //--------------------------------------------------------------------------------------------------------------------- void MainWindow::SaveBackgroundImage(const QUuid &id) { - VBackgroundPatternImage image = doc->GetBackgroundImage(id); + VBackgroundPatternImage const image = doc->GetBackgroundImage(id); if (not image.IsValid()) { @@ -5019,13 +5019,13 @@ void MainWindow::SaveBackgroundImage(const QUuid &id) } const QByteArray imageData = QByteArray::fromBase64(image.ContentData()); - QMimeType mime = MimeTypeFromByteArray(imageData); + QMimeType const mime = MimeTypeFromByteArray(imageData); QString path = QDir::homePath() + QDir::separator() + tr("untitled"); QStringList filters; if (mime.isValid()) { - QStringList suffixes = mime.suffixes(); + QStringList const suffixes = mime.suffixes(); if (not suffixes.isEmpty()) { path += '.'_L1 + suffixes.at(0); @@ -5036,9 +5036,9 @@ void MainWindow::SaveBackgroundImage(const QUuid &id) filters.append(tr("All files") + " (*.*)"_L1); - QString filter = filters.join(QStringLiteral(";;")); + QString const filter = filters.join(QStringLiteral(";;")); - QString filename = QFileDialog::getSaveFileName(this, tr("Save Image"), path, filter, nullptr, + QString const filename = QFileDialog::getSaveFileName(this, tr("Save Image"), path, filter, nullptr, VAbstractApplication::VApp()->NativeFileDialog()); if (not filename.isEmpty()) { @@ -5061,7 +5061,7 @@ void MainWindow::ParseBackgroundImages() m_backgroudcontrols = nullptr; // force creating new controls m_backgroundImages.clear(); // clear dangling pointers - QVector allImages = doc->GetBackgroundImages(); + QVector const allImages = doc->GetBackgroundImages(); for (const auto &image : allImages) { NewBackgroundImageItem(image); @@ -5097,8 +5097,8 @@ void MainWindow::ActionHistory_triggered(bool checked) //--------------------------------------------------------------------------------------------------------------------- void MainWindow::ActionExportRecipe_triggered() { - QString filters(tr("Recipe files") + QStringLiteral("(*.vpr)")); - QString fileName = QFileDialog::getSaveFileName(this, tr("Export recipe"), + QString const filters(tr("Recipe files") + QStringLiteral("(*.vpr)")); + QString const fileName = QFileDialog::getSaveFileName(this, tr("Export recipe"), QDir::homePath() + '/' + tr("recipe") + QStringLiteral(".vpr"), filters, nullptr, VAbstractApplication::VApp()->NativeFileDialog()); if (fileName.isEmpty()) @@ -5129,7 +5129,7 @@ void MainWindow::ActionNewDraw_triggered() qCDebug(vMainWindow, "Generated PP name: %s", qUtf8Printable(patternPieceName)); qCDebug(vMainWindow, "PP count %d", m_comboBoxDraws->count()); - bool ok = PatternPieceName(patternPieceName); + bool const ok = PatternPieceName(patternPieceName); qCDebug(vMainWindow, "PP name: %s", qUtf8Printable(patternPieceName)); if (not ok) { @@ -5371,11 +5371,11 @@ void MainWindow::InitDimensionGradation(int index, const MeasurementDimension_p } // Calculate the width of the largest item using QFontMetrics - QFontMetrics fontMetrics(control->font()); + QFontMetrics const fontMetrics(control->font()); int maxWidth = 0; for (int i = 0; i < control->count(); ++i) { - int itemWidth = fontMetrics.horizontalAdvance(control->itemText(i)); + int const itemWidth = fontMetrics.horizontalAdvance(control->itemText(i)); if (itemWidth > maxWidth) { maxWidth = itemWidth; @@ -5389,7 +5389,7 @@ void MainWindow::InitDimensionGradation(int index, const MeasurementDimension_p // it invalid first control->setCurrentIndex(-1); - int i = control->findData(current); + int const i = control->findData(current); if (i != -1) { control->setCurrentIndex(i); @@ -5576,7 +5576,7 @@ void MainWindow::MinimumScrollBar() auto MainWindow::SavePattern(const QString &fileName, QString &error) -> bool { qCDebug(vMainWindow, "Saving pattern file %s.", qUtf8Printable(fileName)); - QFileInfo tempInfo(fileName); + QFileInfo const tempInfo(fileName); const QString mPath = AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), doc->MPath()); if (not mPath.isEmpty() && VAbstractValApplication::VApp()->GetPatternPath() != fileName) @@ -5744,7 +5744,7 @@ auto MainWindow::MaybeSave() -> bool { if (this->isWindowModified() && m_guiEnabled) { - QScopedPointer messageBox( + QScopedPointer const messageBox( new QMessageBox(QMessageBox::Warning, tr("Unsaved changes"), tr("The pattern has been modified. Do you want to save your changes?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, this, Qt::Sheet)); @@ -6278,7 +6278,7 @@ void MainWindow::InitAutoSave() //--------------------------------------------------------------------------------------------------------------------- auto MainWindow::PatternPieceName(QString &name) -> bool { - QScopedPointer dlg(new QInputDialog(this)); + QScopedPointer const dlg(new QInputDialog(this)); dlg->setInputMode(QInputDialog::TextInput); dlg->setLabelText(tr("Pattern piece:")); dlg->setTextEchoMode(QLineEdit::Normal); @@ -6328,14 +6328,14 @@ auto MainWindow::LoadPattern(QString fileName, const QString &customMeasureFile) qCDebug(vMainWindow, "Loading new file %s.", qUtf8Printable(fileName)); { // Convert to absolute path if need - QFileInfo info(fileName); + QFileInfo const info(fileName); if (info.exists() && info.isRelative()) { fileName = QFileInfo(QDir::currentPath() + '/'_L1 + fileName).canonicalFilePath(); } } - QFuture futureConverter = QtConcurrent::run( + QFuture const futureConverter = QtConcurrent::run( [fileName]() { std::unique_ptr converter(new VPatternConverter(fileName)); @@ -6455,7 +6455,7 @@ auto MainWindow::LoadPattern(QString fileName, const QString &customMeasureFile) if (currentFormatVersion != VPatternConverter::PatternMaxVer) { // Because we rely on the fact that we know where is path to measurements optimization available only for // the latest format version - QScopedPointer converter(futureConverter.result()); + QScopedPointer const converter(futureConverter.result()); m_curFileFormatVersion = converter->GetCurrentFormatVersion(); m_curFileFormatVersionStr = converter->GetFormatVersionStr(); doc->setXMLContent(converter->Convert()); @@ -6556,7 +6556,7 @@ auto MainWindow::LoadPattern(QString fileName, const QString &customMeasureFile) if (currentFormatVersion == VPatternConverter::PatternMaxVer) { // Real read - QScopedPointer converter(futureConverter.result()); + QScopedPointer const converter(futureConverter.result()); m_curFileFormatVersion = converter->GetCurrentFormatVersion(); m_curFileFormatVersionStr = converter->GetFormatVersionStr(); doc->setXMLContent(converter->Convert()); @@ -6643,7 +6643,7 @@ auto MainWindow::GetUnlokedRestoreFileList() -> QStringList for (auto &file : files) { // Seeking file that realy need reopen - VLockGuard tmp(file); + VLockGuard const tmp(file); if (tmp.IsLocked()) { restoreFiles.append(file); @@ -6687,7 +6687,7 @@ void MainWindow::ToolboxIconSize() auto SetIconSize = [](QToolBar *bar) { VCommonSettings *settings = VAbstractApplication::VApp()->Settings(); - QSize size = settings->GetToolboxIconSizeSmall() ? QSize(24, 24) : QSize(32, 32); + QSize const size = settings->GetToolboxIconSizeSmall() ? QSize(24, 24) : QSize(32, 32); bar->setIconSize(size); }; @@ -6724,7 +6724,7 @@ void MainWindow::Preferences() QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); auto *preferences = new DialogPreferences(this); // QScopedPointer needs to be sure any exception will never block guard - QScopedPointer dlg(preferences); + QScopedPointer const dlg(preferences); guard = preferences; connect(dlg.data(), &DialogPreferences::UpdateProperties, this, &MainWindow::WindowsLocale); // Must be first connect(dlg.data(), &DialogPreferences::UpdateProperties, m_toolOptions, @@ -6770,8 +6770,8 @@ void MainWindow::ExportDrawAs(bool checked) auto Uncheck = qScopeGuard([this] { ui->actionExportDraw->setChecked(false); }); - QString filters(tr("Scalable Vector Graphics files") + QStringLiteral("(*.svg)")); - QString dir = QDir::homePath() + '/'_L1 + FileName() + QStringLiteral(".svg"); + QString const filters(tr("Scalable Vector Graphics files") + QStringLiteral("(*.svg)")); + QString const dir = QDir::homePath() + '/'_L1 + FileName() + QStringLiteral(".svg"); QString fileName = QFileDialog::getSaveFileName(this, tr("Save draw"), dir, filters, nullptr, VAbstractApplication::VApp()->NativeFileDialog()); @@ -6780,7 +6780,7 @@ void MainWindow::ExportDrawAs(bool checked) return; } - QFileInfo f(fileName); + QFileInfo const f(fileName); if (f.suffix().isEmpty() || f.suffix() != "svg"_L1) { fileName += ".svg"_L1; @@ -6835,7 +6835,7 @@ void MainWindow::ExportDetailsAs(bool checked) auto Uncheck = qScopeGuard([this] { ui->actionDetailExportAs->setChecked(false); }); - QVector detailsInLayout = SortDetailsForLayout(pattern->DataPieces()); + QVector const detailsInLayout = SortDetailsForLayout(pattern->DataPieces()); if (detailsInLayout.count() == 0) { @@ -6964,7 +6964,7 @@ auto MainWindow::CheckPathToMeasurements(const QString &patternPath, const QStri return mPath; }; - QFileInfo table(path); + QFileInfo const table(path); if (table.exists()) { return path; @@ -6978,7 +6978,7 @@ auto MainWindow::CheckPathToMeasurements(const QString &patternPath, const QStri const QString text = tr("The measurements file

%1

could not be found. Do you " "want to update the file location?") .arg(path); - QMessageBox::StandardButton res = QMessageBox::question(this, tr("Loading measurements file"), text, + QMessageBox::StandardButton const res = QMessageBox::question(this, tr("Loading measurements file"), text, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); if (res == QMessageBox::No) { @@ -7052,7 +7052,7 @@ auto MainWindow::CheckPathToMeasurements(const QString &patternPath, const QStri return mPath; } - QScopedPointer m(new VMeasurements(pattern)); + QScopedPointer const m(new VMeasurements(pattern)); m->setXMLContent(mPath); patternType = m->Type(); @@ -7313,7 +7313,7 @@ auto MainWindow::DoFMExport(const VCommandLinePtr &expParams) -> bool return false; } - QFileInfo info(filePath); + QFileInfo const info(filePath); if (info.isRelative()) { filePath = QDir::currentPath() + '/'_L1 + filePath; diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index 9b187303b..d50cc5242 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -106,7 +106,7 @@ void RemoveLayoutPath(const QString &path, bool usedNotExistedDir) { if (usedNotExistedDir) { - QDir dir(path); + QDir const dir(path); dir.rmpath(QChar('.')); } } @@ -474,7 +474,7 @@ void MainWindowsNoGUI::ShowLayoutError(const LayoutErrors &state) //--------------------------------------------------------------------------------------------------------------------- void MainWindowsNoGUI::ExportFMeasurementsToCSV() { - QString fileName = CSVFilePath(); + QString const fileName = CSVFilePath(); if (fileName.isEmpty()) { @@ -546,7 +546,7 @@ void MainWindowsNoGUI::ExportFlatLayout(const QList &scenes, c const QMarginsF &margins) { const QString path = m_dialogSaveLayout->Path(); - bool usedNotExistedDir = CreateLayoutPath(path); + bool const usedNotExistedDir = CreateLayoutPath(path); if (not usedNotExistedDir) { qCritical() << tr("Can't create a path"); @@ -577,7 +577,7 @@ void MainWindowsNoGUI::ExportDetailsAsFlatLayout(const QVector &li return; } - QScopedPointer scene(new QGraphicsScene()); + QScopedPointer const scene(new QGraphicsScene()); QList list; list.reserve(listDetails.count()); @@ -635,8 +635,8 @@ void MainWindowsNoGUI::ExportDetailsAsFlatLayout(const QVector &li QList> details; // All details details.append(list); - QList shadows = CreateShadows(papers); - QList scenes = CreateScenes(papers, shadows, details); + QList const shadows = CreateShadows(papers); + QList const scenes = CreateScenes(papers, shadows, details); const bool ignorePrinterFields = false; Q_RELAXED_CONSTEXPR qreal margin = ToPixel(1, Unit::Cm); @@ -650,7 +650,7 @@ void MainWindowsNoGUI::ExportApparelLayout(const QVector &details, const QSize &size) const { const QString path = m_dialogSaveLayout->Path(); - bool usedNotExistedDir = CreateLayoutPath(path); + bool const usedNotExistedDir = CreateLayoutPath(path); if (not usedNotExistedDir) { qCritical() << tr("Can't create a path"); @@ -717,7 +717,7 @@ void MainWindowsNoGUI::ExportDetailsAsApparelLayout(QVector listDe return; } - QScopedPointer scene(new QGraphicsScene()); + QScopedPointer const scene(new QGraphicsScene()); QList list; list.reserve(listDetails.count()); @@ -809,7 +809,7 @@ void MainWindowsNoGUI::PrintPreviewTiled() m_layoutSettings->SetTiledMargins(m_dialogSaveLayout->GetTiledMargins()); m_layoutSettings->SetTiledPDFOrientation(m_dialogSaveLayout->GetTiledPageOrientation()); - VAbstractLayoutDialog::PaperSizeTemplate tiledFormat = m_dialogSaveLayout->GetTiledPageFormat(); + VAbstractLayoutDialog::PaperSizeTemplate const tiledFormat = m_dialogSaveLayout->GetTiledPageFormat(); m_layoutSettings->SetTiledPDFPaperSize(VAbstractLayoutDialog::GetTemplateSize(tiledFormat, Unit::Mm)); } else @@ -843,7 +843,7 @@ void MainWindowsNoGUI::PrintTiled() m_layoutSettings->SetTiledMargins(m_dialogSaveLayout->GetTiledMargins()); m_layoutSettings->SetTiledPDFOrientation(m_dialogSaveLayout->GetTiledPageOrientation()); - VAbstractLayoutDialog::PaperSizeTemplate tiledFormat = m_dialogSaveLayout->GetTiledPageFormat(); + VAbstractLayoutDialog::PaperSizeTemplate const tiledFormat = m_dialogSaveLayout->GetTiledPageFormat(); m_layoutSettings->SetTiledPDFPaperSize(VAbstractLayoutDialog::GetTemplateSize(tiledFormat, Unit::Mm)); } else @@ -868,7 +868,7 @@ auto MainWindowsNoGUI::PrepareDetailsForLayout(const QVector &d return {}; } - std::function PrepareDetail = [](const DetailForLayout &data) + std::function const PrepareDetail = [](const DetailForLayout &data) { auto *tool = qobject_cast(VAbstractPattern::getTool(data.id)); SCASSERT(tool != nullptr) @@ -1028,7 +1028,7 @@ void MainWindowsNoGUI::PdfTiledFile(const QString &name) m_layoutSettings->SetTiledMargins(m_dialogSaveLayout->GetTiledMargins()); m_layoutSettings->SetTiledPDFOrientation(m_dialogSaveLayout->GetTiledPageOrientation()); - VAbstractLayoutDialog::PaperSizeTemplate tiledFormat = m_dialogSaveLayout->GetTiledPageFormat(); + VAbstractLayoutDialog::PaperSizeTemplate const tiledFormat = m_dialogSaveLayout->GetTiledPageFormat(); m_layoutSettings->SetTiledPDFPaperSize(VAbstractLayoutDialog::GetTemplateSize(tiledFormat, Unit::Mm)); m_layoutSettings->SetXScale(m_dialogSaveLayout->GetXScale()); @@ -1091,8 +1091,8 @@ void MainWindowsNoGUI::ExportScene(const QList &scenes, const exporter.SetFileName(name); exporter.SetImageRect(paper->rect()); - QPen defaultPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(), Qt::SolidLine, - Qt::RoundCap, Qt::RoundJoin); + QPen const defaultPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(), Qt::SolidLine, + Qt::RoundCap, Qt::RoundJoin); switch (m_dialogSaveLayout->Format()) { @@ -1237,7 +1237,7 @@ auto MainWindowsNoGUI::ExportFMeasurementsToCSVData(const QString &fileName, boo { try { - QScopedPointer cal(new Calculator()); + QScopedPointer const cal(new Calculator()); const qreal result = cal->EvalFormula(completeData.DataVariables(), m.formula); csv.setText(i, 1, VAbstractApplication::VApp()->LocaleToString(result)); // value @@ -1383,7 +1383,7 @@ void MainWindowsNoGUI::CheckRequiredMeasurements(const VMeasurements *m) const if (not match.isEmpty()) { - QStringList list = ConvertToList(match); + QStringList const list = ConvertToList(match); VException e(tr("Measurement file doesn't include all required measurements.")); e.AddMoreInformation(tr("Please, additionally provide: %1").arg(list.join(", "_L1))); throw e; diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index a8a975aa0..0a184f617 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -469,7 +469,7 @@ auto VPattern::GetActivePPPieces() const -> QVector QDomElement detail = details.firstChildElement(TagDetail); while (not detail.isNull()) { - bool united = GetParametrBool(detail, VToolSeamAllowance::AttrUnited, falseStr); + bool const united = GetParametrBool(detail, VToolSeamAllowance::AttrUnited, falseStr); if (not united) { pieces.append(GetParametrId(detail)); @@ -496,7 +496,7 @@ auto VPattern::SaveDocument(const QString &fileName, QString &error) -> bool } // Update comment with Valentina version - QDomNode commentNode = documentElement().firstChild(); + QDomNode const commentNode = documentElement().firstChild(); if (commentNode.isComment()) { QDomComment comment = commentNode.toComment(); @@ -599,9 +599,9 @@ void VPattern::LiteParseIncrements() //--------------------------------------------------------------------------------------------------------------------- auto VPattern::ElementsToParse() const -> int { - QVector tags{TagCalculation, TagDetails, TagModeling, TagIncrements}; + QVector const tags{TagCalculation, TagDetails, TagModeling, TagIncrements}; - std::function TagsCount = [this](const QString &tagName) + std::function const TagsCount = [this](const QString &tagName) { return elementsByTagName(tagName).length(); }; return QtConcurrent::blockingMappedReduced(tags, TagsCount, GatherCount); @@ -614,7 +614,7 @@ auto VPattern::ElementsToParse() const -> int void VPattern::LiteParseTree(const Document &parse) { // Save name current pattern piece - QString namePP = nameActivPP; + QString const namePP = nameActivPP; try { @@ -753,8 +753,8 @@ auto VPattern::ParseDetailNode(const QDomElement &domElement) -> VNodeDetail const QString t = GetParametrString(domElement, AttrType, QStringLiteral("NodePoint")); Tool tool; - QStringList types{VAbstractPattern::NodePoint, VAbstractPattern::NodeArc, VAbstractPattern::NodeSpline, - VAbstractPattern::NodeSplinePath, VAbstractPattern::NodeElArc}; + QStringList const types{VAbstractPattern::NodePoint, VAbstractPattern::NodeArc, VAbstractPattern::NodeSpline, + VAbstractPattern::NodeSplinePath, VAbstractPattern::NodeElArc}; switch (types.indexOf(t)) { case 0: // NodePoint @@ -844,7 +844,7 @@ void VPattern::ParseRootElement(const Document &parse, const QDomNode &node) */ void VPattern::ParseDrawElement(const QDomNode &node, const Document &parse) { - QStringList tags{TagCalculation, TagModeling, TagDetails, TagGroups}; + QStringList const tags{TagCalculation, TagModeling, TagDetails, TagGroups}; QDomNode domNode = node.firstChild(); while (not domNode.isNull()) { @@ -2001,7 +2001,7 @@ void VPattern::ParseNodePoint(const QDomElement &domElement, const Document &par return; // Just ignore } - QSharedPointer p(new VPointF(*point)); + QSharedPointer const p(new VPointF(*point)); p->setIdObject(initData.idObject); p->setMode(Draw::Modeling); p->SetShowLabel(GetParametrBool(domElement, AttrShowLabel, trueStr)); @@ -2913,7 +2913,7 @@ void VPattern::ParseOldToolSplinePath(VMainGraphicsScene *scene, QDomElement &do QLineF line(0, 0, 100, 0); line.setAngle(angle + 180); - VFSplinePoint splPoint(p, kAsm1, line.angle(), kAsm2, angle); + VFSplinePoint const splPoint(p, kAsm1, line.angle(), kAsm2, angle); points.append(splPoint); if (parse == Document::FullParse) { @@ -3646,7 +3646,7 @@ auto VPattern::MakeEmptyIncrement(const QString &name, IncrementType type) -> QD //--------------------------------------------------------------------------------------------------------------------- auto VPattern::FindIncrement(const QString &name) const -> QDomElement { - QDomNodeList list = elementsByTagName(TagIncrement); + QDomNodeList const list = elementsByTagName(TagIncrement); for (int i = 0; i < list.size(); ++i) { @@ -3669,7 +3669,7 @@ void VPattern::GarbageCollector(bool commit) { bool cleared = false; - QDomNodeList modelingList = elementsByTagName(TagModeling); + QDomNodeList const modelingList = elementsByTagName(TagModeling); for (int i = 0; i < modelingList.size(); ++i) { QDomElement modElement = modelingList.at(i).toElement(); @@ -3679,7 +3679,7 @@ void VPattern::GarbageCollector(bool commit) while (not modNode.isNull()) { // First get next sibling because later will not have chance to get it - QDomElement nextSibling = modNode.nextSibling().toElement(); + QDomElement const nextSibling = modNode.nextSibling().toElement(); if (modNode.hasAttribute(VAbstractTool::AttrInUse)) { const NodeUsage inUse = GetParametrUsage(modNode, VAbstractTool::AttrInUse); @@ -3698,7 +3698,7 @@ void VPattern::GarbageCollector(bool commit) // Clear history try { - vidtype id = GetParametrId(modNode); + vidtype const id = GetParametrId(modNode); auto record = std::find_if(history.begin(), history.end(), [id](const VToolRecord &record) { return record.getId() == id; }); @@ -3950,7 +3950,7 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, QDomElement &domEle ParseToolCubicBezierPath(scene, domElement, parse); break; default: - VException e(tr("Unknown spline type '%1'.").arg(type)); + VException const e(tr("Unknown spline type '%1'.").arg(type)); throw e; } } @@ -3970,9 +3970,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 arcs = QStringList() << VToolArc::ToolType /*0*/ - << VNodeArc::ToolType /*1*/ - << VToolArcWithLength::ToolType; /*2*/ + QStringList const arcs = QStringList() << VToolArc::ToolType /*0*/ + << VNodeArc::ToolType /*1*/ + << VToolArcWithLength::ToolType; /*2*/ switch (arcs.indexOf(type)) { @@ -3986,7 +3986,7 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen ParseToolArcWithLength(scene, domElement, parse); break; default: - VException e(tr("Unknown arc type '%1'.").arg(type)); + VException const e(tr("Unknown arc type '%1'.").arg(type)); throw e; } } @@ -4018,7 +4018,7 @@ void VPattern::ParseEllipticalArcElement(VMainGraphicsScene *scene, QDomElement ParseNodeEllipticalArc(domElement, parse); break; default: - VException e(tr("Unknown elliptical arc type '%1'.").arg(type)); + VException const e(tr("Unknown elliptical arc type '%1'.").arg(type)); throw e; } } @@ -4066,7 +4066,7 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d } break; default: - VException e(tr("Unknown tools type '%1'.").arg(type)); + VException const e(tr("Unknown tools type '%1'.").arg(type)); throw e; } } @@ -4099,7 +4099,7 @@ void VPattern::ParseOperationElement(VMainGraphicsScene *scene, QDomElement &dom ParseToolMove(scene, domElement, parse); break; default: - VException e(tr("Unknown operation type '%1'.").arg(type)); + VException const e(tr("Unknown operation type '%1'.").arg(type)); throw e; } } @@ -4342,7 +4342,7 @@ void VPattern::ReplaceNameInFormula(QVector &expressions, const Q // Eval formula try { - QScopedPointer cal( + QScopedPointer const cal( new qmu::QmuTokenParser(expressions.at(i).expression, false, false)); tokens = cal->GetTokens(); // Tokens (variables, measurements) } diff --git a/src/libs/fervor/fvupdater.cpp b/src/libs/fervor/fvupdater.cpp index 0b42d7fc2..6aa73dd14 100644 --- a/src/libs/fervor/fvupdater.cpp +++ b/src/libs/fervor/fvupdater.cpp @@ -201,7 +201,7 @@ void FvUpdater::SkipUpdate() { qDebug() << "Skip update"; - QPointer proposedUpdate = GetProposedUpdate(); + QPointer const proposedUpdate = GetProposedUpdate(); if (proposedUpdate.isNull()) { qWarning() << "Proposed update is NULL (shouldn't be at this point)"; @@ -229,7 +229,7 @@ void FvUpdater::UpdateInstallationConfirmed() { qDebug() << "Confirm update installation"; - QPointer proposedUpdate = GetProposedUpdate(); + QPointer const proposedUpdate = GetProposedUpdate(); if (proposedUpdate.isNull()) { qWarning() << "Proposed update is NULL (shouldn't be at this point)"; diff --git a/src/libs/fervor/fvupdatewindow.cpp b/src/libs/fervor/fvupdatewindow.cpp index dea67b7ac..6018262d6 100644 --- a/src/libs/fervor/fvupdatewindow.cpp +++ b/src/libs/fervor/fvupdatewindow.cpp @@ -60,7 +60,7 @@ FvUpdateWindow::~FvUpdateWindow() //--------------------------------------------------------------------------------------------------------------------- auto FvUpdateWindow::UpdateWindowWithCurrentProposedUpdate() -> bool { - QPointer proposedUpdate = FvUpdater::sharedUpdater()->GetProposedUpdate(); + QPointer const proposedUpdate = FvUpdater::sharedUpdater()->GetProposedUpdate(); if (proposedUpdate.isNull()) { return false; diff --git a/src/libs/ifc/ifcdef.cpp b/src/libs/ifc/ifcdef.cpp index 24000bb77..b32fe7aa2 100644 --- a/src/libs/ifc/ifcdef.cpp +++ b/src/libs/ifc/ifcdef.cpp @@ -222,7 +222,7 @@ auto PenStylePic(QColor backgroundColor, QColor textColor, Qt::PenStyle style) - QPixmap pix(80, 14); pix.fill(backgroundColor); - QPen pen(textColor, 2.5, style); + QPen const pen(textColor, 2.5, style); QPainter painter(&pix); painter.setPen(pen); diff --git a/src/libs/ifc/xml/utils.cpp b/src/libs/ifc/xml/utils.cpp index a53f21e78..bb0b3ebc3 100644 --- a/src/libs/ifc/xml/utils.cpp +++ b/src/libs/ifc/xml/utils.cpp @@ -50,7 +50,7 @@ auto IsMimeTypeImage(const QMimeType &mime) -> bool QStringList aliases = mime.aliases(); aliases.prepend(mime.name()); - static QRegularExpression rx(QStringLiteral("^image\\/[-\\w]+(\\.[-\\w]+)*([+][-\\w]+)?$")); + static QRegularExpression const rx(QStringLiteral("^image\\/[-\\w]+(\\.[-\\w]+)*([+][-\\w]+)?$")); return std::any_of(aliases.begin(), aliases.end(), [](const QString &name) { return rx.match(name).hasMatch(); }); } @@ -78,11 +78,11 @@ auto MimeTypeFromByteArray(const QByteArray &data) -> QMimeType QSet aliases = ConvertToSet(mime.aliases()); aliases.insert(mime.name()); - QSet gzipMime{"application/gzip", "application/x-gzip"}; + QSet const gzipMime{"application/gzip", "application/x-gzip"}; if (gzipMime.contains(aliases)) { - QSvgRenderer render(data); + QSvgRenderer const render(data); if (render.isValid()) { mime = QMimeDatabase().mimeTypeForName(QStringLiteral("image/svg+xml-compressed")); diff --git a/src/libs/ifc/xml/vabstractconverter.cpp b/src/libs/ifc/xml/vabstractconverter.cpp index f33c6a53d..ac0e0d16f 100644 --- a/src/libs/ifc/xml/vabstractconverter.cpp +++ b/src/libs/ifc/xml/vabstractconverter.cpp @@ -108,7 +108,7 @@ void VAbstractConverter::ReserveFile() const // It's not possible in all cases make conversion without lose data. // For such cases we will store old version in a reserve file. QString error; - QFileInfo info(m_convertedFileName); + QFileInfo const info(m_convertedFileName); const QString reserveFileName = u"%1/%2(v%3).%4.bak"_s.arg(info.absoluteDir().absolutePath(), info.baseName(), GetFormatVersionStr(), info.completeSuffix()); if (not SafeCopy(m_convertedFileName, reserveFileName, error)) @@ -196,7 +196,7 @@ void VAbstractConverter::ValidateXML(const QString &schema) const const char *schemaData = data.constData(); const auto schemaSize = static_cast(data.size()); - QScopedPointer grammarSource(new XERCES_CPP_NAMESPACE::MemBufInputSource( + QScopedPointer const grammarSource(new XERCES_CPP_NAMESPACE::MemBufInputSource( reinterpret_cast(schemaData), schemaSize, "schema")); if (domParser.loadGrammar(*grammarSource, XERCES_CPP_NAMESPACE::Grammar::SchemaGrammarType, true) == nullptr) @@ -236,7 +236,7 @@ void VAbstractConverter::ValidateXML(const QString &schema) const const char *patternData = patternFileData.constData(); const auto patternSize = static_cast(patternFileData.size()); - QScopedPointer patternSource(new XERCES_CPP_NAMESPACE::MemBufInputSource( + QScopedPointer const patternSource(new XERCES_CPP_NAMESPACE::MemBufInputSource( reinterpret_cast(patternData), patternSize, "pattern")); domParser.parse(*patternSource); @@ -375,7 +375,7 @@ void VAbstractConverter::SetVersion(const QString &version) if (setTagText(TagVersion, version) == false) { - VException e(tr("Could not change version.")); + VException const e(tr("Could not change version.")); throw e; } } diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 2e3063103..de59759eb 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -214,7 +214,7 @@ auto GetTokens(const VFormulaField &formula) -> QList { try { - QScopedPointer cal(new qmu::QmuTokenParser(formula.expression, false, false)); + QScopedPointer const cal(new qmu::QmuTokenParser(formula.expression, false, false)); return cal->GetTokens().values(); } catch (const qmu::QmuParserError &e) @@ -275,18 +275,18 @@ auto PrepareGroupTags(QStringList tags) -> QString //--------------------------------------------------------------------------------------------------------------------- auto StringToTransfrom(const QString &matrix) -> QTransform { - QStringList elements = matrix.split(';'_L1); + QStringList const elements = matrix.split(';'_L1); if (elements.count() == 9) { - qreal m11 = elements.at(0).toDouble(); - qreal m12 = elements.at(1).toDouble(); - qreal m13 = elements.at(2).toDouble(); - qreal m21 = elements.at(3).toDouble(); - qreal m22 = elements.at(4).toDouble(); - qreal m23 = elements.at(5).toDouble(); - qreal m31 = elements.at(6).toDouble(); - qreal m32 = elements.at(7).toDouble(); - qreal m33 = elements.at(8).toDouble(); + qreal const m11 = elements.at(0).toDouble(); + qreal const m12 = elements.at(1).toDouble(); + qreal const m13 = elements.at(2).toDouble(); + qreal const m21 = elements.at(3).toDouble(); + qreal const m22 = elements.at(4).toDouble(); + qreal const m23 = elements.at(5).toDouble(); + qreal const m31 = elements.at(6).toDouble(); + qreal const m32 = elements.at(7).toDouble(); + qreal const m33 = elements.at(8).toDouble(); return {m11, m12, m13, m21, m22, m23, m31, m32, m33}; } @@ -303,9 +303,9 @@ template auto NumberToString(T number) -> QString //--------------------------------------------------------------------------------------------------------------------- auto TransformToString(const QTransform &m) -> QString { - QStringList matrix{NumberToString(m.m11()), NumberToString(m.m12()), NumberToString(m.m13()), - NumberToString(m.m21()), NumberToString(m.m22()), NumberToString(m.m23()), - NumberToString(m.m31()), NumberToString(m.m32()), NumberToString(m.m33())}; + QStringList const matrix{NumberToString(m.m11()), NumberToString(m.m12()), NumberToString(m.m13()), + NumberToString(m.m21()), NumberToString(m.m22()), NumberToString(m.m23()), + NumberToString(m.m31()), NumberToString(m.m32()), NumberToString(m.m33())}; return matrix.join(';'_L1); } } // namespace @@ -560,7 +560,7 @@ auto VAbstractPattern::GetPPElement(const QString &name) -> QDomElement for (qint32 i = 0; i < elements.count(); i++) { - QDomElement element = elements.at(i).toElement(); + QDomElement const element = elements.at(i).toElement(); if (not element.isNull()) { if (element.attribute(AttrName) == name) @@ -1166,7 +1166,7 @@ auto VAbstractPattern::GetLabelTimeFormat() const -> QString return globalLabelTimeFormat; } - QDomElement tag = list.at(0).toElement(); + QDomElement const tag = list.at(0).toElement(); return GetParametrString(tag, AttrTimeFormat, globalLabelTimeFormat); } @@ -1385,7 +1385,7 @@ auto VAbstractPattern::GetImage() const -> VPatternImage const QDomNodeList list = elementsByTagName(TagImage); if (not list.isEmpty()) { - QDomElement imgTag = list.at(0).toElement(); + QDomElement const imgTag = list.at(0).toElement(); if (not imgTag.isNull()) { image.SetContentData(imgTag.text().toLatin1(), imgTag.attribute(AttrContentType)); @@ -1425,7 +1425,7 @@ auto VAbstractPattern::GetBackgroundImages() const -> QVector int { for (int i = 0; i < drawList.size(); ++i) { - QDomElement node = drawList.at(i).toElement(); + QDomElement const node = drawList.at(i).toElement(); if (node.attribute(AttrName) == nameActivPP) { index = i; @@ -2231,7 +2231,7 @@ auto VAbstractPattern::GetBackgroundPatternImage(const QDomElement &element) con { VBackgroundPatternImage image; image.SetId(QUuid(GetParametrEmptyString(element, AttrImageId))); - QString path = GetParametrEmptyString(element, AttrPath); + QString const path = GetParametrEmptyString(element, AttrPath); if (not path.isEmpty()) { @@ -2239,8 +2239,8 @@ auto VAbstractPattern::GetBackgroundPatternImage(const QDomElement &element) con } else { - QString contentType = GetParametrEmptyString(element, AttrContentType); - QByteArray contentData = element.text().toLatin1(); + QString const contentType = GetParametrEmptyString(element, AttrContentType); + QByteArray const contentData = element.text().toLatin1(); image.SetContentData(contentData, contentType); } @@ -2253,7 +2253,7 @@ auto VAbstractPattern::GetBackgroundPatternImage(const QDomElement &element) con image.SetOpacity( GetParametrDouble(element, AttrOpacity, QString::number(settings->GetBackgroundImageDefOpacity() / 100.))); - QString matrix = GetParametrEmptyString(element, AttrTransform); + QString const matrix = GetParametrEmptyString(element, AttrTransform); image.SetMatrix(StringToTransfrom(matrix)); return image; @@ -2265,7 +2265,7 @@ auto VAbstractPattern::GetBackgroundImageElement(const QUuid &id) const -> QDomE const QDomNodeList list = elementsByTagName(TagBackgroundImages); if (not list.isEmpty()) { - QDomElement imagesTag = list.at(0).toElement(); + QDomElement const imagesTag = list.at(0).toElement(); if (not imagesTag.isNull()) { QDomNode imageNode = imagesTag.firstChild(); @@ -2276,7 +2276,7 @@ auto VAbstractPattern::GetBackgroundImageElement(const QUuid &id) const -> QDomE const QDomElement imageElement = imageNode.toElement(); if (not imageElement.isNull()) { - QUuid imageId = QUuid(GetParametrEmptyString(imageElement, AttrImageId)); + QUuid const imageId = QUuid(GetParametrEmptyString(imageElement, AttrImageId)); if (imageId == id) { return imageElement; @@ -2345,7 +2345,7 @@ auto VAbstractPattern::GetDraw(const QString &name) const -> QDomElement const QDomNodeList draws = documentElement().elementsByTagName(TagDraw); for (int i = 0; i < draws.size(); ++i) { - QDomElement draw = draws.at(i).toElement(); + QDomElement const draw = draws.at(i).toElement(); if (draw.isNull()) { continue; @@ -2448,7 +2448,7 @@ auto VAbstractPattern::GroupLinkedToTool(vidtype toolId) const -> vidtype auto VAbstractPattern::GetGroupName(quint32 id) -> QString { QString name = QCoreApplication::translate("VAbstractPattern", "New group"); - QDomElement group = elementById(id, TagGroup); + QDomElement const group = elementById(id, TagGroup); if (group.isElement()) { name = GetParametrString(group, AttrName, name); @@ -2473,7 +2473,7 @@ void VAbstractPattern::SetGroupName(quint32 id, const QString &name) auto VAbstractPattern::GetGroupTags(vidtype id) -> QStringList { QStringList tags; - QDomElement group = elementById(id, TagGroup); + QDomElement const group = elementById(id, TagGroup); if (group.isElement()) { tags = FilterGroupTags(GetParametrEmptyString(group, AttrTags)); @@ -2498,7 +2498,7 @@ void VAbstractPattern::SetGroupTags(quint32 id, const QStringList &tags) //--------------------------------------------------------------------------------------------------------------------- auto VAbstractPattern::GetDimensionAValue() -> double { - QDomElement domElement = UniqueTag(TagMeasurements); + QDomElement const domElement = UniqueTag(TagMeasurements); if (not domElement.isNull()) { return GetParametrDouble(domElement, AttrDimensionA, *dimensionDefValue); @@ -2527,7 +2527,7 @@ void VAbstractPattern::SetDimensionAValue(double value) //--------------------------------------------------------------------------------------------------------------------- auto VAbstractPattern::GetDimensionBValue() -> double { - QDomElement domElement = UniqueTag(TagMeasurements); + QDomElement const domElement = UniqueTag(TagMeasurements); if (not domElement.isNull()) { return GetParametrDouble(domElement, AttrDimensionB, *dimensionDefValue); @@ -2556,7 +2556,7 @@ void VAbstractPattern::SetDimensionBValue(double value) //--------------------------------------------------------------------------------------------------------------------- auto VAbstractPattern::GetDimensionCValue() -> double { - QDomElement domElement = UniqueTag(TagMeasurements); + QDomElement const domElement = UniqueTag(TagMeasurements); if (not domElement.isNull()) { return GetParametrDouble(domElement, AttrDimensionC, *dimensionDefValue); @@ -2593,7 +2593,7 @@ auto VAbstractPattern::GetGroupCategories() const -> QStringList const QDomElement group = groups.at(i).toElement(); if (not group.isNull() && group.hasAttribute(AttrTags)) { - QStringList groupTags = VAbstractPattern::FilterGroupTags(GetParametrEmptyString(group, AttrTags)); + QStringList const groupTags = VAbstractPattern::FilterGroupTags(GetParametrEmptyString(group, AttrTags)); categories.unite(ConvertToSet(groupTags)); } } @@ -2608,7 +2608,7 @@ auto VAbstractPattern::GetGroups(const QString &patternPieceName) -> QMap QString //--------------------------------------------------------------------------------------------------------------------- auto VAbstractPattern::ReadMPath() const -> QString { - QDomElement domElement = UniqueTag(TagMeasurements); + QDomElement const domElement = UniqueTag(TagMeasurements); if (not domElement.isNull()) { return domElement.attribute(AttrPath); @@ -2862,7 +2862,7 @@ auto VAbstractPattern::AddItemToGroup(quint32 toolId, quint32 objectId, quint32 emit UpdateGroups(); // parse the groups to update the drawing, in case the item was added to an invisible group - QDomElement groups = CreateGroups(); + QDomElement const groups = CreateGroups(); if (not groups.isNull()) { ParseGroups(groups); @@ -2902,8 +2902,8 @@ auto VAbstractPattern::RemoveItemFromGroup(quint32 toolId, quint32 objectId, qui const QDomElement item = itemNode.toElement(); if (not item.isNull()) { - quint32 toolIdIterate = GetParametrUInt(item, AttrTool, QChar('0')); - quint32 objectIdIterate = GetParametrUInt(item, AttrObject, QString::number(toolIdIterate)); + quint32 const toolIdIterate = GetParametrUInt(item, AttrTool, QChar('0')); + quint32 const objectIdIterate = GetParametrUInt(item, AttrObject, QString::number(toolIdIterate)); if (toolIdIterate == toolId && objectIdIterate == objectId) { @@ -2917,7 +2917,7 @@ auto VAbstractPattern::RemoveItemFromGroup(quint32 toolId, quint32 objectId, qui emit UpdateGroups(); // parse the groups to update the drawing, in case the item was removed from an invisible group - QDomElement groups = CreateGroups(); + QDomElement const groups = CreateGroups(); if (not groups.isNull()) { ParseGroups(groups); @@ -2941,7 +2941,7 @@ auto VAbstractPattern::RemoveItemFromGroup(quint32 toolId, quint32 objectId, qui //--------------------------------------------------------------------------------------------------------------------- auto VAbstractPattern::GetGroupVisibility(quint32 id) -> bool { - QDomElement group = elementById(id, TagGroup); + QDomElement const group = elementById(id, TagGroup); if (group.isElement()) { return GetParametrBool(group, AttrVisible, trueStr); diff --git a/src/libs/ifc/xml/vbackgroundpatternimage.cpp b/src/libs/ifc/xml/vbackgroundpatternimage.cpp index 441290307..cfe15e1c1 100644 --- a/src/libs/ifc/xml/vbackgroundpatternimage.cpp +++ b/src/libs/ifc/xml/vbackgroundpatternimage.cpp @@ -85,7 +85,7 @@ auto VBackgroundPatternImage::FromFile(const QString &fileName, bool builtIn) -> QT_WARNING_POP - QMimeType mime = QMimeDatabase().mimeTypeForFile(fileName); + QMimeType const mime = QMimeDatabase().mimeTypeForFile(fileName); if (not IsMimeTypeImage(mime)) { @@ -102,7 +102,7 @@ auto VBackgroundPatternImage::FromFile(const QString &fileName, bool builtIn) -> return {}; } - QString base64 = SplitString(QString::fromLatin1(file.readAll().toBase64().data())).join('\n'_L1); + QString const base64 = SplitString(QString::fromLatin1(file.readAll().toBase64().data())).join('\n'_L1); image.SetContentData(base64.toLatin1(), mime.name()); } else @@ -159,7 +159,7 @@ auto VBackgroundPatternImage::IsValid() const -> bool if (not m_filePath.isEmpty()) { - QMimeType mime = MimeTypeFromData(); + QMimeType const mime = MimeTypeFromData(); if (not IsMimeTypeImage(mime)) { @@ -175,7 +175,7 @@ auto VBackgroundPatternImage::IsValid() const -> bool return false; } - QMimeType mime = MimeTypeFromData(); + QMimeType const mime = MimeTypeFromData(); QSet aliases = ConvertToSet(mime.aliases()); aliases.insert(mime.name()); @@ -326,7 +326,7 @@ auto VBackgroundPatternImage::Type() const -> PatternImage return PatternImage::Unknown; } - QMimeType mime = MimeTypeFromData(); + QMimeType const mime = MimeTypeFromData(); if (mime.name().startsWith(QStringLiteral("image/svg+xml"))) { @@ -339,8 +339,8 @@ auto VBackgroundPatternImage::Type() const -> PatternImage //--------------------------------------------------------------------------------------------------------------------- auto VBackgroundPatternImage::BoundingRect() const -> QRectF { - QSize imageSize = Size(); - QRectF imageRect({0, 0}, QSizeF(imageSize.width(), imageSize.height())); + QSize const imageSize = Size(); + QRectF const imageRect({0, 0}, QSizeF(imageSize.width(), imageSize.height())); return m_matrix.mapRect(imageRect); } @@ -379,7 +379,7 @@ auto VBackgroundPatternImage::LinkedImageSize() const -> QSize if (Type() == PatternImage::Vector) { - QSvgRenderer renderer(m_filePath); + QSvgRenderer const renderer(m_filePath); return not renderer.isValid() ? ScaleVectorImage(QSvgRenderer(brokenImage)) : ScaleVectorImage(renderer); } @@ -402,7 +402,7 @@ auto VBackgroundPatternImage::BuiltInImageSize() const -> QSize if (Type() == PatternImage::Vector) { - QSvgRenderer renderer(array); + QSvgRenderer const renderer(array); return not renderer.isValid() ? ScaleVectorImage(QSvgRenderer(brokenImage)) : ScaleVectorImage(renderer); } diff --git a/src/libs/ifc/xml/vdomdocument.cpp b/src/libs/ifc/xml/vdomdocument.cpp index fceac1248..94a08b84e 100644 --- a/src/libs/ifc/xml/vdomdocument.cpp +++ b/src/libs/ifc/xml/vdomdocument.cpp @@ -137,7 +137,7 @@ void SaveNodeCanonically(QXmlStreamWriter &stream, const QDomNode &domNode) //--------------------------------------------------------------------------------------------------------------------- auto GetChildElements(const QDomNode &e) -> QList { - QDomNodeList children = e.childNodes(); + QDomNodeList const children = e.childNodes(); QList r; r.reserve(children.size()); for (int k = 0; k < children.size(); ++k) @@ -150,7 +150,7 @@ auto GetChildElements(const QDomNode &e) -> QList //--------------------------------------------------------------------------------------------------------------------- auto GetElementAttributes(const QDomNode &e) -> QList { - QDomNamedNodeMap attributes = e.attributes(); + QDomNamedNodeMap const attributes = e.attributes(); QList r; r.reserve(attributes.size()); for (int k = 0; k < attributes.size(); ++k) @@ -168,8 +168,8 @@ auto LessThen(const QDomNode &element1, const QDomNode &element2) -> bool return element1.nodeType() < element2.nodeType(); } - QString tag1 = element1.nodeName(); - QString tag2 = element2.nodeName(); + QString const tag1 = element1.nodeName(); + QString const tag2 = element2.nodeName(); // qDebug() << tag1 < bool } // Compare attributes - QList attributes1 = GetElementAttributes(element1); - QList attributes2 = GetElementAttributes(element2); + QList const attributes1 = GetElementAttributes(element1); + QList const attributes2 = GetElementAttributes(element2); if (attributes1.size() != attributes2.size()) { @@ -221,10 +221,11 @@ auto LessThen(const QDomNode &element1, const QDomNode &element2) -> bool } // Compare children - QList elts1 = GetChildElements(element1); - QList elts2 = GetChildElements(element2); + QList const elts1 = GetChildElements(element1); + QList const elts2 = GetChildElements(element2); - QString value1, value2; + QString value1; + QString value2; if (elts1.size() != elts2.size()) { @@ -660,7 +661,7 @@ auto VDomDocument::GetParametrId(const QDomElement &domElement) -> quint32 //--------------------------------------------------------------------------------------------------------------------- auto VDomDocument::UniqueTagText(const QString &tagName, const QString &defVal) const -> QString { - QDomElement domElement = UniqueTag(tagName); + QDomElement const domElement = UniqueTag(tagName); if (not domElement.isNull()) { const QString text = domElement.text(); @@ -720,7 +721,7 @@ void VDomDocument::RefreshElementIdCache() //--------------------------------------------------------------------------------------------------------------------- auto VDomDocument::Compare(const QDomElement &element1, const QDomElement &element2) -> bool { - QFuture lessThen2 = QtConcurrent::run(LessThen, element2, element1); + QFuture const lessThen2 = QtConcurrent::run(LessThen, element2, element1); return !LessThen(element1, element2) && !lessThen2.result(); } @@ -809,8 +810,8 @@ auto VDomDocument::SaveDocument(const QString &fileName, QString &error) -> bool if (success) { // https://stackoverflow.com/questions/74051505/does-qsavefilecommit-fsync-the-file-to-the-filesystem - QString directoryPath = QFileInfo(file.fileName()).absoluteDir().path(); - int dirFd = ::open(directoryPath.toLocal8Bit().data(), O_RDONLY | O_DIRECTORY); + QString const directoryPath = QFileInfo(file.fileName()).absoluteDir().path(); + int const dirFd = ::open(directoryPath.toLocal8Bit().data(), O_RDONLY | O_DIRECTORY); if (dirFd != -1) { ::fsync(dirFd); @@ -832,8 +833,8 @@ auto VDomDocument::SaveDocument(const QString &fileName, QString &error) -> bool // cppcheck-suppress unusedFunction auto VDomDocument::Major() const -> QString { - QString version = UniqueTagText(TagVersion, "0.0.0"_L1); - QStringList v = version.split('.'_L1); + QString const version = UniqueTagText(TagVersion, "0.0.0"_L1); + QStringList const v = version.split('.'_L1); return v.at(0); } @@ -841,8 +842,8 @@ auto VDomDocument::Major() const -> QString // cppcheck-suppress unusedFunction auto VDomDocument::Minor() const -> QString { - QString version = UniqueTagText(TagVersion, "0.0.0"_L1); - QStringList v = version.split('.'_L1); + QString const version = UniqueTagText(TagVersion, "0.0.0"_L1); + QStringList const v = version.split('.'_L1); return v.at(1); } @@ -850,8 +851,8 @@ auto VDomDocument::Minor() const -> QString // cppcheck-suppress unusedFunction auto VDomDocument::Patch() const -> QString { - QString version = UniqueTagText(TagVersion, "0.0.0"_L1); - QStringList v = version.split('.'_L1); + QString const version = UniqueTagText(TagVersion, "0.0.0"_L1); + QStringList const v = version.split('.'_L1); return v.at(2); } @@ -924,7 +925,7 @@ auto VDomDocument::setTagText(const QString &tag, const QString &text) -> bool } else { - QDomNode domNode = nodeList.at(0); + QDomNode const domNode = nodeList.at(0); if (not domNode.isNull() && domNode.isElement()) { QDomElement domElement = domNode.toElement(); @@ -939,7 +940,7 @@ auto VDomDocument::setTagText(QDomElement &domElement, const QString &text) -> b { if (not domElement.isNull()) { - QDomNode oldText = domElement.firstChild(); + QDomNode const oldText = domElement.firstChild(); const QDomText newText = createTextNode(text); if (oldText.isNull()) @@ -1004,21 +1005,21 @@ void VDomDocument::RemoveAllChildren(QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- auto VDomDocument::ParentNodeById(const quint32 &nodeId) -> QDomNode { - QDomElement domElement = NodeById(nodeId); + QDomElement const domElement = NodeById(nodeId); return domElement.parentNode(); } //--------------------------------------------------------------------------------------------------------------------- auto VDomDocument::CloneNodeById(const quint32 &nodeId) -> QDomElement { - QDomElement domElement = NodeById(nodeId); + QDomElement const domElement = NodeById(nodeId); return domElement.cloneNode().toElement(); } //--------------------------------------------------------------------------------------------------------------------- auto VDomDocument::NodeById(const quint32 &nodeId, const QString &tagName) -> QDomElement { - QDomElement domElement = elementById(nodeId, tagName); + QDomElement const domElement = elementById(nodeId, tagName); if (domElement.isNull() || domElement.isElement() == false) { throw VExceptionBadId(tr("Couldn't get node"), nodeId); diff --git a/src/libs/ifc/xml/vknownmeasurementsconverter.cpp b/src/libs/ifc/xml/vknownmeasurementsconverter.cpp index 4051ceb39..934e6a468 100644 --- a/src/libs/ifc/xml/vknownmeasurementsconverter.cpp +++ b/src/libs/ifc/xml/vknownmeasurementsconverter.cpp @@ -61,7 +61,7 @@ VKnownMeasurementsConverter::VKnownMeasurementsConverter(const QString &fileName //--------------------------------------------------------------------------------------------------------------------- auto VKnownMeasurementsConverter::GetFormatVersionStr() const -> QString { - QDomNode root = documentElement(); + QDomNode const root = documentElement(); if (not root.isNull() && root.isElement()) { const QDomElement layoutElement = root.toElement(); diff --git a/src/libs/ifc/xml/vlayoutconverter.cpp b/src/libs/ifc/xml/vlayoutconverter.cpp index 08877d22a..d508837e6 100644 --- a/src/libs/ifc/xml/vlayoutconverter.cpp +++ b/src/libs/ifc/xml/vlayoutconverter.cpp @@ -86,7 +86,7 @@ const QChar pointsSep = ' '_L1; //--------------------------------------------------------------------------------------------------------------------- auto StringV0_1_2ToPoint(const QString &point) -> QPointF { - QStringList coordinates = point.split(coordintatesSep); + QStringList const coordinates = point.split(coordintatesSep); if (coordinates.count() == 2) { return {coordinates.at(0).toDouble(), coordinates.at(1).toDouble()}; @@ -99,7 +99,7 @@ auto StringV0_1_2ToPoint(const QString &point) -> QPointF auto StringV0_1_2ToPath(const QString &path) -> QVector { QVector p; - QStringList points = path.split(pointsSep); + QStringList const points = path.split(pointsSep); p.reserve(points.size()); for (const auto &point : points) { @@ -128,7 +128,7 @@ VLayoutConverter::VLayoutConverter(const QString &fileName) //--------------------------------------------------------------------------------------------------------------------- auto VLayoutConverter::GetFormatVersionStr() const -> QString { - QDomNode root = documentElement(); + QDomNode const root = documentElement(); if (not root.isNull() && root.isElement()) { const QDomElement layoutElement = root.toElement(); @@ -232,7 +232,7 @@ void VLayoutConverter::ConvertPiecesToV0_1_3() for (const auto &tagType : types) { - QDomNodeList tags = elementsByTagName(tagType); + QDomNodeList const tags = elementsByTagName(tagType); for (int i = 0; i < tags.size(); ++i) { QDomElement node = tags.at(i).toElement(); @@ -240,14 +240,14 @@ void VLayoutConverter::ConvertPiecesToV0_1_3() } } - QDomNodeList tags = elementsByTagName(*strMarkerTag); + QDomNodeList const tags = elementsByTagName(*strMarkerTag); for (int i = 0; i < tags.size(); ++i) { QDomElement node = tags.at(i).toElement(); RemoveAllChildren(node); } - QDomNodeList pieceTags = elementsByTagName(*strPieceTag); + QDomNodeList const pieceTags = elementsByTagName(*strPieceTag); for (int i = 0; i < pieceTags.size(); ++i) { QDomElement node = pieceTags.at(i).toElement(); @@ -262,7 +262,7 @@ void VLayoutConverter::ConvertPiecesToV0_1_3() //--------------------------------------------------------------------------------------------------------------------- void VLayoutConverter::ConvertPathToV0_1_3(QDomElement &node) { - QString oldPath = node.text(); + QString const oldPath = node.text(); if (oldPath.isEmpty()) { return; @@ -298,7 +298,7 @@ void VLayoutConverter::ConvertPiecesToV0_1_5() // TODO. Delete if minimal supported version is 0.1.5 Q_STATIC_ASSERT_X(VLayoutConverter::LayoutMinVer < FormatVersion(0, 1, 5), "Time to refactor the code."); - QDomNodeList grainlineTags = elementsByTagName(*strGrainlineTag); + QDomNodeList const grainlineTags = elementsByTagName(*strGrainlineTag); for (int i = 0; i < grainlineTags.size(); ++i) { QDomElement node = grainlineTags.at(i).toElement(); @@ -313,7 +313,7 @@ void VLayoutConverter::ConvertPiecesToV0_1_5() // convert arrowDirection if (node.hasAttribute(*strAttrArrowDirection)) { - QString arrowDirection = node.attribute(*strAttrArrowDirection); + QString const arrowDirection = node.attribute(*strAttrArrowDirection); const QStringList arrows{ "atFront", // 0 @@ -392,7 +392,7 @@ void VLayoutConverter::ConvertPiecesToV0_1_7() // TODO. Delete if minimal supported version is 0.1.7 Q_STATIC_ASSERT_X(VLayoutConverter::LayoutMinVer < FormatVersion(0, 1, 7), "Time to refactor the code."); - QDomNodeList pieceTags = elementsByTagName(*strPieceTag); + QDomNodeList const pieceTags = elementsByTagName(*strPieceTag); for (int i = 0; i < pieceTags.size(); ++i) { QDomElement node = pieceTags.at(i).toElement(); diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index 48b767a62..43b5096c4 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -1142,7 +1142,7 @@ auto VPatternConverter::TagMeasurementsV0_1_4() const -> QDomElement const QDomElement element = list.at(0).toElement(); if (not element.isElement()) { - VException excep("Can't get tag measurements."); + VException const excep("Can't get tag measurements."); throw excep; } return element; @@ -1158,7 +1158,7 @@ auto VPatternConverter::TagIncrementsV0_1_4() const -> QDomElement const QDomElement element = list.at(0).toElement(); if (not element.isElement()) { - VException excep("Can't get tag measurements."); + VException const excep("Can't get tag measurements."); throw excep; } return element; @@ -1170,7 +1170,7 @@ void VPatternConverter::FixToolUnionToV0_2_4() // TODO. Delete if minimal supported version is 0.2.4 Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 4), "Time to refactor the code."); - QDomElement root = documentElement(); + QDomElement const root = documentElement(); const QDomNodeList modelings = root.elementsByTagName(*strModeling); for (int i = 0; i < modelings.size(); ++i) { @@ -1440,7 +1440,7 @@ void VPatternConverter::FixCutPoint() const QDomNodeList list = elementsByTagName(*strPoint); for (int i = 0; i < list.size(); ++i) { - QDomElement element = list.at(i).toElement(); + QDomElement const element = list.at(i).toElement(); if (not element.isNull()) { const QString type = element.attribute(*strType); @@ -1449,21 +1449,21 @@ void VPatternConverter::FixCutPoint() case 0: // strCutSplinePath { const quint32 id = element.attribute(*strId).toUInt(); - quint32 curve = element.attribute(*strSplinePath).toUInt(); + quint32 const curve = element.attribute(*strSplinePath).toUInt(); FixSubPaths(i, id, curve); break; } case 1: // strCutSpline { const quint32 id = element.attribute(*strId).toUInt(); - quint32 curve = element.attribute(*strSpline).toUInt(); + quint32 const curve = element.attribute(*strSpline).toUInt(); FixSubPaths(i, id, curve); break; } case 2: // strCutArc { const quint32 id = element.attribute(*strId).toUInt(); - quint32 curve = element.attribute(*strArc).toUInt(); + quint32 const curve = element.attribute(*strArc).toUInt(); FixSubPaths(i, id, curve); break; } @@ -1617,7 +1617,7 @@ void VPatternConverter::TagRemoveAttributeTypeObjectInV0_4_0() const QDomNodeList list = elementsByTagName(*strModeling); for (int i = 0; i < list.size(); ++i) { - QDomElement modeling = list.at(i).toElement(); + QDomElement const modeling = list.at(i).toElement(); if (not modeling.isNull()) { QDomNode domNode = modeling.firstChild(); @@ -1767,7 +1767,7 @@ auto VPatternConverter::GetUnionChildrenNodesV0_4_0(const QDomElement &detail) - const QDomElement node = childList.at(i).toElement(); if (not node.isNull()) { - QDomElement tagNode = node.cloneNode().toElement(); + QDomElement const tagNode = node.cloneNode().toElement(); tagNodes.appendChild(tagNode); } } @@ -1805,7 +1805,7 @@ void VPatternConverter::LabelTagToV0_4_4(const QString &tagName) { if (dom.hasAttribute(attribute)) { - QString valStr = dom.attribute(attribute, QChar('1')); + QString const valStr = dom.attribute(attribute, QChar('1')); bool ok = false; qreal val = valStr.toDouble(&ok); if (not ok) @@ -1842,7 +1842,7 @@ auto VPatternConverter::AddTagPatternLabelV0_5_1() -> QDomElement << *strGradation << *strPatternName << *strPatternNum << *strCompanyName << *strCustomerName << *strPatternLabel; - QDomElement element = createElement(*strPatternLabel); + QDomElement const element = createElement(*strPatternLabel); QDomElement pattern = documentElement(); for (vsizetype i = tags.indexOf(element.tagName()) - 1; i >= 0; --i) { @@ -1937,7 +1937,7 @@ void VPatternConverter::PortPieceLabelstoV0_6_0() for (int i = 0; i < nodeList.size(); ++i) { QDomElement dataTag = nodeList.at(i).toElement(); - QDomNodeList nodeListMCP = dataTag.childNodes(); + QDomNodeList const nodeListMCP = dataTag.childNodes(); const int count = nodeListMCP.count(); try { @@ -1957,7 +1957,7 @@ void VPatternConverter::PortPieceLabelstoV0_6_0() for (int iMCP = 0; iMCP < count; ++iMCP) { - QDomElement domMCP = nodeListMCP.at(iMCP).toElement(); + QDomElement const domMCP = nodeListMCP.at(iMCP).toElement(); QString line; @@ -2026,7 +2026,7 @@ void VPatternConverter::RemoveUnusedTagsV0_6_0() RemoveUniqueTagV0_6_0(*strShowDate); RemoveUniqueTagV0_6_0(*strShowMeasurements); - QDomNodeList nodeList = elementsByTagName(*strData); + QDomNodeList const nodeList = elementsByTagName(*strData); for (int i = 0; i < nodeList.size(); ++i) { QDomElement child = nodeList.at(i).firstChildElement(*strMCP); @@ -2074,7 +2074,7 @@ void VPatternConverter::RemoveGradationV0_8_8() QDomElement patternElement = documentElement(); if (patternElement.isElement()) { - QDomElement gradationTag = patternElement.firstChildElement(*strGradation); + QDomElement const gradationTag = patternElement.firstChildElement(*strGradation); if (gradationTag.isElement()) { patternElement.removeChild(gradationTag); @@ -2112,12 +2112,13 @@ void VPatternConverter::ConvertImageToV0_9_0() QDomElement img = list.at(0).toElement(); if (not img.isNull()) { - QString extension = img.attribute(*strExtension); + QString const extension = img.attribute(*strExtension); img.removeAttribute(*strExtension); if (not extension.isEmpty()) { - QMap mimeTypes{{"BMP", "image/bmp"}, {"JPG", "image/jpeg"}, {"PNG", "image/png"}}; + QMap const mimeTypes{ + {"BMP", "image/bmp"}, {"JPG", "image/jpeg"}, {"PNG", "image/png"}}; if (mimeTypes.contains(extension)) { @@ -2143,7 +2144,7 @@ void VPatternConverter::ConvertImageToV0_9_0() return list; }; - QStringList data = SplitString(); + QStringList const data = SplitString(); setTagText(img, data.join("\n")); } } diff --git a/src/libs/ifc/xml/vpatternimage.cpp b/src/libs/ifc/xml/vpatternimage.cpp index b7ef0a90f..8d20b157b 100644 --- a/src/libs/ifc/xml/vpatternimage.cpp +++ b/src/libs/ifc/xml/vpatternimage.cpp @@ -53,7 +53,7 @@ using namespace Qt::Literals::StringLiterals; auto VPatternImage::FromFile(const QString &fileName) -> VPatternImage { VPatternImage image; - QMimeType mime = QMimeDatabase().mimeTypeForFile(fileName); + QMimeType const mime = QMimeDatabase().mimeTypeForFile(fileName); if (not IsMimeTypeImage(mime)) { @@ -68,7 +68,7 @@ auto VPatternImage::FromFile(const QString &fileName) -> VPatternImage return {}; } - QString base64 = SplitString(QString::fromLatin1(file.readAll().toBase64().data())).join('\n'_L1); + QString const base64 = SplitString(QString::fromLatin1(file.readAll().toBase64().data())).join('\n'_L1); image.SetContentData(base64.toLatin1(), mime.name()); return image; @@ -116,7 +116,7 @@ auto VPatternImage::IsValid() const -> bool return false; } - QMimeType mime = MimeTypeFromData(); + QMimeType const mime = MimeTypeFromData(); QSet aliases = ConvertToSet(mime.aliases()); aliases.insert(mime.name()); @@ -148,7 +148,7 @@ auto VPatternImage::GetPixmap() const -> QPixmap buffer.open(QIODevice::ReadOnly); QImageReader imageReader(&buffer); - QImage image = imageReader.read(); + QImage const image = imageReader.read(); if (image.isNull()) { qCritical() << tr("Couldn't read the image. Error: %1").arg(imageReader.errorString()); @@ -179,7 +179,7 @@ auto VPatternImage::GetPixmap(const QSize &size) const -> QPixmap QImageReader imageReader(&buffer); imageReader.setScaledSize(size); - QImage image = imageReader.read(); + QImage const image = imageReader.read(); if (image.isNull()) { qCritical() << tr("Couldn't read the image. Error: %1").arg(imageReader.errorString()); diff --git a/src/libs/ifc/xml/vvitconverter.cpp b/src/libs/ifc/xml/vvitconverter.cpp index 71cf064a1..f690e01ed 100644 --- a/src/libs/ifc/xml/vvitconverter.cpp +++ b/src/libs/ifc/xml/vvitconverter.cpp @@ -256,7 +256,7 @@ void VVITConverter::GenderV0_3_1() Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 1), "Time to refactor the code."); const QDomNodeList nodeList = this->elementsByTagName(QStringLiteral("sex")); - QDomElement sex = nodeList.at(0).toElement(); + QDomElement const sex = nodeList.at(0).toElement(); QDomElement parent = sex.parentNode().toElement(); parent.replaceChild(CreateElementWithText(QStringLiteral("gender"), sex.text()), sex); } @@ -268,7 +268,7 @@ void VVITConverter::PM_SystemV0_3_2() Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 2), "Time to refactor the code."); const QDomNodeList nodeList = this->elementsByTagName(QStringLiteral("personal")); - QDomElement personal = nodeList.at(0).toElement(); + QDomElement const personal = nodeList.at(0).toElement(); QDomElement parent = personal.parentNode().toElement(); parent.insertBefore(CreateElementWithText(QStringLiteral("pm_system"), QStringLiteral("998")), personal); @@ -323,7 +323,7 @@ void VVITConverter::ConvertCustomerNameToV0_4_0() const QDomNodeList givenNameList = this->elementsByTagName(*strGivenName); if (not givenNameList.isEmpty()) { - QDomNode givenNameNode = givenNameList.at(0); + QDomNode const givenNameNode = givenNameList.at(0); givenName = givenNameNode.toElement().text(); personal.removeChild(givenNameNode); } @@ -333,7 +333,7 @@ void VVITConverter::ConvertCustomerNameToV0_4_0() const QDomNodeList familyNameList = this->elementsByTagName(*strFamilyName); if (not familyNameList.isEmpty()) { - QDomNode familyNameNode = familyNameList.at(0); + QDomNode const familyNameNode = familyNameList.at(0); familyName = familyNameNode.toElement().text(); personal.removeChild(familyNameNode); } diff --git a/src/libs/ifc/xml/vvstconverter.cpp b/src/libs/ifc/xml/vvstconverter.cpp index 3802a9987..5b9e47a26 100644 --- a/src/libs/ifc/xml/vvstconverter.cpp +++ b/src/libs/ifc/xml/vvstconverter.cpp @@ -236,7 +236,7 @@ void VVSTConverter::ConvertMeasurementsToV0_4_0() continue; } - QDomElement m = nodeList.at(0).toElement(); + QDomElement const m = nodeList.at(0).toElement(); const qreal value = GetParametrDouble(m, QStringLiteral("value"), QStringLiteral("0.0")); const qreal size_increase = GetParametrDouble(m, QStringLiteral("size_increase"), QStringLiteral("0.0")); const qreal height_increase = @@ -284,7 +284,7 @@ void VVSTConverter::PM_SystemV0_4_1() Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 1), "Time to refactor the code."); const QDomNodeList nodeList = this->elementsByTagName(QStringLiteral("size")); - QDomElement personal = nodeList.at(0).toElement(); + QDomElement const personal = nodeList.at(0).toElement(); QDomElement parent = personal.parentNode().toElement(); parent.insertBefore(CreateElementWithText(QStringLiteral("pm_system"), QStringLiteral("998")), personal); @@ -434,7 +434,7 @@ void VVSTConverter::ConvertCircumferenceAttreibuteToV0_5_4() QDomElement dom = list.at(i).toElement(); if (dom.hasAttribute(*strAttrCircumference)) { - bool m = GetParametrBool(dom, *strAttrCircumference, trueStr); + bool const m = GetParametrBool(dom, *strAttrCircumference, trueStr); dom.removeAttribute(*strAttrCircumference); SetAttribute(dom, *strAttrMeasurement, m); } diff --git a/src/libs/qmuparser/qmudef.cpp b/src/libs/qmuparser/qmudef.cpp index 0c5da1ffe..9cb73137e 100644 --- a/src/libs/qmuparser/qmudef.cpp +++ b/src/libs/qmuparser/qmudef.cpp @@ -180,8 +180,8 @@ auto ReadVal(const QString &formula, qreal &val, const QLocale &locale, const QC Q_UNUSED(decimalPoint) Q_UNUSED(groupSeparator) - QSet reserved{positiveSign, negativeSign, sign0, sign1, sign2, sign3, sign4, - sign5, sign6, sign7, sign8, sign9, expUpper, expLower}; + QSet const reserved{positiveSign, negativeSign, sign0, sign1, sign2, sign3, sign4, + sign5, sign6, sign7, sign8, sign9, expUpper, expLower}; if (reserved.contains(decimal) || reserved.contains(thousand)) { @@ -190,7 +190,7 @@ auto ReadVal(const QString &formula, qreal &val, const QLocale &locale, const QC } // row - current state, column - new state - static uchar table[9][6] = { + static uchar const table[9][6] = { /* None InputSign InputThousand InputDigit InputDot InputExp */ { 0, diff --git a/src/libs/qmuparser/qmuparser.cpp b/src/libs/qmuparser/qmuparser.cpp index cc0290660..33e1c240c 100644 --- a/src/libs/qmuparser/qmuparser.cpp +++ b/src/libs/qmuparser/qmuparser.cpp @@ -67,13 +67,13 @@ auto CSR(qreal length, qreal split, qreal arcLength) -> qreal tmp.setAngle(tmp.angle() + 90.0 * sign); tmp.setLength(split); - QPointF p1 = tmp.p2(); + QPointF const p1 = tmp.p2(); tmp = QLineF(QPointF(0, length), QPointF(0, 0)); tmp.setAngle(tmp.angle() - 90.0 * sign); tmp.setLength(split); - QPointF p2 = tmp.p2(); + QPointF const p2 = tmp.p2(); const QLineF line2(p1, p2); @@ -109,7 +109,7 @@ auto CSR(qreal length, qreal split, qreal arcLength) -> qreal return 0; } - QLineF radius(crosPoint, tmp.p2()); + QLineF const radius(crosPoint, tmp.p2()); const qreal arcAngle = sign > 0 ? line.angleTo(radius) : radius.angleTo(line); arcL = (M_PI * radius.length()) / 180.0 * arcAngle; } while (qAbs(arcL - arcLength) > (0.5 /*mm*/ / 25.4) * PrintDPI); @@ -385,7 +385,7 @@ auto QmuParser::IsVal(const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVa { qreal fVal(0); - qmusizetype pos = + qmusizetype const pos = ReadVal(a_szExpr, fVal, locale != QLocale::c() && cNumbers ? QLocale::c() : locale, decimal, thousand); if (pos == -1) diff --git a/src/libs/qmuparser/qmuparserbase.cpp b/src/libs/qmuparser/qmuparserbase.cpp index 32337498a..755925d80 100644 --- a/src/libs/qmuparser/qmuparserbase.cpp +++ b/src/libs/qmuparser/qmuparserbase.cpp @@ -429,7 +429,7 @@ void QmuParserBase::CheckName(const QString &a_sName, const QString &a_szCharSet void QmuParserBase::SetExpr(const QString &a_sExpr) { // Check locale compatibility - std::locale loc; + std::locale const loc; if (m_pTokenReader->GetArgSep() == QChar(std::use_facet>(loc).decimal_point())) { Error(ecLOCALE); @@ -440,7 +440,7 @@ void QmuParserBase::SetExpr(const QString &a_sExpr) // when calling tellg on a stringstream created from the expression after // reading a value at the end of an expression. (qmu::QmuParser::IsVal function) // (tellg returns -1 otherwise causing the parser to ignore the value) - QString sBuf(a_sExpr + QChar(' ')); + QString const sBuf(a_sExpr + QChar(' ')); m_pTokenReader->SetFormula(sBuf); ReInit(); } @@ -790,20 +790,20 @@ void QmuParserBase::ApplyFunc(QStack &a_stOpt, QStack &a return; } - token_type funTok = a_stOpt.pop(); + token_type const funTok = a_stOpt.pop(); assert(funTok.GetFuncAddr()); // Binary operators must rely on their internal operator number // since counting of operators relies on commas for function arguments // binary operators do not have commas in their expression - int iArgCount = (funTok.GetCode() == cmOPRT_BIN) ? funTok.GetArgCount() : a_iArgCount; + int const iArgCount = (funTok.GetCode() == cmOPRT_BIN) ? funTok.GetArgCount() : a_iArgCount; // determine how many parameters the function needs. To remember iArgCount includes the // string parameter whilst GetArgCount() counts only numeric parameters. - int iArgRequired = funTok.GetArgCount() + ((funTok.GetType() == tpSTR) ? 1 : 0); + int const iArgRequired = funTok.GetArgCount() + ((funTok.GetType() == tpSTR) ? 1 : 0); // Thats the number of numerical parameters - int iArgNumerical = iArgCount - ((funTok.GetType() == tpSTR) ? 1 : 0); + int const iArgNumerical = iArgCount - ((funTok.GetType() == tpSTR) ? 1 : 0); if (funTok.GetCode() == cmFUNC_STR && iArgCount - iArgNumerical > 1) { @@ -882,23 +882,23 @@ void QmuParserBase::ApplyIfElse(QStack &a_stOpt, QStack // Check if there is an if Else clause to be calculated while (a_stOpt.size() && a_stOpt.top().GetCode() == cmELSE) { - token_type opElse = a_stOpt.pop(); + token_type const opElse = a_stOpt.pop(); Q_ASSERT(a_stOpt.size() > 0); // Take the value associated with the else branch from the value stack - token_type vVal2 = a_stVal.pop(); + token_type const vVal2 = a_stVal.pop(); Q_ASSERT(a_stOpt.size() > 0); Q_ASSERT(a_stVal.size() >= 2); // it then else is a ternary operator Pop all three values from the value s // tack and just return the right value - token_type vVal1 = a_stVal.pop(); - token_type vExpr = a_stVal.pop(); + token_type const vVal1 = a_stVal.pop(); + token_type const vExpr = a_stVal.pop(); a_stVal.push(not qFuzzyIsNull(vExpr.GetVal()) ? vVal1 : vVal2); - token_type opIf = a_stOpt.pop(); + token_type const opIf = a_stOpt.pop(); Q_ASSERT(opElse.GetCode() == cmELSE); Q_ASSERT(opIf.GetCode() == cmIF); @@ -1131,7 +1131,7 @@ auto QmuParserBase::ParseCmdCodeBulk(int nOffset, int nThreadID) const -> qreal // Next is treatment of numeric functions case cmFUNC: { - qmusizetype iArgCount = pTok->Fun.argc; + qmusizetype const iArgCount = pTok->Fun.argc; QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wcast-function-type") @@ -1214,7 +1214,7 @@ auto QmuParserBase::ParseCmdCodeBulk(int nOffset, int nThreadID) const -> qreal sidx -= pTok->Fun.argc - 1; // The index of the string argument in the string table - qmusizetype iIdxStack = pTok->Fun.idx; + qmusizetype const iIdxStack = pTok->Fun.idx; Q_ASSERT(iIdxStack >= 0 && iIdxStack < m_vStringBuf.size()); switch (pTok->Fun.argc) // switch according to argument count @@ -1238,7 +1238,7 @@ auto QmuParserBase::ParseCmdCodeBulk(int nOffset, int nThreadID) const -> qreal } case cmFUNC_BULK: { - qmusizetype iArgCount = pTok->Fun.argc; + qmusizetype const iArgCount = pTok->Fun.argc; // switch according to argument count switch (iArgCount) @@ -1438,7 +1438,7 @@ void QmuParserBase::CreateRPN() const // Check if a function is standing in front of the opening bracket, // if yes evaluate it afterwards check for infix operators assert(stArgCount.size()); - int iArgCount = stArgCount.pop(); + int const iArgCount = stArgCount.pop(); stOpt.pop(); // Take opening bracket from stack @@ -1495,7 +1495,7 @@ void QmuParserBase::CreateRPN() const if (code == opt.GetCode()) { // Deal with operator associativity - EOprtAssociativity eOprtAsct = GetOprtAssociativity(opt); + EOprtAssociativity const eOprtAsct = GetOprtAssociativity(opt); if ((eOprtAsct == oaRIGHT && (nPrec1 <= nPrec2)) || (eOprtAsct == oaLEFT && (nPrec1 < nPrec2))) { break; @@ -1663,7 +1663,7 @@ void QmuParserBase::ClearVar() */ void QmuParserBase::RemoveVar(const QString &a_strVarName) { - varmap_type::iterator item = m_VarDef.find(a_strVarName); + varmap_type::iterator const item = m_VarDef.find(a_strVarName); if (item != m_VarDef.end()) { m_VarDef.erase(item); @@ -1812,7 +1812,7 @@ void QmuParserBase::StackDump(const QStack &a_stVal, const QStack int int iStat = 0; qWarning() << "testing expression samples..."; - qreal b = 2; + qreal const b = 2; // Optimization iStat += EqnTest ( "2*b*5", 20, true ); @@ -1204,7 +1204,7 @@ auto QmuParserTester::ThrowTest(const QString &a_str, int a_iErrc, bool a_bFail) } // if a_bFail==false no exception is expected - bool bRet ( ( a_bFail == false ) ? 0 : 1 ); + bool const bRet((a_bFail == false) ? 0 : 1); if ( bRet == 1 ) { qWarning() << "\n " @@ -1375,7 +1375,7 @@ auto QmuParserTester::EqnTest(const QString &a_str, double a_fRes, bool a_fPass) // Test copy constructor QVector vParser; vParser.push_back ( * ( p1.get() ) ); - qmu::QmuParser p2 = vParser[0]; // take parser from vector + qmu::QmuParser const p2 = vParser[0]; // take parser from vector // destroy the originals from p2 vParser.clear(); // delete the vector @@ -1475,7 +1475,7 @@ auto QmuParserTester::EqnTestBulk(const QString &a_str, double a_fRes[4], bool a try { // Define Bulk Variables - int nBulkSize = 4; + int const nBulkSize = 4; double vVariableA[] = { 1, 2, 3, 4 }; // variable values double vVariableB[] = { 2, 2, 2, 2 }; // variable values double vVariableC[] = { 3, 3, 3, 3 }; // variable values diff --git a/src/libs/qmuparser/qmuparsertest.h b/src/libs/qmuparser/qmuparsertest.h index 58d5ae452..fae845ac0 100644 --- a/src/libs/qmuparser/qmuparsertest.h +++ b/src/libs/qmuparser/qmuparsertest.h @@ -182,25 +182,25 @@ private: static auto StrFun1(const QString &v1) -> qreal { - int val = v1.toInt(); + int const val = v1.toInt(); return static_cast(val); } static auto StrFun2(const QString &v1, qreal v2) -> qreal { - int val = v1.toInt(); + int const val = v1.toInt(); return static_cast(val + v2); } static auto StrFun3(const QString &v1, qreal v2, qreal v3) -> qreal { - int val = v1.toInt(); + int const val = v1.toInt(); return val + v2 + v3; } static auto StrToFloat(const QString &a_szMsg) -> qreal { - qreal val = a_szMsg.toDouble(); + qreal const val = a_szMsg.toDouble(); return val; } diff --git a/src/libs/qmuparser/qmuparsertokenreader.cpp b/src/libs/qmuparser/qmuparsertokenreader.cpp index aa4169608..9e1fd83f1 100644 --- a/src/libs/qmuparser/qmuparsertokenreader.cpp +++ b/src/libs/qmuparser/qmuparsertokenreader.cpp @@ -283,7 +283,7 @@ auto QmuParserTokenReader::ReadNextToken(const QLocale &locale, bool cNumbers, c // !!! From this point on there is no exit without an exception possible... // QString strTok; - qmusizetype iEnd = ExtractToken ( m_pParser->ValidNameChars(), strTok, m_iPos ); + qmusizetype const iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos); if ( iEnd != m_iPos ) { Error ( ecUNASSIGNABLE_TOKEN, m_iPos, strTok ); @@ -381,7 +381,7 @@ auto QmuParserTokenReader::IsBuiltIn ( token_type &a_Tok ) -> bool // check string for operator/function for ( int i = 0; i < pOprtDef.size(); ++i ) { - qmusizetype len = pOprtDef.at ( i ).length(); + qmusizetype const len = pOprtDef.at(i).length(); if ( pOprtDef.at ( i ) == m_strFormula.mid ( m_iPos, len ) ) { if (i >= cmLE && i <= cmASSIGN) @@ -485,7 +485,7 @@ auto QmuParserTokenReader::IsArgSep ( token_type &a_Tok ) -> bool if ( m_strFormula.at ( m_iPos ) == m_cArgSep ) { // copy the separator into null terminated string - QString szSep(m_cArgSep); + QString const szSep(m_cArgSep); if ( m_iSynFlags & noARG_SEP ) { @@ -548,7 +548,7 @@ auto QmuParserTokenReader::IsEOF ( token_type &a_Tok ) -> bool auto QmuParserTokenReader::IsInfixOpTok ( token_type &a_Tok ) -> bool { QString sTok; - qmusizetype iEnd = ExtractToken ( m_pParser->ValidInfixOprtChars(), sTok, m_iPos ); + qmusizetype const iEnd = ExtractToken(m_pParser->ValidInfixOprtChars(), sTok, m_iPos); if ( iEnd == m_iPos ) { return false; @@ -587,7 +587,7 @@ auto QmuParserTokenReader::IsInfixOpTok ( token_type &a_Tok ) -> bool auto QmuParserTokenReader::IsFunTok ( token_type &a_Tok ) -> bool { QString strTok; - qmusizetype iEnd = ExtractToken ( m_pParser->ValidNameChars(), strTok, m_iPos ); + qmusizetype const iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos); if ( iEnd == m_iPos ) { return false; @@ -627,7 +627,7 @@ auto QmuParserTokenReader::IsOprt ( token_type &a_Tok ) -> bool { QString strTok; - qmusizetype iEnd = ExtractOperatorToken ( strTok, m_iPos ); + qmusizetype const iEnd = ExtractOperatorToken(strTok, m_iPos); if ( iEnd == m_iPos ) { return false; @@ -714,7 +714,7 @@ auto QmuParserTokenReader::IsPostOpTok ( token_type &a_Tok ) -> bool // Test if there could be a postfix operator QString sTok; - qmusizetype iEnd = ExtractToken ( m_pParser->ValidOprtChars(), sTok, m_iPos ); + qmusizetype const iEnd = ExtractToken(m_pParser->ValidOprtChars(), sTok, m_iPos); if ( iEnd == m_iPos ) { return false; @@ -782,7 +782,7 @@ auto QmuParserTokenReader::IsValTok ( token_type &a_Tok, const QLocale &locale, auto item = m_vIdentFun.begin(); for ( item = m_vIdentFun.begin(); item != m_vIdentFun.end(); ++item ) { - qmusizetype iStart = m_iPos; + qmusizetype const iStart = m_iPos; if ( ( *item ) ( m_strFormula.mid ( m_iPos ), &m_iPos, &fVal, locale, cNumbers, decimal, thousand ) == 1 ) { // 2013-11-27 Issue 2: https://code.google.com/p/muparser/issues/detail?id=2 @@ -854,7 +854,7 @@ auto QmuParserTokenReader::IsStrVarTok ( token_type &a_Tok ) -> bool } QString strTok; - qmusizetype iEnd = ExtractToken ( m_pParser->ValidNameChars(), strTok, m_iPos ); + qmusizetype const iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos); if ( iEnd == m_iPos ) { return false; @@ -895,7 +895,7 @@ auto QmuParserTokenReader::IsStrVarTok ( token_type &a_Tok ) -> bool auto QmuParserTokenReader::IsUndefVarTok ( token_type &a_Tok ) -> bool { QString strTok; - qmusizetype iEnd ( ExtractToken ( m_pParser->ValidNameChars(), strTok, m_iPos ) ); + qmusizetype const iEnd(ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos)); if ( iEnd == m_iPos ) { return false; @@ -980,7 +980,7 @@ auto QmuParserTokenReader::IsString ( token_type &a_Tok ) -> bool Error ( ecUNTERMINATED_STRING, m_iPos, "\"" ); } - QString strTok = strBuf.mid ( 0, iEnd ); + QString const strTok = strBuf.mid(0, iEnd); if ( m_iSynFlags & noSTR ) { diff --git a/src/libs/qmuparser/qmutokenparser.cpp b/src/libs/qmuparser/qmutokenparser.cpp index 524d64729..a3c85618f 100644 --- a/src/libs/qmuparser/qmutokenparser.cpp +++ b/src/libs/qmuparser/qmutokenparser.cpp @@ -92,7 +92,7 @@ QmuTokenParser::QmuTokenParser(const QString &formula, bool osSeparator, */ auto QmuTokenParser::IsSingle(const QString &formula) -> bool { - QLocale c(QLocale::C); + QLocale const c(QLocale::C); bool ok = false; c.toDouble(formula, &ok); return ok; diff --git a/src/libs/vdxf/dxiface.cpp b/src/libs/vdxf/dxiface.cpp index abb80134e..af093ac83 100644 --- a/src/libs/vdxf/dxiface.cpp +++ b/src/libs/vdxf/dxiface.cpp @@ -38,7 +38,7 @@ dx_iface::~dx_iface() auto dx_iface::fileExport(bool binary) -> bool { - bool success = dxfW->write(this, version, binary); + bool const success = dxfW->write(this, version, binary); return success; } @@ -518,7 +518,7 @@ void dx_iface::AddBlock(dx_ifaceBlock *block) auto dx_iface::LocaleToISO() -> std::string { - QMap locMap = LocaleMap(); + QMap const locMap = LocaleMap(); return locMap.value(QLocale(VAbstractApplication::VApp()->Settings()->GetLocale()).name(), "ISO8859-1") .toStdString(); } diff --git a/src/libs/vdxf/libdxfrw/drw_entities.cpp b/src/libs/vdxf/libdxfrw/drw_entities.cpp index 3f2d59e42..f908dacf9 100644 --- a/src/libs/vdxf/libdxfrw/drw_entities.cpp +++ b/src/libs/vdxf/libdxfrw/drw_entities.cpp @@ -314,7 +314,7 @@ void DRW_Arc::applyExtrusion() staangle = M_PI - staangle; endangle = M_PI - endangle; - double temp = staangle; + double const temp = staangle; staangle = endangle; endangle = temp; } @@ -364,7 +364,7 @@ void DRW_Ellipse::applyExtrusion() { calculateAxis(extPoint); extrudePoint(extPoint, &secPoint); - double intialparam = staparam; + double const intialparam = staparam; if (extPoint.z < 0.) { staparam = M_PIx2 - endparam; @@ -387,7 +387,7 @@ void DRW_Ellipse::correctAxis() { if (fabs(endparam - staparam - M_PIx2) < 1.0e-10) complete = true; - double incX = secPoint.x; + double const incX = secPoint.x; secPoint.x = -(secPoint.y * ratio); secPoint.y = incX * ratio; ratio = 1 / ratio; @@ -423,10 +423,10 @@ void DRW_Ellipse::toPolyline(DRW_Polyline *pol, int parts) curAngle = endparam; i = parts + 2; } - double cosCurr = cos(curAngle); - double sinCurr = sin(curAngle); - double x = basePoint.x + (cosCurr * cosRot * radMajor) - (sinCurr * sinRot * radMinor); - double y = basePoint.y + (cosCurr * sinRot * radMajor) + (sinCurr * cosRot * radMinor); + double const cosCurr = cos(curAngle); + double const sinCurr = sin(curAngle); + double const x = basePoint.x + (cosCurr * cosRot * radMajor) - (sinCurr * sinRot * radMinor); + double const y = basePoint.y + (cosCurr * sinRot * radMajor) + (sinCurr * cosRot * radMinor); pol->addVertex(DRW_Vertex(x, y, 0.0, 0.0)); curAngle = (++i) * incAngle; } while (i < parts); diff --git a/src/libs/vdxf/libdxfrw/intern/drw_textcodec.cpp b/src/libs/vdxf/libdxfrw/intern/drw_textcodec.cpp index 8bdd0687b..1688ceae9 100644 --- a/src/libs/vdxf/libdxfrw/intern/drw_textcodec.cpp +++ b/src/libs/vdxf/libdxfrw/intern/drw_textcodec.cpp @@ -279,7 +279,7 @@ auto DRW_ConvTable::fromUtf8(const std::string &s) -> std::string if (c > 0x7F) { // need to decode result += s.substr(j, i - j); - std::string part1 = s.substr(i, 4); + std::string const part1 = s.substr(i, 4); unsigned int l; code = decodeNum(part1, &l); j = i + l; @@ -446,7 +446,7 @@ template auto DRW_ConvDBCSTable::fromU if (c > 0x7F) { // need to decode result += s.substr(j, i - j); - std::string part1 = s.substr(i, 4); + std::string const part1 = s.substr(i, 4); unsigned int l; code = decodeNum(part1, &l); j = i + l; @@ -456,7 +456,7 @@ template auto DRW_ConvDBCSTable::fromU { if (row[1] == code) { - int data = row[0]; + int const data = row[0]; char d[3]; d[0] = static_cast(data >> 8); d[1] = static_cast(data & 0xFF); @@ -513,9 +513,9 @@ template auto DRW_ConvDBCSTable::toUtf else { // 2 bytes ++it; - int code = (c << 8) | static_cast(*it); - int sta = leadTable[static_cast(c - 0x81)]; - int end = leadTable[static_cast(c - 0x80)]; + int const code = (c << 8) | static_cast(*it); + int const sta = leadTable[static_cast(c - 0x81)]; + int const end = leadTable[static_cast(c - 0x80)]; for (auto k = static_cast(sta); k < static_cast(end); k++) { if (doubleTable[k][0] == code) @@ -549,7 +549,7 @@ auto DRW_Conv932Table::fromUtf8(const std::string &s) -> std::string if (c > 0x7F) { // need to decode result += s.substr(j, i - j); - std::string part1 = s.substr(i, 4); + std::string const part1 = s.substr(i, 4); unsigned int l; code = decodeNum(part1, &l); j = i + l; @@ -568,7 +568,7 @@ auto DRW_Conv932Table::fromUtf8(const std::string &s) -> std::string { if (row[1] == code) { - int data = row[0]; + int const data = row[0]; char d[3]; d[0] = static_cast(data >> 8); d[1] = static_cast(data & 0xFF); @@ -624,7 +624,7 @@ auto DRW_Conv932Table::toUtf8(const std::string &s) -> std::string else { // 2 bytes ++it; - int code = (c << 8) | static_cast(*it); + int const code = (c << 8) | static_cast(*it); int sta = 0; int end = 0; if (c > 0x80 && c < 0xA0) diff --git a/src/libs/vdxf/libdxfrw/intern/dxfwriter.cpp b/src/libs/vdxf/libdxfrw/intern/dxfwriter.cpp index 543406609..0b12cf874 100644 --- a/src/libs/vdxf/libdxfrw/intern/dxfwriter.cpp +++ b/src/libs/vdxf/libdxfrw/intern/dxfwriter.cpp @@ -93,7 +93,7 @@ auto dxfWriter::writeUtf8String(int code, const std::string &text) -> bool { - std::string t = encoder.fromUtf8(text); + std::string const t = encoder.fromUtf8(text); return writeString(code, t); } @@ -101,7 +101,7 @@ auto dxfWriter::writeUtf8Caps(int code, const std::string &text) -> bool { std::string strname = text; std::transform(strname.begin(), strname.end(), strname.begin(),::toupper); - std::string t = encoder.fromUtf8(strname); + std::string const t = encoder.fromUtf8(strname); return writeString(code, t); } diff --git a/src/libs/vdxf/libdxfrw/libdxfrw.cpp b/src/libs/vdxf/libdxfrw/libdxfrw.cpp index 99747e36d..acd235610 100644 --- a/src/libs/vdxf/libdxfrw/libdxfrw.cpp +++ b/src/libs/vdxf/libdxfrw/libdxfrw.cpp @@ -100,7 +100,7 @@ auto dxfRW::read(DRW_Interface *interface_, bool ext) -> bool reader = std::make_unique(&filestr); } - bool isOk = processDxf(); + bool const isOk = processDxf(); filestr.close(); reader.reset(); reader = nullptr; @@ -671,7 +671,7 @@ auto dxfRW::writeDimstyle(DRW_Dimstyle *ent) -> bool std::transform(txstyname.begin(), txstyname.end(), txstyname.begin(), ::toupper); if (textStyleMap.count(txstyname) > 0) { - int txstyHandle = (*(textStyleMap.find(txstyname))).second; + int const txstyHandle = (*(textStyleMap.find(txstyname))).second; writer->writeUtf8String(340, toHexStr(txstyHandle)); } } @@ -679,7 +679,7 @@ auto dxfRW::writeDimstyle(DRW_Dimstyle *ent) -> bool { if (blockMap.count(ent->dimldrblk) > 0) { - int blkHandle = (*(blockMap.find(ent->dimldrblk))).second; + int const blkHandle = (*(blockMap.find(ent->dimldrblk))).second; writer->writeUtf8String(341, toHexStr(blkHandle)); writer->writeInt16(371, ent->dimlwd); writer->writeInt16(372, ent->dimlwe); @@ -1096,7 +1096,7 @@ auto dxfRW::writePolyline(DRW_Polyline *ent) -> bool { writer->writeInt16(75, ent->curvetype); } - DRW_Coord crd = ent->extPoint; + DRW_Coord const crd = ent->extPoint; if (not qFuzzyIsNull(crd.x) || not qFuzzyIsNull(crd.y) || not DRW_FuzzyComparePossibleNulls(crd.z, 1)) { writer->writeDouble(210, crd.x); @@ -1104,7 +1104,7 @@ auto dxfRW::writePolyline(DRW_Polyline *ent) -> bool writer->writeDouble(230, crd.z); } - size_t vertexnum = ent->vertlist.size(); + size_t const vertexnum = ent->vertlist.size(); for (size_t i = 0; i < vertexnum; i++) { DRW_Vertex *v = ent->vertlist.at(i); @@ -1400,7 +1400,7 @@ auto dxfRW::writeDimension(DRW_Dimension *ent) -> bool { DRW_DimAligned *dd = static_cast(ent); writer->writeString(100, "AcDbAlignedDimension"); - DRW_Coord crd = dd->getClonepoint(); + DRW_Coord const crd = dd->getClonepoint(); if (not qFuzzyIsNull(crd.x) || not qFuzzyIsNull(crd.y) || not qFuzzyIsNull(crd.z)) { writer->writeDouble(12, crd.x); @@ -1589,7 +1589,7 @@ auto dxfRW::writeMText(DRW_MText *ent) -> bool writer->writeDouble(41, ent->widthscale); writer->writeInt16(71, ent->textgen); writer->writeInt16(72, ent->alignH); - std::string text = writer->fromUtf8String(ent->text); + std::string const text = writer->fromUtf8String(ent->text); int i; for (i = 0; (text.size() - static_cast(i)) > 250;) @@ -1656,7 +1656,7 @@ auto dxfRW::writeImage(DRW_Image *ent, const std::string &name) -> DRW_ImageDef id->handle = static_cast(++entCount); } id->fileName = name; - std::string idReactor = toHexStr(++entCount); + std::string const idReactor = toHexStr(++entCount); writer->writeString(0, "IMAGE"); writeEntity(ent); @@ -2282,7 +2282,7 @@ auto dxfRW::writeExtData(const std::vector &ed) -> bool case 1004: case 1005: { - int cc = (*it)->code; + int const cc = (*it)->code; if ((*it)->type == DRW_Variant::STRING) writer->writeUtf8String(cc, *(*it)->content.s); // writer->writeUtf8String((*it)->code, (*it)->content.s); @@ -2350,7 +2350,7 @@ auto dxfRW::processDxf() -> bool reader->setIgnoreComments(true); if (!inSection) { - std::string sectionstr{reader->getString()}; + std::string const sectionstr{reader->getString()}; if ("SECTION" == sectionstr) { @@ -2378,7 +2378,7 @@ auto dxfRW::processDxf() -> bool if (inSection) { bool processed{false}; - std::string sectionname{reader->getString()}; + std::string const sectionname{reader->getString()}; DRW_DBG(sectionname); DRW_DBG(" process section\n"); @@ -3571,7 +3571,7 @@ auto dxfRW::processDimension() -> bool nextentity = reader->getString(); DRW_DBG(nextentity); DRW_DBG("\n"); - int type = dim.type & 0x0F; + int const type = dim.type & 0x0F; QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wswitch-default") @@ -3581,43 +3581,43 @@ auto dxfRW::processDimension() -> bool { case 0: { - DRW_DimLinear d(dim); + DRW_DimLinear const d(dim); iface->addDimLinear(&d); break; } case 1: { - DRW_DimAligned d(dim); + DRW_DimAligned const d(dim); iface->addDimAlign(&d); break; } case 2: { - DRW_DimAngular d(dim); + DRW_DimAngular const d(dim); iface->addDimAngular(&d); break; } case 3: { - DRW_DimDiametric d(dim); + DRW_DimDiametric const d(dim); iface->addDimDiametric(&d); break; } case 4: { - DRW_DimRadial d(dim); + DRW_DimRadial const d(dim); iface->addDimRadial(&d); break; } case 5: { - DRW_DimAngular3p d(dim); + DRW_DimAngular3p const d(dim); iface->addDimAngular3P(&d); break; } case 6: { - DRW_DimOrdinate d(dim); + DRW_DimOrdinate const d(dim); iface->addDimOrdinate(&d); break; } diff --git a/src/libs/vdxf/vdxfengine.cpp b/src/libs/vdxf/vdxfengine.cpp index 274c28113..3b53d8042 100644 --- a/src/libs/vdxf/vdxfengine.cpp +++ b/src/libs/vdxf/vdxfengine.cpp @@ -602,7 +602,7 @@ auto VDxfEngine::GetPenStyle() -> std::string //--------------------------------------------------------------------------------------------------------------------- auto VDxfEngine::GetPenColor() -> int { - QColor color = state->pen().color(); + QColor const color = state->pen().color(); if (color == Qt::black) { @@ -851,8 +851,8 @@ void VDxfEngine::ExportAAMAOutline(const QSharedPointer &detailBl { const QVector passmarks = detail.GetMappedPassmarks(); - bool seamAllowance = detail.IsSeamAllowance() && !detail.IsSeamAllowanceBuiltIn(); - bool builtInSeamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn(); + bool const seamAllowance = detail.IsSeamAllowance() && !detail.IsSeamAllowanceBuiltIn(); + bool const builtInSeamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn(); VBoundary boundary(points, seamAllowance, builtInSeamAllowance); boundary.SetPieceName(detail.GetName()); @@ -910,7 +910,7 @@ void VDxfEngine::ExportAAMADrawSewLine(const QSharedPointer &deta if (detail.IsSeamAllowance() && not detail.IsHideMainPath() && not detail.IsSeamAllowanceBuiltIn()) { const UTF8STRING &layer = not detail.IsSewLineOnDrawing() ? *layer14 : *layer8; - QVector points = detail.GetMappedFullContourPoints(); + QVector const points = detail.GetMappedFullContourPoints(); auto DrawPolygon = [this, detailBlock, layer](const QVector &points, bool forceClosed) { @@ -927,8 +927,8 @@ void VDxfEngine::ExportAAMADrawSewLine(const QSharedPointer &deta { const QVector passmarks = detail.GetMappedPassmarks(); - bool seamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn(); - bool builtInSeamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn(); + bool const seamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn(); + bool const builtInSeamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn(); VBoundary boundary(points, seamAllowance, builtInSeamAllowance); boundary.SetPieceName(detail.GetName()); @@ -1039,7 +1039,7 @@ void VDxfEngine::ExportAAMAIntcut(const QSharedPointer &detailBlo ExportCurvePoints(detailBlock, points); }; - QVector drawIntCut = detail.MappedInternalPathsForCut(true); + QVector const drawIntCut = detail.MappedInternalPathsForCut(true); for (auto &intCut : drawIntCut) { QVector points = intCut.Points(); @@ -1084,7 +1084,7 @@ void VDxfEngine::ExportAAMANotch(const QSharedPointer &detailBloc if (!VGObject::IsPointOnLineviaPDP(passmark.baseLine.p1(), mirrorLine.p1(), mirrorLine.p2())) { const QTransform matrix = VGObject::FlippingMatrix(mirrorLine); - QLineF baseLine = matrix.map(passmark.baseLine); + QLineF const baseLine = matrix.map(passmark.baseLine); ExportNotch(baseLine.p1(), baseLine.length(), baseLine.angle()); } } @@ -1245,7 +1245,7 @@ void VDxfEngine::ExportStyleSystemText(const QSharedPointer &input, co for (int j = 0; j < strings.size(); ++j) { const qreal height = ToPixel(AAMATextHeight * m_yscale, m_varInsunits); - QPointF pos(0, GetSize().height() - height * (static_cast(strings.size()) - j - 1)); + QPointF const pos(0, GetSize().height() - height * (static_cast(strings.size()) - j - 1)); input->AddEntity(AAMAText(pos, strings.at(j), *layer1)); } return; @@ -1392,8 +1392,8 @@ void VDxfEngine::ExportASTMPieceBoundary(const QSharedPointer &de { const QVector passmarks = detail.GetMappedPassmarks(); - bool seamAllowance = detail.IsSeamAllowance() && !detail.IsSeamAllowanceBuiltIn(); - bool builtInSeamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn(); + bool const seamAllowance = detail.IsSeamAllowance() && !detail.IsSeamAllowanceBuiltIn(); + bool const builtInSeamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn(); VBoundary boundary(pieceBoundary, seamAllowance, builtInSeamAllowance); boundary.SetPieceName(detail.GetName()); @@ -1435,7 +1435,7 @@ void VDxfEngine::ExportASTMSewLine(const QSharedPointer &detailBl { if (detail.IsSeamAllowance() && not detail.IsHideMainPath() && not detail.IsSeamAllowanceBuiltIn()) { - QVector sewLine = detail.GetMappedFullContourPoints(); + QVector const sewLine = detail.GetMappedFullContourPoints(); auto DrawPolygon = [this, detailBlock](const QVector &points, bool forceClosed) { @@ -1459,8 +1459,8 @@ void VDxfEngine::ExportASTMSewLine(const QSharedPointer &detailBl { const QVector passmarks = detail.GetMappedPassmarks(); - bool seamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn(); - bool builtInSeamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn(); + bool const seamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn(); + bool const builtInSeamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn(); VBoundary boundary(sewLine, seamAllowance, builtInSeamAllowance); boundary.SetPieceName(detail.GetName()); @@ -1499,7 +1499,8 @@ void VDxfEngine::ExportASTMDrawInternalPaths(const QSharedPointer if (notMirrored && !points.isEmpty()) { - QPointF pos(points.constFirst().x(), points.constFirst().y() - ToPixel(AAMATextHeight, m_varInsunits)); + QPointF const pos(points.constFirst().x(), + points.constFirst().y() - ToPixel(AAMATextHeight, m_varInsunits)); detailBlock->ent.push_back(AAMAText(pos, QStringLiteral("NM"), *layer8)); } @@ -1544,7 +1545,8 @@ void VDxfEngine::ExportASTMDrawPlaceLabels(const QSharedPointer & if (notMirrored && !points.isEmpty()) { - QPointF pos(points.constFirst().x(), points.constFirst().y() - ToPixel(AAMATextHeight, m_varInsunits)); + QPointF const pos(points.constFirst().x(), + points.constFirst().y() - ToPixel(AAMATextHeight, m_varInsunits)); detailBlock->ent.push_back(AAMAText(pos, QStringLiteral("NM"), *layer8)); } @@ -1597,7 +1599,8 @@ void VDxfEngine::ExportASTMInternalCutout(const QSharedPointer &d if (notMirrored && !points.isEmpty()) { - QPointF pos(points.constFirst().x(), points.constFirst().y() - ToPixel(AAMATextHeight, m_varInsunits)); + QPointF const pos(points.constFirst().x(), + points.constFirst().y() - ToPixel(AAMATextHeight, m_varInsunits)); detailBlock->ent.push_back(AAMAText(pos, QStringLiteral("NM"), *layer11)); } @@ -1611,7 +1614,7 @@ void VDxfEngine::ExportASTMInternalCutout(const QSharedPointer &d } }; - QVector drawIntCut = detail.MappedInternalPathsForCut(true); + QVector const drawIntCut = detail.MappedInternalPathsForCut(true); for (auto &intCut : drawIntCut) { QVector points = intCut.Points(); @@ -1801,8 +1804,8 @@ auto VDxfEngine::ExportASTMNotch(const VLayoutPassmark &passmark) -> DRW_ASTMNot break; case PassmarkLineType::BoxMark: { // Castle Notch - QPointF start = passmark.lines.constFirst().p1(); - QPointF end = passmark.lines.constLast().p2(); + QPointF const start = passmark.lines.constFirst().p1(); + QPointF const end = passmark.lines.constLast().p2(); notch->layer = *layer81; notch->thickness = FromPixel(QLineF(start, end).length(), m_varInsunits); // width @@ -1810,8 +1813,8 @@ auto VDxfEngine::ExportASTMNotch(const VLayoutPassmark &passmark) -> DRW_ASTMNot } case PassmarkLineType::UMark: { // U-Notch - QPointF start = passmark.lines.constFirst().p1(); - QPointF end = passmark.lines.constLast().p2(); + QPointF const start = passmark.lines.constFirst().p1(); + QPointF const end = passmark.lines.constLast().p2(); notch->thickness = FromPixel(QLineF(start, end).length(), m_varInsunits); // width @@ -1848,9 +1851,9 @@ auto VDxfEngine::ExportASTMNotch(const VLayoutPassmark &passmark) -> DRW_ASTMNot auto VDxfEngine::ExportASTMNotchDataDependecy(const VLayoutPassmark &passmark, const UTF8STRING ¬chLayer, const VLayoutPiece &detail) -> DRW_ATTDEF * { - QVector boundary = not detail.IsSeamAllowanceBuiltIn() && !passmark.isBuiltIn - ? detail.GetMappedSeamAllowancePoints() - : detail.GetMappedContourPoints(); + QVector const boundary = not detail.IsSeamAllowanceBuiltIn() && !passmark.isBuiltIn + ? detail.GetMappedSeamAllowancePoints() + : detail.GetMappedContourPoints(); const QPointF center = passmark.baseLine.p1(); QPointF referencePoint; diff --git a/src/libs/vformat/knownmeasurements/vknownmeasurementsdatabase.cpp b/src/libs/vformat/knownmeasurements/vknownmeasurementsdatabase.cpp index 7821182da..84adea8d7 100644 --- a/src/libs/vformat/knownmeasurements/vknownmeasurementsdatabase.cpp +++ b/src/libs/vformat/knownmeasurements/vknownmeasurementsdatabase.cpp @@ -51,7 +51,7 @@ QT_WARNING_POP //--------------------------------------------------------------------------------------------------------------------- void VKnownMeasurementsDatabase::PopulateMeasurementsDatabase() { - QMutexLocker locker(knownMeasurementsDatabaseMutex()); + QMutexLocker const locker(knownMeasurementsDatabaseMutex()); m_measurementsCache.clear(); @@ -69,7 +69,7 @@ void VKnownMeasurementsDatabase::PopulateMeasurementsDatabase() //--------------------------------------------------------------------------------------------------------------------- auto VKnownMeasurementsDatabase::IsPopulated() const -> bool { - QMutexLocker locker(knownMeasurementsDatabaseMutex()); + QMutexLocker const locker(knownMeasurementsDatabaseMutex()); return m_populated; } @@ -92,7 +92,7 @@ auto VKnownMeasurementsDatabase::KnownMeasurements(const QUuid &id) const -> VKn return {*m_measurementsCache.object(id)}; } - QString measurementsFilePath = m_indexMeasurementsPath.value(id); + QString const measurementsFilePath = m_indexMeasurementsPath.value(id); if (measurementsFilePath.isEmpty()) { return {}; @@ -136,7 +136,7 @@ void VKnownMeasurementsDatabase::ParseDirectory(const QString &path) QDirIterator it(path, {"*.vkm"}, QDir::Files, QDirIterator::Subdirectories); while (it.hasNext()) { - QString measurementsFilePath = it.next(); + QString const measurementsFilePath = it.next(); try { diff --git a/src/libs/vformat/knownmeasurements/vknownmeasurementsdocument.cpp b/src/libs/vformat/knownmeasurements/vknownmeasurementsdocument.cpp index 1209f5e9d..9ea57abeb 100644 --- a/src/libs/vformat/knownmeasurements/vknownmeasurementsdocument.cpp +++ b/src/libs/vformat/knownmeasurements/vknownmeasurementsdocument.cpp @@ -90,7 +90,7 @@ VKnownMeasurementsDocument::VKnownMeasurementsDocument(QObject *parent) auto VKnownMeasurementsDocument::SaveDocument(const QString &fileName, QString &error) -> bool { // Update comment with Valentina version - QDomNode commentNode = documentElement().firstChild(); + QDomNode const commentNode = documentElement().firstChild(); if (commentNode.isComment()) { QDomComment comment = commentNode.toComment(); @@ -255,7 +255,7 @@ void VKnownMeasurementsDocument::MoveBottom(const QString &name) //--------------------------------------------------------------------------------------------------------------------- auto VKnownMeasurementsDocument::GetUId() const -> QUuid { - QDomNode root = documentElement(); + QDomNode const root = documentElement(); if (not root.isNull() && root.isElement()) { const QDomElement rootElement = root.toElement(); @@ -270,7 +270,7 @@ auto VKnownMeasurementsDocument::GetUId() const -> QUuid //--------------------------------------------------------------------------------------------------------------------- void VKnownMeasurementsDocument::SetUId(const QUuid &id) { - QDomNode root = documentElement(); + QDomNode const root = documentElement(); if (not root.isNull() && root.isElement()) { QDomElement rootElement = root.toElement(); @@ -312,7 +312,7 @@ void VKnownMeasurementsDocument::SetDescription(const QString &desc) //--------------------------------------------------------------------------------------------------------------------- auto VKnownMeasurementsDocument::IsReadOnly() const -> bool { - QDomNode root = documentElement(); + QDomNode const root = documentElement(); if (not root.isNull() && root.isElement()) { const QDomElement rootElement = root.toElement(); @@ -327,7 +327,7 @@ auto VKnownMeasurementsDocument::IsReadOnly() const -> bool //--------------------------------------------------------------------------------------------------------------------- void VKnownMeasurementsDocument::SetReadOnly(bool ro) { - QDomNode root = documentElement(); + QDomNode const root = documentElement(); if (not root.isNull() && root.isElement()) { QDomElement rootElement = root.toElement(); @@ -537,7 +537,7 @@ auto VKnownMeasurementsDocument::FindM(const QString &name) const -> QDomElement return {}; } - QDomNodeList list = elementsByTagName(*tagMeasurement); + QDomNodeList const list = elementsByTagName(*tagMeasurement); for (int i = 0; i < list.size(); ++i) { @@ -580,9 +580,9 @@ auto VKnownMeasurementsDocument::FindImage(const QUuid &id) const -> QDomElement return {}; } - QDomNodeList list = elementsByTagName(*tagImage); + QDomNodeList const list = elementsByTagName(*tagImage); - QString idString = id.toString(); + QString const idString = id.toString(); for (int i = 0; i < list.size(); ++i) { @@ -627,7 +627,7 @@ void VKnownMeasurementsDocument::ReadImages(VKnownMeasurements &known) const //--------------------------------------------------------------------------------------------------------------------- void VKnownMeasurementsDocument::ReadMeasurements(VKnownMeasurements &known) const { - QDomNodeList list = elementsByTagName(*tagMeasurement); + QDomNodeList const list = elementsByTagName(*tagMeasurement); for (int i = 0; i < list.size(); ++i) { @@ -654,7 +654,7 @@ void VKnownMeasurementsDocument::ReadMeasurements(VKnownMeasurements &known) con //--------------------------------------------------------------------------------------------------------------------- void VKnownMeasurementsDocument::UpdateDiagramId(const QUuid &oldId, const QUuid &newId) { - QDomNodeList list = elementsByTagName(*tagMeasurement); + QDomNodeList const list = elementsByTagName(*tagMeasurement); for (int i = 0; i < list.size(); ++i) { diff --git a/src/libs/vformat/vdimensions.cpp b/src/libs/vformat/vdimensions.cpp index 75a833a4e..305bf9050 100644 --- a/src/libs/vformat/vdimensions.cpp +++ b/src/libs/vformat/vdimensions.cpp @@ -151,7 +151,7 @@ auto VAbstartMeasurementDimension::ValidBases() const -> QVector //--------------------------------------------------------------------------------------------------------------------- auto VAbstartMeasurementDimension::ValidBasesList() const -> QStringList { - QVector bases = ValidBases(); + QVector const bases = ValidBases(); QStringList list; list.reserve(bases.size()); for(auto &base : bases) @@ -212,10 +212,10 @@ auto VAbstartMeasurementDimension::ValidBases(qreal min, qreal max, qreal step, //--------------------------------------------------------------------------------------------------------------------- auto VAbstartMeasurementDimension::IsRangeValid() const -> bool { - bool valid = m_minValue > 0 && m_maxValue > 0 && - (m_minValue > RangeMin() || VFuzzyComparePossibleNulls(m_minValue, RangeMin())) && - (m_maxValue < RangeMax() || VFuzzyComparePossibleNulls(m_maxValue, RangeMax())) && - (m_minValue < m_maxValue || VFuzzyComparePossibleNulls(m_minValue, m_maxValue)); + bool const valid = m_minValue > 0 && m_maxValue > 0 && + (m_minValue > RangeMin() || VFuzzyComparePossibleNulls(m_minValue, RangeMin())) && + (m_maxValue < RangeMax() || VFuzzyComparePossibleNulls(m_maxValue, RangeMax())) && + (m_minValue < m_maxValue || VFuzzyComparePossibleNulls(m_minValue, m_maxValue)); if (not valid) { @@ -228,7 +228,7 @@ auto VAbstartMeasurementDimension::IsRangeValid() const -> bool //--------------------------------------------------------------------------------------------------------------------- auto VAbstartMeasurementDimension::IsStepValid() const -> bool { - bool valid = VFuzzyIndexOf(ValidSteps(), m_step) != -1; + bool const valid = VFuzzyIndexOf(ValidSteps(), m_step) != -1; if (not valid) { m_error = QCoreApplication::translate("VAbstartMeasurementDimension", "Invalid step"); @@ -240,7 +240,7 @@ auto VAbstartMeasurementDimension::IsStepValid() const -> bool //--------------------------------------------------------------------------------------------------------------------- auto VAbstartMeasurementDimension::IsBaseValid() const -> bool { - bool valid = VFuzzyIndexOf(ValidBases(), m_baseValue) != -1; + bool const valid = VFuzzyIndexOf(ValidBases(), m_baseValue) != -1; if (not valid) { m_error = QCoreApplication::translate("VAbstartMeasurementDimension", "Base value invalid"); @@ -252,7 +252,7 @@ auto VAbstartMeasurementDimension::IsBaseValid() const -> bool //--------------------------------------------------------------------------------------------------------------------- auto VAbstartMeasurementDimension::IsUnitsValid() const -> bool { - bool valid = (m_units == Unit::Cm || m_units == Unit::Mm || m_units == Unit::Inch); + bool const valid = (m_units == Unit::Cm || m_units == Unit::Mm || m_units == Unit::Inch); if (not valid) { @@ -381,11 +381,11 @@ void VDimensionRestriction::SetExcludeString(const QString &exclude) { m_exclude.clear(); - QStringList values = exclude.split(';'); + QStringList const values = exclude.split(';'); for(auto &value : values) { bool ok = false; - qreal val = value.toDouble(&ok); + qreal const val = value.toDouble(&ok); if (ok) { @@ -397,7 +397,7 @@ void VDimensionRestriction::SetExcludeString(const QString &exclude) //--------------------------------------------------------------------------------------------------------------------- auto VDimensionRestriction::GetExcludeString() const -> QString { - QList list = m_exclude.values(); + QList const list = m_exclude.values(); QStringList excludeList; for(auto &value : list) diff --git a/src/libs/vformat/vmeasurements.cpp b/src/libs/vformat/vmeasurements.cpp index b7917c556..670485e95 100644 --- a/src/libs/vformat/vmeasurements.cpp +++ b/src/libs/vformat/vmeasurements.cpp @@ -180,7 +180,7 @@ void VMeasurements::setXMLContent(const QString &fileName) auto VMeasurements::SaveDocument(const QString &fileName, QString &error) -> bool { // Update comment with Valentina version - QDomNode commentNode = documentElement().firstChild(); + QDomNode const commentNode = documentElement().firstChild(); if (commentNode.isComment()) { QDomComment comment = commentNode.toComment(); @@ -632,7 +632,7 @@ void VMeasurements::SetReadOnly(bool ro) //--------------------------------------------------------------------------------------------------------------------- auto VMeasurements::IsFullCircumference() const -> bool { - QDomElement dimenstionsTag = documentElement().firstChildElement(TagDimensions); + QDomElement const dimenstionsTag = documentElement().firstChildElement(TagDimensions); if (not dimenstionsTag.isNull()) { return GetParametrBool(dimenstionsTag, AttrFullCircumference, falseStr); @@ -850,7 +850,7 @@ void VMeasurements::SetMImage(const QString &name, const VPatternImage &image) auto VMeasurements::MeasurementForDimension(IMD type) const -> QString { const QString d = VMeasurements::IMDToStr(type); - QDomNodeList list = elementsByTagName(TagMeasurement); + QDomNodeList const list = elementsByTagName(TagMeasurement); for (int i = 0; i < list.size(); ++i) { @@ -882,7 +882,7 @@ auto VMeasurements::GetRestrictions() const -> QMap QMap &restrictions) { - QDomElement root = documentElement(); + QDomElement const root = documentElement(); QDomElement restrictionsTag = root.firstChildElement(TagRestrictions); if (restrictionsTag.isNull()) @@ -1279,7 +1279,7 @@ auto VMeasurements::FindM(const QString &name) const -> QDomElement return {}; } - QDomNodeList list = elementsByTagName(TagMeasurement); + QDomNodeList const list = elementsByTagName(TagMeasurement); for (int i = 0; i < list.size(); ++i) { @@ -1302,7 +1302,7 @@ auto VMeasurements::FindM(const QString &name) const -> QDomElement //--------------------------------------------------------------------------------------------------------------------- auto VMeasurements::ReadType() const -> MeasurementsType { - QDomElement root = documentElement(); + QDomElement const root = documentElement(); if (root.tagName() == TagVST) { return MeasurementsType::Multisize; @@ -1401,7 +1401,7 @@ auto VMeasurements::EvalFormula(VContainer *data, const QString &formula, bool * try { - QScopedPointer cal(new Calculator()); + QScopedPointer const cal(new Calculator()); const qreal result = cal->EvalFormula(data->DataVariables(), formula); (qIsInf(result) || qIsNaN(result)) ? *ok = false : *ok = true; @@ -1423,7 +1423,7 @@ auto VMeasurements::ReadCorrections(const QDomElement &mElement) const -> QMap VPatternImage { - QDomElement imageTag = mElement.firstChildElement(TagImage); + QDomElement const imageTag = mElement.firstChildElement(TagImage); if (imageTag.isNull()) { return {}; @@ -1583,7 +1583,7 @@ auto VMeasurements::ReadDimensionLabels(const QDomElement &dElement) const -> Di return {}; } - QDomElement labelsTag = dElement.firstChildElement(TagLabels); + QDomElement const labelsTag = dElement.firstChildElement(TagLabels); if (labelsTag.isNull()) { return {}; @@ -1615,7 +1615,7 @@ auto VMeasurements::ReadDimensionLabels(const QDomElement &dElement) const -> Di void VMeasurements::ClearDimension(IMD type) { const QString d = VMeasurements::IMDToStr(type); - QDomNodeList list = elementsByTagName(TagMeasurement); + QDomNodeList const list = elementsByTagName(TagMeasurement); for (int i = 0; i < list.size(); ++i) { diff --git a/src/libs/vformat/vpatternrecipe.cpp b/src/libs/vformat/vpatternrecipe.cpp index ff0203016..8816e63c3 100644 --- a/src/libs/vformat/vpatternrecipe.cpp +++ b/src/libs/vformat/vpatternrecipe.cpp @@ -175,7 +175,7 @@ auto VPatternRecipe::Measurements() -> QDomElement { QDomElement measurements = createElement(QStringLiteral("measurements")); - VContainer data = m_pattern->GetCompleteData(); + VContainer const data = m_pattern->GetCompleteData(); QList> patternMeasurements = data.DataMeasurementsWithSeparators().values(); // Resore order @@ -208,7 +208,7 @@ auto VPatternRecipe::Measurement(const QSharedPointer &m) -> QDomE { SetAttribute(measurement, QStringLiteral("fullName"), m->GetGuiText()); - QString formula = m->GetFormula(); + QString const formula = m->GetFormula(); if (not formula.isEmpty()) { SetAttribute(measurement, QStringLiteral("formula"), m->GetFormula()); @@ -232,7 +232,7 @@ auto VPatternRecipe::Increments() -> QDomElement { QDomElement increments = createElement(QStringLiteral("increments")); - VContainer data = m_pattern->GetCompleteData(); + VContainer const data = m_pattern->GetCompleteData(); QList> patternIncrements = data.DataIncrementsWithSeparators().values(); // Resore order @@ -256,7 +256,7 @@ auto VPatternRecipe::PreviewCalculations() -> QDomElement { QDomElement previewCalculations = createElement(QStringLiteral("previewCalculations")); - VContainer data = m_pattern->GetCompleteData(); + VContainer const data = m_pattern->GetCompleteData(); QList> patternIncrements = data.DataIncrementsWithSeparators().values(); // Resore order @@ -304,7 +304,7 @@ auto VPatternRecipe::Content() -> QDomElement const QDomNodeList draws = m_pattern->documentElement().elementsByTagName(VAbstractPattern::TagDraw); for (int i = 0; i < draws.size(); ++i) { - QDomElement draw = draws.at(i).toElement(); + QDomElement const draw = draws.at(i).toElement(); if (draw.isNull()) { throw VExceptionInvalidHistory(tr("Invalid tag %1").arg(VAbstractPattern::TagDraw)); @@ -326,14 +326,14 @@ auto VPatternRecipe::Draft(const QDomElement &draft) -> QDomElement const QString draftName = draft.attribute(QStringLiteral("name")); SetAttribute(recipeDraft, QStringLiteral("name"), draftName); - VContainer data = m_pattern->GetCompletePPData(draftName); + VContainer const data = m_pattern->GetCompletePPData(draftName); QVector *history = m_pattern->getHistory(); for (auto &record : *history) { if (record.getNameDraw() == draftName) { - QDomElement step = Step(record, data); + QDomElement const step = Step(record, data); if (not step.isNull()) { recipeDraft.appendChild(step); @@ -482,7 +482,7 @@ auto VPatternRecipe::FinalMeasurements() -> QDomElement QDomElement recipeFinalMeasurements = createElement(QStringLiteral("finalMeasurements")); const QVector measurements = m_pattern->GetFinalMeasurements(); - VContainer data = m_pattern->GetCompleteData(); + VContainer const data = m_pattern->GetCompleteData(); for (const auto &m : measurements) { @@ -501,7 +501,7 @@ auto VPatternRecipe::FinalMeasurement(const VFinalMeasurement &fm, const VContai SetAttribute(recipeFinalMeasurement, QStringLiteral("name"), fm.name); SetAttribute(recipeFinalMeasurement, QStringLiteral("formula"), fm.formula); // TODO: localize - QScopedPointer cal(new Calculator()); + QScopedPointer const cal(new Calculator()); try { const qreal result = cal->EvalFormula(data.DataVariables(), fm.formula); @@ -656,7 +656,7 @@ auto VPatternRecipe::LineIntersect(const VToolRecord &record) -> QDomElement auto VPatternRecipe::Spline(const VToolRecord &record) -> QDomElement { auto *tool = GetPatternTool(record.getId()); - VSpline spl = tool->getSpline(); + VSpline const spl = tool->getSpline(); QDomElement step = createElement(TagStep); @@ -687,7 +687,7 @@ auto VPatternRecipe::Spline(const VToolRecord &record) -> QDomElement auto VPatternRecipe::CubicBezier(const VToolRecord &record) -> QDomElement { auto *tool = GetPatternTool(record.getId()); - VCubicBezier spl = tool->getSpline(); + VCubicBezier const spl = tool->getSpline(); QDomElement step = createElement(TagStep); @@ -743,7 +743,7 @@ auto VPatternRecipe::ArcWithLength(const VToolRecord &record) -> QDomElement auto VPatternRecipe::SplinePath(const VToolRecord &record) -> QDomElement { auto *tool = GetPatternTool(record.getId()); - VSplinePath spl = tool->getSplinePath(); + VSplinePath const spl = tool->getSplinePath(); QDomElement step = createElement(TagStep); @@ -751,7 +751,7 @@ auto VPatternRecipe::SplinePath(const VToolRecord &record) -> QDomElement SetAttribute(step, AttrLabel, tool->name()); QDomElement nodes = createElement(QStringLiteral("nodes")); - QVector path = spl.GetSplinePath(); + QVector const path = spl.GetSplinePath(); if (path.isEmpty()) { @@ -790,14 +790,14 @@ auto VPatternRecipe::SplinePath(const VToolRecord &record) -> QDomElement auto VPatternRecipe::CubicBezierPath(const VToolRecord &record) -> QDomElement { auto *tool = GetPatternTool(record.getId()); - VCubicBezierPath spl = tool->getSplinePath(); + VCubicBezierPath const spl = tool->getSplinePath(); QDomElement step = createElement(TagStep); ToolAttributes(step, tool); QDomElement nodes = createElement(QStringLiteral("nodes")); - QVector path = spl.GetSplinePath(); + QVector const path = spl.GetSplinePath(); if (path.isEmpty()) { @@ -1210,7 +1210,7 @@ auto VPatternRecipe::GroupOperationSource(VAbstractOperation *tool, quint32 id, SCASSERT(tool) QDomElement nodes = createElement(QStringLiteral("nodes")); - QVector items = tool->SourceItems(); + QVector const items = tool->SourceItems(); if (items.isEmpty()) { diff --git a/src/libs/vformat/vsinglelineoutlinechar.cpp b/src/libs/vformat/vsinglelineoutlinechar.cpp index a6b4da6b3..431ad5e58 100644 --- a/src/libs/vformat/vsinglelineoutlinechar.cpp +++ b/src/libs/vformat/vsinglelineoutlinechar.cpp @@ -63,10 +63,10 @@ Q_REQUIRED_RESULT auto ParseCorrectiosn(const QJsonObject &correctionsObject) -> } QHash segments; - QJsonObject segmentsObject = it.value().toObject(); + QJsonObject const segmentsObject = it.value().toObject(); for (auto segmentsIt = segmentsObject.constBegin(); segmentsIt != segmentsObject.constEnd(); ++segmentsIt) { - bool correct = segmentsIt.value().toBool(); + bool const correct = segmentsIt.value().toBool(); if (!correct) { segments.insert(segmentsIt.key().toInt(), correct); @@ -111,7 +111,7 @@ VSingleLineOutlineChar::VSingleLineOutlineChar(const QFont &font) //--------------------------------------------------------------------------------------------------------------------- void VSingleLineOutlineChar::ExportCorrections(const QString &dirPath) const { - QRawFont rawFont = QRawFont::fromFont(m_font); + QRawFont const rawFont = QRawFont::fromFont(m_font); QJsonObject correctionsObject; for (uint unicode = 0; unicode <= 0x10FFFF; ++unicode) @@ -119,7 +119,7 @@ void VSingleLineOutlineChar::ExportCorrections(const QString &dirPath) const // Check if the glyph is available for the font if (rawFont.supportsCharacter(unicode)) { - QChar character(unicode); + QChar const character(unicode); QPainterPath path; path.addText(0, 0, m_font, character); @@ -140,7 +140,7 @@ void VSingleLineOutlineChar::ExportCorrections(const QString &dirPath) const } } - QString filename = QStringLiteral("%1/%2.json").arg(dirPath, m_font.family()); + QString const filename = QStringLiteral("%1/%2.json").arg(dirPath, m_font.family()); QFile jsonFile(filename); if (!jsonFile.open(QIODevice::WriteOnly | QIODevice::Text)) { @@ -148,7 +148,7 @@ void VSingleLineOutlineChar::ExportCorrections(const QString &dirPath) const return; } - QJsonDocument jsonDocument(correctionsObject); + QJsonDocument const jsonDocument(correctionsObject); // Write the JSON string to the file QTextStream out(&jsonFile); @@ -158,16 +158,16 @@ void VSingleLineOutlineChar::ExportCorrections(const QString &dirPath) const //--------------------------------------------------------------------------------------------------------------------- void VSingleLineOutlineChar::LoadCorrections(const QString &dirPath) const { - QString fileName = QStringLiteral("%1.json").arg(m_font.family()); + QString const fileName = QStringLiteral("%1.json").arg(m_font.family()); QDir directory(dirPath); directory.setNameFilters(QStringList(fileName)); - QStringList matchingFiles = directory.entryList(); + QStringList const matchingFiles = directory.entryList(); if (matchingFiles.isEmpty()) { return; } - QString filePath = directory.absoluteFilePath(matchingFiles.constFirst()); + QString const filePath = directory.absoluteFilePath(matchingFiles.constFirst()); QFile jsonFile(filePath); if (!jsonFile.open(QIODevice::ReadOnly | QIODevice::Text)) @@ -177,10 +177,10 @@ void VSingleLineOutlineChar::LoadCorrections(const QString &dirPath) const } // Read the JSON data from the file - QByteArray jsonData = jsonFile.readAll(); + QByteArray const jsonData = jsonFile.readAll(); // Create a JSON document from the JSON data - QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonData); + QJsonDocument const jsonDocument = QJsonDocument::fromJson(jsonData); if (jsonDocument.isNull()) { @@ -188,14 +188,14 @@ void VSingleLineOutlineChar::LoadCorrections(const QString &dirPath) const return; } - QMutexLocker locker(singleLineOutlineCharMutex()); + QMutexLocker const locker(singleLineOutlineCharMutex()); cachedCorrections()->insert(m_font.family(), ParseCorrectiosn(jsonDocument.object())); } //--------------------------------------------------------------------------------------------------------------------- void VSingleLineOutlineChar::ClearCorrectionsCache() { - QMutexLocker locker(singleLineOutlineCharMutex()); + QMutexLocker const locker(singleLineOutlineCharMutex()); cachedCorrections()->remove(m_font.family()); } diff --git a/src/libs/vformat/vwatermark.cpp b/src/libs/vformat/vwatermark.cpp index 3b4f28dd1..e1b5d152b 100644 --- a/src/libs/vformat/vwatermark.cpp +++ b/src/libs/vformat/vwatermark.cpp @@ -79,7 +79,7 @@ void VWatermark::CreateEmptyWatermark() auto VWatermark::SaveDocument(const QString &fileName, QString &error) -> bool { // Update comment with Valentina version - QDomNode commentNode = documentElement().firstChild(); + QDomNode const commentNode = documentElement().firstChild(); if (commentNode.isComment()) { QDomComment comment = commentNode.toComment(); @@ -94,13 +94,13 @@ auto VWatermark::GetWatermark() const -> VWatermarkData { VWatermarkData data; - QDomNode root = documentElement(); + QDomNode const root = documentElement(); if (not root.isNull() && root.isElement()) { const QDomElement rootElement = root.toElement(); data.opacity = GetParametrInt(rootElement, AttrOpacity, QChar('2')); - QDomElement text = rootElement.firstChildElement(TagText); + QDomElement const text = rootElement.firstChildElement(TagText); if (not text.isNull()) { data.showText = GetParametrBool(text, AttrShow, trueStr); @@ -115,7 +115,7 @@ auto VWatermark::GetWatermark() const -> VWatermarkData data.textColor = color; } - QDomElement image = rootElement.firstChildElement(TagImage); + QDomElement const image = rootElement.firstChildElement(TagImage); if (not image.isNull()) { data.showImage = GetParametrBool(image, AttrShow, trueStr); @@ -131,7 +131,7 @@ auto VWatermark::GetWatermark() const -> VWatermarkData //--------------------------------------------------------------------------------------------------------------------- void VWatermark::SetWatermark(const VWatermarkData &data) { - QDomNode root = documentElement(); + QDomNode const root = documentElement(); if (not root.isNull() && root.isElement()) { QDomElement rootElement = root.toElement(); diff --git a/src/libs/vganalytics/vganalytics.cpp b/src/libs/vganalytics/vganalytics.cpp index 962e4bda2..ce6da9a2d 100644 --- a/src/libs/vganalytics/vganalytics.cpp +++ b/src/libs/vganalytics/vganalytics.cpp @@ -109,7 +109,7 @@ auto GetSystemMemorySize() -> qint64 //--------------------------------------------------------------------------------------------------------------------- auto GetSystemMemorySizeGB() -> double { - qint64 totalMemoryBytes = GetSystemMemorySize(); + qint64 const totalMemoryBytes = GetSystemMemorySize(); if (totalMemoryBytes != -1) { return static_cast(totalMemoryBytes) / (1024 * 1024 * 1024); // Convert bytes to gigabytes @@ -121,7 +121,7 @@ auto GetSystemMemorySizeGB() -> double //--------------------------------------------------------------------------------------------------------------------- auto TotalMemory() -> QString { - double size = qRound(GetSystemMemorySizeGB() * 10.0) / 10.0; + double const size = qRound(GetSystemMemorySizeGB() * 10.0) / 10.0; return !qFuzzyCompare(size, -1.0) ? QStringLiteral("%1 GB").arg(size) : QStringLiteral("Unknown RAM"); } } // namespace @@ -262,7 +262,7 @@ void VGAnalytics::SendAppStartEvent(qint64 engagementTimeMsec) //--------------------------------------------------------------------------------------------------------------------- void VGAnalytics::SendAppCloseEvent(qint64 engagementTimeMsec) { - QHash params{ + QHash const params{ // {QStringLiteral("category"), ""}, // In order for user activity to display in standard reports like Realtime, engagement_time_msec and session_id // must be supplied as part of the params for an event. @@ -289,7 +289,7 @@ void VGAnalytics::SendAppCloseEvent(qint64 engagementTimeMsec) //--------------------------------------------------------------------------------------------------------------------- void VGAnalytics::SendPatternToolUsedEvent(qint64 engagementTimeMsec, const QString &toolName) { - QHash params{ + QHash const params{ // {QStringLiteral("category"), ""}, // In order for user activity to display in standard reports like Realtime, engagement_time_msec and session_id // must be supplied as part of the params for an event. @@ -304,7 +304,7 @@ void VGAnalytics::SendPatternToolUsedEvent(qint64 engagementTimeMsec, const QStr //--------------------------------------------------------------------------------------------------------------------- void VGAnalytics::SendPatternFormatVersion(qint64 engagementTimeMsec, const QString &version) { - QHash params{ + QHash const params{ // In order for user activity to display in standard reports like Realtime, engagement_time_msec and session_id // must be supplied as part of the params for an event. // https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events?client_type=gtag#optional_parameters_for_reports @@ -318,7 +318,7 @@ void VGAnalytics::SendPatternFormatVersion(qint64 engagementTimeMsec, const QStr //--------------------------------------------------------------------------------------------------------------------- void VGAnalytics::SendIndividualMeasurementsFormatVersion(qint64 engagementTimeMsec, const QString &version) { - QHash params{ + QHash const params{ // In order for user activity to display in standard reports like Realtime, engagement_time_msec and session_id // must be supplied as part of the params for an event. // https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events?client_type=gtag#optional_parameters_for_reports @@ -332,7 +332,7 @@ void VGAnalytics::SendIndividualMeasurementsFormatVersion(qint64 engagementTimeM //--------------------------------------------------------------------------------------------------------------------- void VGAnalytics::SendMultisizeMeasurementsFormatVersion(qint64 engagementTimeMsec, const QString &version) { - QHash params{ + QHash const params{ // In order for user activity to display in standard reports like Realtime, engagement_time_msec and session_id // must be supplied as part of the params for an event. // https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events?client_type=gtag#optional_parameters_for_reports @@ -346,7 +346,7 @@ void VGAnalytics::SendMultisizeMeasurementsFormatVersion(qint64 engagementTimeMs //--------------------------------------------------------------------------------------------------------------------- void VGAnalytics::SendLayoutFormatVersion(qint64 engagementTimeMsec, const QString &version) { - QHash params{ + QHash const params{ // In order for user activity to display in standard reports like Realtime, engagement_time_msec and session_id // must be supplied as part of the params for an event. // https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events?client_type=gtag#optional_parameters_for_reports @@ -439,7 +439,7 @@ auto VGAnalytics::InitAppStartEventParams(qint64 engagementTimeMsec) const -> QH auto VGAnalytics::CountryCode() -> QString { QNetworkAccessManager manager; - QNetworkRequest request(QUrl(QStringLiteral("https://api.country.is"))); + QNetworkRequest const request(QUrl(QStringLiteral("https://api.country.is"))); QNetworkReply *reply = manager.get(request); QTimer timer; @@ -460,9 +460,9 @@ auto VGAnalytics::CountryCode() -> QString // The API response was received before the timeout if (reply->error() == QNetworkReply::NoError) { - QByteArray responseData = reply->readAll(); + QByteArray const responseData = reply->readAll(); QJsonParseError error; - QJsonDocument jsonDoc = QJsonDocument::fromJson(responseData, &error); + QJsonDocument const jsonDoc = QJsonDocument::fromJson(responseData, &error); if (error.error == QJsonParseError::NoError && jsonDoc.isObject()) { diff --git a/src/libs/vganalytics/vganalyticsworker.cpp b/src/libs/vganalytics/vganalyticsworker.cpp index bd2c7157e..e50f6c9f8 100644 --- a/src/libs/vganalytics/vganalyticsworker.cpp +++ b/src/libs/vganalytics/vganalyticsworker.cpp @@ -67,12 +67,12 @@ VGAnalyticsWorker::VGAnalyticsWorker(QObject *parent) m_screensNumber = QString::number(QGuiApplication::screens().size()); QScreen *screen = QGuiApplication::primaryScreen(); - QSize logicalSize = screen->size(); - qreal devicePixelRatio = screen->devicePixelRatio(); + QSize const logicalSize = screen->size(); + qreal const devicePixelRatio = screen->devicePixelRatio(); m_screenPixelRatio = QString::number(devicePixelRatio); - int screenWidth = qRound(logicalSize.width() * devicePixelRatio); - int screenHeight = qRound(logicalSize.height() * devicePixelRatio); + int const screenWidth = qRound(logicalSize.width() * devicePixelRatio); + int const screenHeight = qRound(logicalSize.height() * devicePixelRatio); m_screenResolution = QStringLiteral("%1x%2").arg(screenWidth).arg(screenHeight); m_screenScaleFactor = screen->logicalDotsPerInchX() / 96.0; @@ -159,17 +159,17 @@ void VGAnalyticsWorker::ReadMessagesFromFile(const QList &dataList) QListIterator iter(dataList); while (iter.hasNext()) { - QString queryString = iter.next(); - QString dateString = iter.next(); - QDateTime dateTime = QDateTime::fromString(dateString, dateTimeFormat); + QString const queryString = iter.next(); + QString const dateString = iter.next(); + QDateTime const dateTime = QDateTime::fromString(dateString, dateTimeFormat); QueryBuffer buffer; - QJsonDocument jsonDocument = QJsonDocument::fromJson(queryString.toUtf8()); + QJsonDocument const jsonDocument = QJsonDocument::fromJson(queryString.toUtf8()); if (jsonDocument.isNull()) { qDebug() << "===> please check the string " << queryString.toUtf8(); } - QJsonObject jsonObject = jsonDocument.object(); + QJsonObject const jsonObject = jsonDocument.object(); buffer.postQuery = jsonObject; buffer.time = dateTime; @@ -221,9 +221,9 @@ auto VGAnalyticsWorker::PostMessage() -> QNetworkReply * connection = "keep-alive"_L1; } - QueryBuffer buffer = m_messageQueue.head(); - QDateTime sendTime = QDateTime::currentDateTime(); - qint64 timeDiff = buffer.time.msecsTo(sendTime); + QueryBuffer const buffer = m_messageQueue.head(); + QDateTime const sendTime = QDateTime::currentDateTime(); + qint64 const timeDiff = buffer.time.msecsTo(sendTime); if (timeDiff > fourHours) { @@ -232,7 +232,7 @@ auto VGAnalyticsWorker::PostMessage() -> QNetworkReply * return PostMessage(); } - QByteArray requestJson = QJsonDocument(buffer.postQuery).toJson(QJsonDocument::Compact); + QByteArray const requestJson = QJsonDocument(buffer.postQuery).toJson(QJsonDocument::Compact); m_request.setRawHeader("Connection", connection.toUtf8()); m_request.setHeader(QNetworkRequest::ContentLengthHeader, requestJson.length()); @@ -276,7 +276,7 @@ void VGAnalyticsWorker::PostMessageFinished() { auto *reply = qobject_cast(sender()); - int httpStausCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + int const httpStausCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if (httpStausCode < 200 || httpStausCode > 299) { LogMessage(VGAnalytics::Error, QStringLiteral("Error posting message: %1").arg(reply->errorString())); diff --git a/src/libs/vgeometry/vabstractarc.cpp b/src/libs/vgeometry/vabstractarc.cpp index 50efad947..0ca3ba40e 100644 --- a/src/libs/vgeometry/vabstractarc.cpp +++ b/src/libs/vgeometry/vabstractarc.cpp @@ -242,7 +242,7 @@ auto VAbstractArc::GetPath() const -> QPainterPath } else { - QPointF center = GetCenter().toQPointF(); + QPointF const center = GetCenter().toQPointF(); QRectF rec = QRectF(center.x(), center.y(), accuracyPointOnLine * 2, accuracyPointOnLine * 2); rec.translate(-rec.center().x(), -rec.center().y()); path.addEllipse(rec); diff --git a/src/libs/vgeometry/vabstractcubicbezier.cpp b/src/libs/vgeometry/vabstractcubicbezier.cpp index 3a01fb3ea..a9a2c1fca 100644 --- a/src/libs/vgeometry/vabstractcubicbezier.cpp +++ b/src/libs/vgeometry/vabstractcubicbezier.cpp @@ -352,7 +352,7 @@ auto PointBezier_r(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, q //---------------------- auto BezierTailPoints = [x1234, y1234, x234, y234, x34, y34, x4, y4, level, approximationScale]() { - QVector tail; + QVector const tail; return PointBezier_r(x1234, y1234, x234, y234, x34, y34, x4, y4, static_cast(level + 1), tail, approximationScale); }; @@ -365,7 +365,7 @@ auto PointBezier_r(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, q if (level < 1) { - QFuture> futureBezier = QtConcurrent::run(BezierPoints); + QFuture> const futureBezier = QtConcurrent::run(BezierPoints); const QVector tail = BezierTailPoints(); return futureBezier.result() + tail; } diff --git a/src/libs/vgeometry/vabstractcubicbezierpath.cpp b/src/libs/vgeometry/vabstractcubicbezierpath.cpp index cbde0f8da..db77f2167 100644 --- a/src/libs/vgeometry/vabstractcubicbezierpath.cpp +++ b/src/libs/vgeometry/vabstractcubicbezierpath.cpp @@ -245,7 +245,7 @@ auto VAbstractCubicBezierPath::CutSplinePath(qreal length, qint32 &p1, qint32 &p if (p1 > 0) { const VSplinePoint &splP1 = points.at(p1); - QLineF line(splP1.P().toQPointF(), spl1p2); + QLineF const line(splP1.P().toQPointF(), spl1p2); if (qFuzzyIsNull(line.length())) { spl1p2.rx() += ToPixel(0.1, Unit::Mm); @@ -259,7 +259,7 @@ auto VAbstractCubicBezierPath::CutSplinePath(qreal length, qint32 &p1, qint32 &p if (p2 < points.size() - 1) { const VSplinePoint &splP2 = points.at(p2); - QLineF line(splP2.P().toQPointF(), spl2p3); + QLineF const line(splP2.P().toQPointF(), spl2p3); if (qFuzzyIsNull(line.length())) { spl2p3.rx() += ToPixel(0.1, Unit::Mm); diff --git a/src/libs/vgeometry/vabstractcurve.cpp b/src/libs/vgeometry/vabstractcurve.cpp index 5669322d0..cc4be22d3 100644 --- a/src/libs/vgeometry/vabstractcurve.cpp +++ b/src/libs/vgeometry/vabstractcurve.cpp @@ -49,8 +49,8 @@ auto NodeCurvature(const QPointF &p1, const QPointF &p2, const QPointF &p3, doub QLineF l1(p2, p1); l1.setAngle(l1.angle() + 180); - QLineF l2(p2, p3); - double angle = qDegreesToRadians(l2.angleTo(l1)); + QLineF const l2(p2, p3); + double const angle = qDegreesToRadians(l2.angleTo(l1)); return qSin(angle / 2.0) / length; } @@ -58,12 +58,12 @@ auto NodeCurvature(const QPointF &p1, const QPointF &p2, const QPointF &p3, doub //--------------------------------------------------------------------------------------------------------------------- auto MinimalLength(const QVector &points) -> double { - vsizetype numPoints = points.size(); + vsizetype const numPoints = points.size(); double smallestDistance = std::numeric_limits::max(); for (int i = 0; i < numPoints - 1; ++i) { - double distance = QLineF(points[i], points[i + 1]).length(); + double const distance = QLineF(points[i], points[i + 1]).length(); if (!qFuzzyIsNull(distance)) { smallestDistance = std::min(smallestDistance, distance); @@ -649,14 +649,14 @@ void VAbstractCurve::SetAliasSuffix(const QString &aliasSuffix) //--------------------------------------------------------------------------------------------------------------------- auto VAbstractCurve::Curvature(const QVector &vertices) -> double { - vsizetype numVertices = vertices.size(); + vsizetype const numVertices = vertices.size(); if (numVertices < 3) { // A polygonal chain needs at least 3 vertices return 0.0; } - qreal minLength = MinimalLength(vertices); + qreal const minLength = MinimalLength(vertices); double sumCurvature = 0.0; for (vsizetype i = 1; i < vertices.size() - 1; ++i) diff --git a/src/libs/vgeometry/varc.cpp b/src/libs/vgeometry/varc.cpp index 4b9a02928..10572d037 100644 --- a/src/libs/vgeometry/varc.cpp +++ b/src/libs/vgeometry/varc.cpp @@ -237,7 +237,7 @@ auto VArc::GetLength() const -> qreal */ auto VArc::GetP1() const -> QPointF { - QPointF p1(GetCenter().x() + qAbs(d->radius), GetCenter().y()); + QPointF const p1(GetCenter().x() + qAbs(d->radius), GetCenter().y()); QLineF centerP1(static_cast(GetCenter()), p1); centerP1.setAngle(GetStartAngle()); return centerP1.p2(); @@ -250,7 +250,7 @@ auto VArc::GetP1() const -> QPointF */ auto VArc::GetP2() const -> QPointF { - QPointF p2(GetCenter().x() + qAbs(d->radius), GetCenter().y()); + QPointF const p2(GetCenter().x() + qAbs(d->radius), GetCenter().y()); QLineF centerP2(static_cast(GetCenter()), p2); centerP2.setAngle(GetEndAngle()); return centerP2.p2(); @@ -381,7 +381,7 @@ auto VArc::CutArc(qreal length, VArc &arc1, VArc &arc2, const QString &pointName return GetP2(); } - QLineF line = + QLineF const line = not IsFlipped() ? CutPoint(length, fullLength, pointName) : CutPointFlipped(length, fullLength, pointName); arc1 = VArc(GetCenter(), d->radius, d->formulaRadius, GetStartAngle(), GetFormulaF1(), line.angle(), @@ -419,7 +419,7 @@ auto VArc::OptimalApproximationScale(qreal radius, qreal f1, qreal f2, qreal tol { VArc arc(VPointF(), radius, f1, f2); arc.SetApproximationScale(scale); - qreal curvature = Curvature(arc.GetPoints()); + qreal const curvature = Curvature(arc.GetPoints()); if (expectedCurvature - curvature <= expectedCurvature * tolerance) { diff --git a/src/libs/vgeometry/vcubicbezierpath.cpp b/src/libs/vgeometry/vcubicbezierpath.cpp index 735c7cbc5..c1061b869 100644 --- a/src/libs/vgeometry/vcubicbezierpath.cpp +++ b/src/libs/vgeometry/vcubicbezierpath.cpp @@ -217,7 +217,7 @@ auto VCubicBezierPath::GetSpline(vsizetype index) const -> VSpline if (base + 1 > 1) { const QPointF b = static_cast(d->path.at(base)); - QLineF foot1(b, static_cast(d->path.at(base - 1))); + QLineF const foot1(b, static_cast(d->path.at(base - 1))); QLineF foot2(b, p2); foot2.setAngle(foot1.angle() + 180); diff --git a/src/libs/vgeometry/vellipticalarc.cpp b/src/libs/vgeometry/vellipticalarc.cpp index 74359f76d..83d31387e 100644 --- a/src/libs/vgeometry/vellipticalarc.cpp +++ b/src/libs/vgeometry/vellipticalarc.cpp @@ -67,12 +67,12 @@ auto VLen(fpm::fixed_16_16 x, fpm::fixed_16_16 y) -> fpm::fixed_16_16 //--------------------------------------------------------------------------------------------------------------------- auto AuxRadius(fpm::fixed_16_16 xP, fpm::fixed_16_16 yP, fpm::fixed_16_16 xQ, fpm::fixed_16_16 yQ) -> fpm::fixed_16_16 { - fpm::fixed_16_16 dP = VLen(xP, yP); - fpm::fixed_16_16 dQ = VLen(xQ, yQ); - fpm::fixed_16_16 dJ = VLen(xP + xQ, yP + yQ); - fpm::fixed_16_16 dK = VLen(xP - xQ, yP - yQ); - fpm::fixed_16_16 r1 = qMax(dP, dQ); - fpm::fixed_16_16 r2 = qMax(dJ, dK); + fpm::fixed_16_16 const dP = VLen(xP, yP); + fpm::fixed_16_16 const dQ = VLen(xQ, yQ); + fpm::fixed_16_16 const dJ = VLen(xP + xQ, yP + yQ); + fpm::fixed_16_16 const dK = VLen(xP - xQ, yP - yQ); + fpm::fixed_16_16 const r1 = qMax(dP, dQ); + fpm::fixed_16_16 const r2 = qMax(dJ, dK); return qMax(r1 + r1 / 16, r2 - r2 / 4); } @@ -81,7 +81,7 @@ auto AngularInc(fpm::fixed_16_16 xP, fpm::fixed_16_16 yP, fpm::fixed_16_16 xQ, f fpm::fixed_16_16 flatness) -> int { - fpm::fixed_16_16 r = AuxRadius(xP, yP, xQ, yQ); + fpm::fixed_16_16 const r = AuxRadius(xP, yP, xQ, yQ); fpm::fixed_16_16 err2{r >> 3}; // 2nd-order term fpm::fixed_16_16 err4{r >> 7}; @@ -109,7 +109,7 @@ inline void CircleGen(fpm::fixed_16_16 &u, fpm::fixed_16_16 &v, uint k) //--------------------------------------------------------------------------------------------------------------------- auto InitialValue(fpm::fixed_16_16 u0, fpm::fixed_16_16 v0, uint k) -> fpm::fixed_16_16 { - uint shift = 2 * k + 3; + uint const shift = 2 * k + 3; fpm::fixed_16_16 w{u0 >> shift}; fpm::fixed_16_16 U0 = u0 - w + (v0 >> (k + 1)); @@ -125,7 +125,7 @@ auto EllipseCore(fpm::fixed_16_16 xC, fpm::fixed_16_16 yC, fpm::fixed_16_16 xP, fpm::fixed_16_16 xQ, fpm::fixed_16_16 yQ, fpm::fixed_16_16 sweep, fpm::fixed_16_16 flatness) -> QVector { - uint k = qMin(static_cast(AngularInc(xP, yP, xQ, yQ, flatness)), 16U); + uint const k = qMin(static_cast(AngularInc(xP, yP, xQ, yQ, flatness)), 16U); const uint count = static_cast(sweep.raw_value()) >> (16 - k); QVector arc; @@ -151,8 +151,8 @@ auto EllipseCore(fpm::fixed_16_16 xC, fpm::fixed_16_16 yC, fpm::fixed_16_16 xP, auto EllipticArcPoints(QPointF c, qreal radius1, qreal radius2, qreal astart, qreal asweep, qreal approximationScale) -> QVector { - fpm::fixed_16_16 xC{c.x()}; - fpm::fixed_16_16 yC{c.y()}; + fpm::fixed_16_16 const xC{c.x()}; + fpm::fixed_16_16 const yC{c.y()}; fpm::fixed_16_16 xP{c.x() + radius1}; fpm::fixed_16_16 yP{c.y()}; @@ -168,10 +168,10 @@ auto EllipticArcPoints(QPointF c, qreal radius1, qreal radius2, qreal astart, qr if (not qFuzzyIsNull(astart)) { // Set new conjugate diameter end points P’ and Q’ - fpm::fixed_16_16 cosa{cos(astart)}; - fpm::fixed_16_16 sina{sin(astart)}; - fpm::fixed_16_16 x{xP * cosa + xQ * sina}; - fpm::fixed_16_16 y{yP * cosa + yQ * sina}; + fpm::fixed_16_16 const cosa{cos(astart)}; + fpm::fixed_16_16 const sina{sin(astart)}; + fpm::fixed_16_16 const x{xP * cosa + xQ * sina}; + fpm::fixed_16_16 const y{yP * cosa + yQ * sina}; xQ = xQ * cosa - xP * sina; yQ = yQ * cosa - yP * sina; @@ -192,13 +192,13 @@ auto EllipticArcPoints(QPointF c, qreal radius1, qreal radius2, qreal astart, qr approximationScale = VAbstractApplication::VApp()->Settings()->GetCurveApproximationScale(); } - fpm::fixed_16_16 flatness{maxCurveApproximationScale / approximationScale * tolerance}; - fpm::fixed_16_16 swangle{asweep}; + fpm::fixed_16_16 const flatness{maxCurveApproximationScale / approximationScale * tolerance}; + fpm::fixed_16_16 const swangle{asweep}; QVector arc = EllipseCore(xC, yC, xP, yP, xQ, yQ, swangle, flatness); // Arc end point - fpm::fixed_16_16 cosb{qCos(asweep)}; - fpm::fixed_16_16 sinb{qSin(asweep)}; + fpm::fixed_16_16 const cosb{qCos(asweep)}; + fpm::fixed_16_16 const sinb{qSin(asweep)}; xP = xP * cosb + xQ * sinb; yP = yP * cosb + yQ * sinb; arc.append({static_cast(xP + xC), static_cast(yP + yC)}); @@ -491,7 +491,7 @@ auto VEllipticalArc::GetPoints() const -> QVector Q_RELAXED_CONSTEXPR qreal threshold = ToPixel(0.001, Unit::Mm); qreal radius1 = qMax(qAbs(d->radius1), threshold); qreal radius2 = qMax(qAbs(d->radius2), threshold); - qreal max = qMax(qAbs(d->radius1), qAbs(d->radius2)); + qreal const max = qMax(qAbs(d->radius1), qAbs(d->radius2)); qreal scale = 1; if (max > maxRadius) @@ -581,7 +581,7 @@ auto VEllipticalArc::CutArc(qreal length, VEllipticalArc &arc1, VEllipticalArc & return GetP2(); } - qreal len = CorrectCutLength(length, fullLength, pointName); + qreal const len = CorrectCutLength(length, fullLength, pointName); // the first arc has given length and startAngle just like in the origin arc arc1 = VEllipticalArc(len, QString().setNum(length), GetCenter(), d->radius1, d->radius2, d->formulaRadius1, @@ -662,7 +662,7 @@ void VEllipticalArc::FindF2(qreal length) // We need to calculate the second angle // first approximation of angle between start and end angles - VPointF center = GetCenter(); + VPointF const center = GetCenter(); QLineF radius1(center.x(), center.y(), center.x() + qAbs(d->radius1), center.y()); radius1.setAngle(GetStartAngle()); radius1.setAngle(radius1.angle() + gap); @@ -732,7 +732,7 @@ auto VEllipticalArc::GetP(qreal angle) const -> QPointF return GetCenter().toQPointF(); } - QPointF p(line.p2().x() / k, line.p2().y() / k); + QPointF const p(line.p2().x() / k, line.p2().y() / k); QLineF line2(QPointF(), p); SCASSERT(VFuzzyComparePossibleNulls(line2.angle(), line.angle())) @@ -749,8 +749,8 @@ auto VEllipticalArc::ArcPoints(QVector points) const -> QVectorradius1), qAbs(d->radius2)) * 2; + QPointF const center = VAbstractArc::GetCenter().toQPointF(); + qreal const radius = qMax(qAbs(d->radius1), qAbs(d->radius2)) * 2; QLineF start(center.x(), center.y(), center.x() + radius, center.y()); start.setAngle(VAbstractArc::GetStartAngle()); @@ -764,15 +764,15 @@ auto VEllipticalArc::ArcPoints(QVector points) const -> QVector head = points.mid(0, i + 1); + QVector const head = points.mid(0, i + 1); QVector tail = points.mid(i + 1, -1); tail = JoinVectors({p}, tail); @@ -795,12 +795,12 @@ auto VEllipticalArc::ArcPoints(QVector points) const -> QVector points) const -> QVector>(QDataStream &dataStream, VLayoutPassmark &data) -> QDataStream & if (actualStreamHeader != VLayoutPassmark::streamHeader) { - QString message = QCoreApplication::tr("VLayoutPassmark prefix mismatch error: actualStreamHeader = 0x%1 and " - "streamHeader = 0x%2") - .arg(actualStreamHeader, 8, 0x10, '0'_L1) - .arg(VLayoutPassmark::streamHeader, 8, 0x10, '0'_L1); + QString const message = + QCoreApplication::tr("VLayoutPassmark prefix mismatch error: actualStreamHeader = 0x%1 and " + "streamHeader = 0x%2") + .arg(actualStreamHeader, 8, 0x10, '0'_L1) + .arg(VLayoutPassmark::streamHeader, 8, 0x10, '0'_L1); throw VException(message); } @@ -71,10 +72,10 @@ auto operator>>(QDataStream &dataStream, VLayoutPassmark &data) -> QDataStream & if (actualClassVersion > VLayoutPassmark::classVersion) { - QString message = QCoreApplication::tr("VLayoutPassmark compatibility error: actualClassVersion = %1 and " - "classVersion = %2") - .arg(actualClassVersion) - .arg(VLayoutPassmark::classVersion); + QString const message = QCoreApplication::tr("VLayoutPassmark compatibility error: actualClassVersion = %1 and " + "classVersion = %2") + .arg(actualClassVersion) + .arg(VLayoutPassmark::classVersion); throw VException(message); } diff --git a/src/libs/vgeometry/vgobject.cpp b/src/libs/vgeometry/vgobject.cpp index 0cddb8eb4..193845471 100644 --- a/src/libs/vgeometry/vgobject.cpp +++ b/src/libs/vgeometry/vgobject.cpp @@ -69,7 +69,7 @@ auto PerpDotProduct(const QPointF &p1, const QPointF &p2, const QPointF &t) -> d auto GetEpsilon(const QPointF &t, QPointF p1, QPointF p2, qreal accuracy) -> double { QLineF edge1(p1, p2); - QLineF edge2(p1, t); + QLineF const edge2(p1, t); if (edge2.length() > edge1.length()) { edge1.setLength(edge2.length()); @@ -318,8 +318,8 @@ auto VGObject::BuildRay(const QPointF &firstPoint, const qreal &angle, const QRe if (not rect.contains(firstPoint)) { // If point outside of scene rect create one around point and unite two rects. - QRectF rectangle(firstPoint.x() - rect.width() / 2, firstPoint.y() - rect.height() / 2, rect.width(), - rect.height()); + QRectF const rectangle(firstPoint.x() - rect.width() / 2, firstPoint.y() - rect.height() / 2, rect.width(), + rect.height()); rect = rect.united(rectangle); } const qreal diagonal = qSqrt(pow(rect.height(), 2) + pow(rect.width(), 2)); @@ -457,7 +457,9 @@ auto VGObject::LineIntersectCircle(const QPointF ¢er, qreal radius, const QL } // coefficient for equation of segment - qreal a = 0, b = 0, c = 0; + qreal a = 0; + qreal b = 0; + qreal c = 0; LineCoefficients(line, &a, &b, &c); // projection center of circle on to line const QPointF p = ClosestPoint(line, center); @@ -496,13 +498,15 @@ auto VGObject::LineIntersectCircle(const QPointF ¢er, qreal radius, const QL */ auto VGObject::ClosestPoint(const QLineF &line, const QPointF &point) -> QPointF { - qreal a = 0, b = 0, c = 0; + qreal a = 0; + qreal b = 0; + qreal c = 0; LineCoefficients(line, &a, &b, &c); - qreal x = point.x() + a; - qreal y = b + point.y(); - QLineF lin(point, QPointF(x, y)); + qreal const x = point.x() + a; + qreal const y = b + point.y(); + QLineF const lin(point, QPointF(x, y)); QPointF p; - QLineF::IntersectType intersect = line.intersects(lin, &p); + QLineF::IntersectType const intersect = line.intersects(lin, &p); if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection) { @@ -529,7 +533,7 @@ auto VGObject::addVector(const QPointF &p, const QPointF &p1, const QPointF &p2, void VGObject::LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c) { // coefficient for equation of segment - QPointF p1 = line.p1(); + QPointF const p1 = line.p1(); *a = line.p2().y() - p1.y(); *b = p1.x() - line.p2().x(); *c = -*a * p1.x() - *b * p1.y(); @@ -562,31 +566,31 @@ auto VGObject::IsPointOnLineSegment(const QPointF &t, const QPointF &p1, const Q QLineF edge(p1, p2); edge.setAngle(edge.angle() + degrees); edge.setLength(accuracy); - QPointF sP1 = edge.p2(); + QPointF const sP1 = edge.p2(); edge = QLineF(p2, p1); edge.setAngle(edge.angle() - degrees); edge.setLength(accuracy); - QPointF sP2 = edge.p2(); + QPointF const sP2 = edge.p2(); edge = QLineF(p2, p1); edge.setAngle(edge.angle() + degrees); edge.setLength(accuracy); - QPointF sP3 = edge.p2(); + QPointF const sP3 = edge.p2(); edge = QLineF(p1, p2); edge.setAngle(edge.angle() - degrees); edge.setLength(accuracy); - QPointF sP4 = edge.p2(); + QPointF const sP4 = edge.p2(); - QVector shape{sP1, sP2, sP3, sP4, sP1}; + QVector const shape{sP1, sP2, sP3, sP4, sP1}; for (int i = 0; i < shape.size() - 1; ++i) { const QPointF &sp1 = shape.at(i); const QPointF &sp2 = shape.at(i + 1); // This formula helps to determine on which side of a vector lies a point. - qreal position = (sp2.x() - sp1.x()) * (t.y() - sp1.y()) - (sp2.y() - sp1.y()) * (t.x() - sp1.x()); + qreal const position = (sp2.x() - sp1.x()) * (t.y() - sp1.y()) - (sp2.y() - sp1.y()) * (t.x() - sp1.x()); if (position < 0) { return false; @@ -676,7 +680,7 @@ auto VGObject::GetLengthContour(const QVector &contour, const QVector>(QDataStream &dataStream, VLayoutPlaceLabel &data) -> QDataStream if (actualStreamHeader != VLayoutPlaceLabel::streamHeader) { - QString message = QCoreApplication::tr("VLayoutPlaceLabel prefix mismatch error: actualStreamHeader = 0x%1 and " - "streamHeader = 0x%2") - .arg(actualStreamHeader, 8, 0x10, '0'_L1) - .arg(VLayoutPlaceLabel::streamHeader, 8, 0x10, '0'_L1); + QString const message = + QCoreApplication::tr("VLayoutPlaceLabel prefix mismatch error: actualStreamHeader = 0x%1 and " + "streamHeader = 0x%2") + .arg(actualStreamHeader, 8, 0x10, '0'_L1) + .arg(VLayoutPlaceLabel::streamHeader, 8, 0x10, '0'_L1); throw VException(message); } @@ -83,10 +84,11 @@ auto operator>>(QDataStream &dataStream, VLayoutPlaceLabel &data) -> QDataStream if (actualClassVersion > VLayoutPlaceLabel::classVersion) { - QString message = QCoreApplication::tr("VLayoutPlaceLabel compatibility error: actualClassVersion = %1 and " - "classVersion = %2") - .arg(actualClassVersion) - .arg(VLayoutPlaceLabel::classVersion); + QString const message = + QCoreApplication::tr("VLayoutPlaceLabel compatibility error: actualClassVersion = %1 and " + "classVersion = %2") + .arg(actualClassVersion) + .arg(VLayoutPlaceLabel::classVersion); throw VException(message); } diff --git a/src/libs/vgeometry/vspline.cpp b/src/libs/vgeometry/vspline.cpp index f2d019533..86ae459a8 100644 --- a/src/libs/vgeometry/vspline.cpp +++ b/src/libs/vgeometry/vspline.cpp @@ -249,8 +249,8 @@ auto VSpline::SplinePoints(const QPointF &p1, const QPointF &p4, qreal angle1, q p1p2.setAngle(angle1); QLineF p4p3(p4.x(), p4.y(), p4.x() + L * kAsm2, p4.y()); p4p3.setAngle(angle2); - QPointF p2 = p1p2.p2(); - QPointF p3 = p4p3.p2(); + QPointF const p2 = p1p2.p2(); + QPointF const p3 = p4p3.p2(); return GetCubicBezierPoints(p1, p2, p3, p4, approximationScale); } diff --git a/src/libs/vgeometry/vspline_p.h b/src/libs/vgeometry/vspline_p.h index 7b04ff247..ccef09b95 100644 --- a/src/libs/vgeometry/vspline_p.h +++ b/src/libs/vgeometry/vspline_p.h @@ -127,7 +127,7 @@ inline VSplineData::VSplineData(const VPointF &p1, QPointF p2, QPointF p3, const : p1(p1), p4(p4) { - QLineF p1p2(static_cast(p1), static_cast(p2)); + QLineF const p1p2(static_cast(p1), static_cast(p2)); angle1 = p1p2.angle(); angle1F = QString::number(angle1); @@ -138,7 +138,7 @@ inline VSplineData::VSplineData(const VPointF &p1, QPointF p2, QPointF p3, const c1LengthF = QString::number(VAbstractValApplication::VApp()->fromPixel(c1Length)); } - QLineF p4p3(static_cast(p4), static_cast(p3)); + QLineF const p4p3(static_cast(p4), static_cast(p3)); angle2 = p4p3.angle(); angle2F = QString::number(angle2); @@ -171,7 +171,7 @@ inline VSplineData::VSplineData(const VPointF &p1, const VPointF &p4, qreal angl inline auto VSplineData::GetL(const QPointF &p1, const QPointF &p4, qreal kCurve) -> qreal { static const qreal angle = 90; - qreal length = VFuzzyComparePoints(p1, p4) ? accuracyPointOnLine * 2 : QLineF(p1, p4).length(); + qreal const length = VFuzzyComparePoints(p1, p4) ? accuracyPointOnLine * 2 : QLineF(p1, p4).length(); const qreal radius = length / M_SQRT2; return kCurve * radius * 4 / 3 * qTan(angle * M_PI_4 / 180.0); } diff --git a/src/libs/vgeometry/vsplinepath.cpp b/src/libs/vgeometry/vsplinepath.cpp index 7947cbab7..d0a310892 100644 --- a/src/libs/vgeometry/vsplinepath.cpp +++ b/src/libs/vgeometry/vsplinepath.cpp @@ -69,7 +69,7 @@ VSplinePath::VSplinePath(const QVector &points, qreal kCurve, qui { const VFSplinePoint &p1 = points.at(i - 1); const VFSplinePoint &p2 = points.at(i); - VSpline spl(p1.P(), p2.P(), p1.Angle2(), p2.Angle1(), p1.KAsm2(), p2.KAsm1(), kCurve); + VSpline const spl(p1.P(), p2.P(), p1.Angle2(), p2.Angle1(), p1.KAsm2(), p2.KAsm1(), kCurve); newPoints[i - 1].SetP(p1.P()); newPoints[i - 1].SetAngle2(p1.Angle2(), spl.GetStartAngleFormula()); @@ -438,8 +438,8 @@ auto VSplinePath::GetFSplinePath() const -> QVector { const VSplinePoint &p1 = d->path.at(i - 1); const VSplinePoint &p2 = d->path.at(i); - VSpline spl(p1.P(), p2.P(), p1.Angle2(), p1.Angle2Formula(), p2.Angle1(), p2.Angle1Formula(), p1.Length2(), - p1.Length2Formula(), p2.Length1(), p2.Length1Formula(), 1); + VSpline const spl(p1.P(), p2.P(), p1.Angle2(), p1.Angle2Formula(), p2.Angle1(), p2.Angle1Formula(), + p1.Length2(), p1.Length2Formula(), p2.Length1(), p2.Length1Formula(), 1); points[i - 1].SetP(p1.P()); points[i - 1].SetAngle2(p1.Angle2()); diff --git a/src/libs/vlayout/dialogs/dialoglayoutscale.cpp b/src/libs/vlayout/dialogs/dialoglayoutscale.cpp index 08cdcd137..cc28037ec 100644 --- a/src/libs/vlayout/dialogs/dialoglayoutscale.cpp +++ b/src/libs/vlayout/dialogs/dialoglayoutscale.cpp @@ -84,8 +84,8 @@ void DialogLayoutScale::SetTiledMargins(QMarginsF margins) //--------------------------------------------------------------------------------------------------------------------- auto DialogLayoutScale::GetTiledMargins() const -> QMarginsF { - QMarginsF margins = QMarginsF(ui->doubleSpinBoxLeftField->value(), ui->doubleSpinBoxTopField->value(), - ui->doubleSpinBoxRightField->value(), ui->doubleSpinBoxBottomField->value()); + QMarginsF const margins = QMarginsF(ui->doubleSpinBoxLeftField->value(), ui->doubleSpinBoxTopField->value(), + ui->doubleSpinBoxRightField->value(), ui->doubleSpinBoxBottomField->value()); return UnitConvertor(margins, VAbstractValApplication::VApp()->patternUnits(), Unit::Mm); } @@ -202,7 +202,7 @@ void DialogLayoutScale::WriteSettings() const const Unit unit = VAbstractValApplication::VApp()->patternUnits(); // write Margins top, right, bottom, left - QMarginsF margins = QMarginsF(ui->doubleSpinBoxLeftField->value(), ui->doubleSpinBoxTopField->value(), - ui->doubleSpinBoxRightField->value(), ui->doubleSpinBoxBottomField->value()); + QMarginsF const margins = QMarginsF(ui->doubleSpinBoxLeftField->value(), ui->doubleSpinBoxTopField->value(), + ui->doubleSpinBoxRightField->value(), ui->doubleSpinBoxBottomField->value()); settings->SetTiledPDFMargins(margins, unit); } diff --git a/src/libs/vlayout/dialogs/watermarkwindow.cpp b/src/libs/vlayout/dialogs/watermarkwindow.cpp index b217b39d1..ff0570c22 100644 --- a/src/libs/vlayout/dialogs/watermarkwindow.cpp +++ b/src/libs/vlayout/dialogs/watermarkwindow.cpp @@ -87,7 +87,7 @@ WatermarkWindow::WatermarkWindow(const QString &patternPath, QWidget *parent) [this]() { bool ok; - QFont font = QFontDialog::getFont(&ok, m_data.font, this); + QFont const font = QFontDialog::getFont(&ok, m_data.font, this); if (ok) { WatermarkChangesWereSaved(false); @@ -141,7 +141,7 @@ WatermarkWindow::WatermarkWindow(const QString &patternPath, QWidget *parent) ui->pushButtonColorPicker->insertColor(Qt::darkGray, tr("Dark gray", "color")); ui->pushButtonColorPicker->insertColor(Qt::lightGray, tr("Light gray", "color")); - QVector colors = VAbstractApplication::VApp()->Settings()->GetWatermarkCustomColors(); + QVector const colors = VAbstractApplication::VApp()->Settings()->GetWatermarkCustomColors(); for (const auto &color : colors) { ui->pushButtonColorPicker->insertColor(color); @@ -178,7 +178,7 @@ auto WatermarkWindow::Open(QString path) -> bool // Convert to absolute path if need path = AbsoluteMPath(m_patternPath, path); - QFuture futureConverter = QtConcurrent::run( + QFuture const futureConverter = QtConcurrent::run( [path]() { std::unique_ptr converter(new VWatermarkConverter(path)); @@ -210,7 +210,7 @@ auto WatermarkWindow::Open(QString path) -> bool try { - QScopedPointer converter(futureConverter.result()); + QScopedPointer const converter(futureConverter.result()); m_curFileFormatVersion = converter->GetCurrentFormatVersion(); m_curFileFormatVersionStr = converter->GetFormatVersionStr(); doc.setXMLContent(converter->Convert()); @@ -274,7 +274,7 @@ void WatermarkWindow::showEvent(QShowEvent *event) } // do your init stuff here - QSize sz = VAbstractApplication::VApp()->Settings()->GetWatermarkEditorSize(); + QSize const sz = VAbstractApplication::VApp()->Settings()->GetWatermarkEditorSize(); if (not sz.isEmpty()) { resize(sz); @@ -305,7 +305,7 @@ void WatermarkWindow::on_actionNew_triggered() //--------------------------------------------------------------------------------------------------------------------- auto WatermarkWindow::on_actionSaveAs_triggered() -> bool { - QString filters(tr("Watermark files") + "(*.vwm)"_L1); + QString const filters(tr("Watermark files") + "(*.vwm)"_L1); QString dir; if (m_curFile.isEmpty()) { @@ -324,7 +324,7 @@ auto WatermarkWindow::on_actionSaveAs_triggered() -> bool return false; } - QFileInfo f(fileName); + QFileInfo const f(fileName); if (f.suffix().isEmpty() && f.suffix() != "vwm"_L1) { fileName += ".vwm"_L1; @@ -333,7 +333,7 @@ auto WatermarkWindow::on_actionSaveAs_triggered() -> bool if (f.exists() && m_curFile != fileName) { // Temporary try to lock the file before saving - VLockGuard tmp(fileName); + VLockGuard const tmp(fileName); if (not tmp.IsLocked()) { qCritical("%s", qUtf8Printable(tr("Failed to lock. This file already opened in another window."))); @@ -412,7 +412,7 @@ auto WatermarkWindow::on_actionSave_triggered() -> bool // #ifdef Q_OS_WIN32 // qt_ntfs_permission_lookup++; // turn checking on // #endif /*Q_OS_WIN32*/ - bool changed = + bool const changed = QFile::setPermissions(m_curFile, QFileInfo(m_curFile).permissions() | QFileDevice::WriteUser); // #ifdef Q_OS_WIN32 // qt_ntfs_permission_lookup--; // turn it off again @@ -437,7 +437,7 @@ auto WatermarkWindow::on_actionSave_triggered() -> bool } QString error; - bool result = SaveWatermark(m_curFile, error); + bool const result = SaveWatermark(m_curFile, error); if (result) { m_curFileFormatVersion = VWatermarkConverter::WatermarkMaxVer; @@ -461,7 +461,7 @@ void WatermarkWindow::on_actionOpen_triggered() { qDebug("Openning new watermark file."); const QString filter(tr("Watermark files") + " (*.vwm)"_L1); - QString dir = QDir::homePath(); + QString const dir = QDir::homePath(); qDebug("Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir)); const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr, VAbstractApplication::VApp()->NativeFileDialog()); @@ -490,7 +490,7 @@ auto WatermarkWindow::MaybeSave() -> bool { if (this->isWindowModified()) { - QScopedPointer messageBox( + QScopedPointer const messageBox( new QMessageBox(QMessageBox::Warning, tr("Unsaved changes"), tr("The watermark has been modified. Do you want to save your changes?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, this, Qt::Sheet)); @@ -605,7 +605,7 @@ auto WatermarkWindow::ContinueFormatRewrite(const QString ¤tFormatVersion, msgBox.setDefaultButton(QDialogButtonBox::No); msgBox.setIconPixmap(QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion).pixmap(32, 32)); - int dialogResult = msgBox.exec(); + int const dialogResult = msgBox.exec(); if (dialogResult == QDialog::Accepted) { diff --git a/src/libs/vlayout/vabstractpiece.cpp b/src/libs/vlayout/vabstractpiece.cpp index aebb5e68b..ad938c502 100644 --- a/src/libs/vlayout/vabstractpiece.cpp +++ b/src/libs/vlayout/vabstractpiece.cpp @@ -68,8 +68,8 @@ inline auto IsSameDirection(QPointF p1, QPointF p2, QPointF px) -> bool // Do we create a point outside of a path? inline auto IsOutsidePoint(QPointF p1, QPointF p2, QPointF px) -> bool { - QLineF seg1(p1, p2); - QLineF seg2(p1, px); + QLineF const seg1(p1, p2); + QLineF const seg2(p1, px); return IsSameDirection(p1, p2, px) && seg2.length() >= seg1.length(); } @@ -136,8 +136,8 @@ auto AngleByLength(QVector points, QPointF p1, QPointF p2, QPointF } else { - QLineF edge1(p2, p1); - QLineF edge2(p2, p3); + QLineF const edge1(p2, p1); + QLineF const edge2(p2, p3); const qreal angle = edge1.angleTo(edge2); if (angle > 180 && p.GetAngleType() != PieceNodeAngle::ByLengthCurve) @@ -225,8 +225,8 @@ auto AngleByIntersection(const QVector &points, QPointF p1, QPointF bool *needRollback = nullptr) -> QVector { { - QLineF edge1(p2, p1); - QLineF edge2(p2, p3); + QLineF const edge1(p2, p1); + QLineF const edge2(p2, p3); const qreal angle = edge1.angleTo(edge2); if (angle > 180) @@ -244,7 +244,7 @@ auto AngleByIntersection(const QVector &points, QPointF p1, QPointF QVector pointsIntr = points; // First point - QLineF edge2(p2, p3); + QLineF const edge2(p2, p3); QPointF px; QLineF::IntersectType type = edge2.intersects(bigLine1, &px); @@ -281,7 +281,7 @@ auto AngleByIntersection(const QVector &points, QPointF p1, QPointF } // Second point - QLineF edge1(p1, p2); + QLineF const edge1(p1, p2); type = edge1.intersects(bigLine2, &px); if (type == QLineF::NoIntersection) @@ -312,8 +312,8 @@ auto AngleByFirstSymmetry(const QVector &points, QPointF p1, QPoint bool *needRollback = nullptr) -> QVector { { - QLineF edge1(p2, p1); - QLineF edge2(p2, p3); + QLineF const edge1(p2, p1); + QLineF const edge2(p2, p3); const qreal angle = edge1.angleTo(edge2); if (angle > 180) @@ -329,7 +329,7 @@ auto AngleByFirstSymmetry(const QVector &points, QPointF p1, QPoint const QLineF axis = QLineF(p1, p2); - QLineF sEdge(VPointF::FlipPF(axis, bigLine2.p1()), VPointF::FlipPF(axis, bigLine2.p2())); + QLineF const sEdge(VPointF::FlipPF(axis, bigLine2.p1()), VPointF::FlipPF(axis, bigLine2.p2())); QPointF px1; QLineF::IntersectType type = sEdge.intersects(bigLine1, &px1); @@ -393,8 +393,8 @@ auto AngleBySecondSymmetry(const QVector &points, QPointF p1, QPoin bool *needRollback = nullptr) -> QVector { { - QLineF edge1(p2, p1); - QLineF edge2(p2, p3); + QLineF const edge1(p2, p1); + QLineF const edge2(p2, p3); const qreal angle = edge1.angleTo(edge2); if (angle > 180) @@ -410,7 +410,7 @@ auto AngleBySecondSymmetry(const QVector &points, QPointF p1, QPoin const QLineF axis = QLineF(p3, p2); - QLineF sEdge(VPointF::FlipPF(axis, bigLine1.p1()), VPointF::FlipPF(axis, bigLine1.p2())); + QLineF const sEdge(VPointF::FlipPF(axis, bigLine1.p1()), VPointF::FlipPF(axis, bigLine1.p2())); QPointF px1; QLineF::IntersectType type = sEdge.intersects(bigLine1, &px1); @@ -476,8 +476,8 @@ auto AngleByFirstRightAngle(const QVector &points, QPointF p1, QPoi bool *needRollback = nullptr) -> QVector { { - QLineF edge1(p2, p1); - QLineF edge2(p2, p3); + QLineF const edge1(p2, p1); + QLineF const edge2(p2, p3); const qreal angle = edge1.angleTo(edge2); if (angle > 270) @@ -488,10 +488,10 @@ auto AngleByFirstRightAngle(const QVector &points, QPointF p1, QPoi const qreal localWidth = p.MaxLocalSA(width); QVector pointsRA = points; - QLineF edge(p1, p2); + QLineF const edge(p1, p2); QPointF px; - QLineF::IntersectType type = edge.intersects(bigLine2, &px); + QLineF::IntersectType const type = edge.intersects(bigLine2, &px); if (type == QLineF::NoIntersection) { @@ -513,8 +513,8 @@ auto AngleByFirstRightAngle(const QVector &points, QPointF p1, QPoi } else { - QLineF edge1(p2, p1); - QLineF edge2(p2, p3); + QLineF const edge1(p2, p1); + QLineF const edge2(p2, p3); const qreal angle = edge1.angleTo(edge2); if (angle > 180) @@ -544,8 +544,8 @@ auto AngleBySecondRightAngle(QVector points, QPointF p1, QPointF p2 bool *needRollback = nullptr) -> QVector { { - QLineF edge1(p2, p1); - QLineF edge2(p2, p3); + QLineF const edge1(p2, p1); + QLineF const edge2(p2, p3); const qreal angle = edge1.angleTo(edge2); if (angle > 270) @@ -560,10 +560,10 @@ auto AngleBySecondRightAngle(QVector points, QPointF p1, QPointF p2 } const qreal localWidth = p.MaxLocalSA(width); - QLineF edge(p2, p3); + QLineF const edge(p2, p3); QPointF px; - QLineF::IntersectType type = edge.intersects(bigLine1, &px); + QLineF::IntersectType const type = edge.intersects(bigLine1, &px); if (type == QLineF::NoIntersection) { @@ -590,8 +590,8 @@ auto AngleBySecondRightAngle(QVector points, QPointF p1, QPointF p2 } else { - QLineF edge1(p2, p1); - QLineF edge2(p2, p3); + QLineF const edge1(p2, p1); + QLineF const edge2(p2, p3); const qreal angle = edge1.angleTo(edge2); if (angle > 180) @@ -642,8 +642,8 @@ auto AngleBySecondRightAngle(QVector points, QPointF p1, QPointF p2 //--------------------------------------------------------------------------------------------------------------------- auto BisectorLine(const QPointF &p1, const QPointF &p2, const QPointF &p3) -> QLineF { - QLineF line1(p2, p1); - QLineF line2(p2, p3); + QLineF const line1(p2, p1); + QLineF const line2(p2, p3); QLineF bLine; const qreal angle1 = line1.angleTo(line2); @@ -747,7 +747,7 @@ void RollbackByLength(QVector &ekvPoints, const QVector & QVector temp = ekvPoints; temp.insert(ekvPoints.size() - 1, VRawSAPoint(bigLine1.p2(), points.at(0).CurvePoint(), points.at(0).TurnPoint())); - bool success = Rollback(temp, VAbstractPiece::ParallelLine(points.at(0), points.at(1), width)); + bool const success = Rollback(temp, VAbstractPiece::ParallelLine(points.at(0), points.at(1), width)); if (success) { @@ -760,11 +760,11 @@ void RollbackBySecondEdgeSymmetry(QVector &ekvPoints, const QVector { const QLineF axis = QLineF(points.at(points.size() - 1), points.at(1)); const QLineF bigLine1 = VAbstractPiece::ParallelLine(points.at(points.size() - 2), points.at(0), width); - QLineF sEdge(VPointF::FlipPF(axis, bigLine1.p1()), VPointF::FlipPF(axis, bigLine1.p2())); + QLineF const sEdge(VPointF::FlipPF(axis, bigLine1.p1()), VPointF::FlipPF(axis, bigLine1.p2())); QVector temp = ekvPoints; temp.insert(ekvPoints.size() - 1, VRawSAPoint(bigLine1.p2(), points.at(0).CurvePoint(), points.at(0).TurnPoint())); - bool success = Rollback(temp, sEdge); + bool const success = Rollback(temp, sEdge); if (success) { @@ -777,12 +777,12 @@ void RollbackByFirstEdgeSymmetry(QVector &ekvPoints, const QVector< { const QLineF axis = QLineF(points.at(points.size() - 2), points.at(points.size() - 1)); const QLineF bigLine2 = VAbstractPiece::ParallelLine(points.at(points.size() - 1), points.at(1), width); - QLineF sEdge(VPointF::FlipPF(axis, bigLine2.p1()), VPointF::FlipPF(axis, bigLine2.p2())); + QLineF const sEdge(VPointF::FlipPF(axis, bigLine2.p1()), VPointF::FlipPF(axis, bigLine2.p2())); const QLineF bigLine1 = VAbstractPiece::ParallelLine(points.at(points.size() - 2), points.at(0), width); QVector temp = ekvPoints; temp.insert(ekvPoints.size() - 1, VRawSAPoint(bigLine1.p2(), points.at(0).CurvePoint(), points.at(0).TurnPoint())); - bool success = Rollback(temp, sEdge); + bool const success = Rollback(temp, sEdge); if (success) { @@ -796,7 +796,7 @@ void RollbackByPointsIntersection(QVector &ekvPoints, const QVector const QLineF bigLine1 = VAbstractPiece::ParallelLine(points.at(points.size() - 2), points.at(0), width); QVector temp = ekvPoints; temp.insert(ekvPoints.size() - 1, VRawSAPoint(bigLine1.p2(), points.at(0).CurvePoint(), points.at(0).TurnPoint())); - bool success = Rollback(temp, QLineF(points.constLast(), points.at(1))); + bool const success = Rollback(temp, QLineF(points.constLast(), points.at(1))); if (success) { @@ -1234,9 +1234,9 @@ auto VAbstractPiece::EkvPoint(QVector points, const VSAPoint &p1Lin return points; } - QLineF edge1(p2Line2, p1Line2); - QLineF edge2(p2Line1, p1Line1); - qreal a = edge2.angleTo(edge1); + QLineF const edge1(p2Line2, p1Line2); + QLineF const edge2(p2Line1, p1Line1); + qreal const a = edge2.angleTo(edge1); if (a >= 175 && a <= 185 && not VFuzzyComparePossibleNulls(p2Line1.GetSABefore(width), p2Line1.GetSAAfter(width))) { @@ -1356,8 +1356,8 @@ auto VAbstractPiece::EkvPoint(QVector points, const VSAPoint &p1Lin if ((result1 < 0 || qFuzzyIsNull(result1)) && (result2 < 0 || qFuzzyIsNull(result2))) { // Dart case. A bisector watches outside. - QLineF edge1(p1Line1, p2Line1); - QLineF edge2(p1Line2, p2Line2); + QLineF const edge1(p1Line1, p2Line1); + QLineF const edge2(p1Line2, p2Line2); if (qAbs(edge1.length() - edge2.length()) <= qMax(edge1.length(), edge2.length()) * 0.2) { @@ -1476,16 +1476,16 @@ auto VAbstractPiece::IsEkvPointOnLine(const VSAPoint &iPoint, const VSAPoint &pr const QLineF bigLine1 = ParallelLine(prevPoint, iPoint, tmpWidth); const QLineF bigLine2 = ParallelLine(iPoint, nextPoint, tmpWidth); - bool seamOnLine = VGObject::IsPointOnLineviaPDP(iPoint, prevPoint, nextPoint); - bool sa1OnLine = VGObject::IsPointOnLineviaPDP(bigLine1.p2(), bigLine1.p1(), bigLine2.p2()); - bool sa2OnLine = VGObject::IsPointOnLineviaPDP(bigLine2.p1(), bigLine1.p1(), bigLine2.p2()); - bool saDiff = qAbs(prevPoint.GetSAAfter(tmpWidth) - nextPoint.GetSABefore(tmpWidth)) < accuracyPointOnLine; + bool const seamOnLine = VGObject::IsPointOnLineviaPDP(iPoint, prevPoint, nextPoint); + bool const sa1OnLine = VGObject::IsPointOnLineviaPDP(bigLine1.p2(), bigLine1.p1(), bigLine2.p2()); + bool const sa2OnLine = VGObject::IsPointOnLineviaPDP(bigLine2.p1(), bigLine1.p1(), bigLine2.p2()); + bool const saDiff = qAbs(prevPoint.GetSAAfter(tmpWidth) - nextPoint.GetSABefore(tmpWidth)) < accuracyPointOnLine; // left point that splits a curve - bool curve = (prevPoint.GetAngleType() == PieceNodeAngle::ByLengthCurve && - iPoint.GetAngleType() == PieceNodeAngle::ByLengthCurve) || - (nextPoint.GetAngleType() == PieceNodeAngle::ByLengthCurve && - iPoint.GetAngleType() == PieceNodeAngle::ByLengthCurve); + bool const curve = (prevPoint.GetAngleType() == PieceNodeAngle::ByLengthCurve && + iPoint.GetAngleType() == PieceNodeAngle::ByLengthCurve) || + (nextPoint.GetAngleType() == PieceNodeAngle::ByLengthCurve && + iPoint.GetAngleType() == PieceNodeAngle::ByLengthCurve); return seamOnLine && sa1OnLine && sa2OnLine && saDiff && not curve; } @@ -1679,7 +1679,7 @@ auto VAbstractPiece::RollbackSeamAllowance(QVector points, const QL clipped.reserve(points.count() + 1); for (auto i = points.count() - 1; i > 0; --i) { - QLineF segment(points.at(i), points.at(i - 1)); + QLineF const segment(points.at(i), points.at(i - 1)); QPointF crosPoint; const QLineF::IntersectType type = cuttingEdge.intersects(segment, &crosPoint); @@ -1700,8 +1700,8 @@ auto VAbstractPiece::RollbackSeamAllowance(QVector points, const QL if (not *success && points.size() > 1) { QPointF crosPoint; - QLineF secondLast(points.at(points.size() - 2), points.at(points.size() - 1)); - QLineF::IntersectType type = secondLast.intersects(cuttingEdge, &crosPoint); + QLineF const secondLast(points.at(points.size() - 2), points.at(points.size() - 1)); + QLineF::IntersectType const type = secondLast.intersects(cuttingEdge, &crosPoint); if (type != QLineF::NoIntersection && IsOutsidePoint(secondLast.p1(), secondLast.p2(), crosPoint)) { @@ -1874,18 +1874,18 @@ auto VAbstractPiece::GrainlineMainLine(const VGrainlineData &geom, const VContai QPointF pt2(pt1.x() + dLen * qCos(dAng), pt1.y() - dLen * qSin(dAng)); - VPieceGrainline grainline(QLineF(pt1, pt2), geom.GetArrowType()); + VPieceGrainline const grainline(QLineF(pt1, pt2), geom.GetArrowType()); QVector v; if (grainline.IsFourWays()) { - QLineF mainLine = grainline.GetMainLine(); - QLineF secondaryLine = grainline.SecondaryLine(); + QLineF const mainLine = grainline.GetMainLine(); + QLineF const secondaryLine = grainline.SecondaryLine(); v = {mainLine.p1(), mainLine.p2(), secondaryLine.p1(), secondaryLine.p2()}; } else { - QLineF mainLine = grainline.GetMainLine(); + QLineF const mainLine = grainline.GetMainLine(); v = {mainLine.p1(), mainLine.p2()}; } @@ -1919,77 +1919,77 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab auto SegmentShape = [pos, box, LayoutPoint]() { - QVector shape{LayoutPoint(QPointF(pos.x(), pos.y() - box.height() / 2.0), true), - LayoutPoint(QPointF(pos.x(), pos.y() + box.height() / 2.0), true)}; + QVector const shape{LayoutPoint(QPointF(pos.x(), pos.y() - box.height() / 2.0), true), + LayoutPoint(QPointF(pos.x(), pos.y() + box.height() / 2.0), true)}; return PlaceLabelImg{shape}; }; auto RectangleShape = [pos, box, LayoutPoint]() { - QRectF 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)); + 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)); - QVector shape{LayoutPoint(rect.topLeft(), true), LayoutPoint(rect.topRight(), true), - LayoutPoint(rect.bottomRight(), true), LayoutPoint(rect.bottomLeft(), true), - LayoutPoint(rect.topLeft(), true)}; + QVector const shape{LayoutPoint(rect.topLeft(), true), LayoutPoint(rect.topRight(), true), + LayoutPoint(rect.bottomRight(), true), LayoutPoint(rect.bottomLeft(), true), + LayoutPoint(rect.topLeft(), true)}; return PlaceLabelImg{shape}; }; auto CrossShape = [pos, box, LayoutPoint]() { - QVector shape1{LayoutPoint(QPointF(pos.x(), pos.y() - box.height() / 2.0), true), - LayoutPoint(QPointF(pos.x(), pos.y() + box.height() / 2.0), true)}; + QVector const shape1{LayoutPoint(QPointF(pos.x(), pos.y() - box.height() / 2.0), true), + LayoutPoint(QPointF(pos.x(), pos.y() + box.height() / 2.0), true)}; - QVector shape2{LayoutPoint(QPointF(pos.x() - box.width() / 2.0, pos.y()), true), - LayoutPoint(QPointF(pos.x() + box.width() / 2.0, pos.y()), true)}; + QVector const shape2{LayoutPoint(QPointF(pos.x() - box.width() / 2.0, pos.y()), true), + LayoutPoint(QPointF(pos.x() + box.width() / 2.0, pos.y()), true)}; return PlaceLabelImg{shape1, shape2}; }; auto TshapedShape = [pos, box, LayoutPoint]() { - QPointF center2(pos.x(), pos.y() + box.height() / 2.0); + QPointF const center2(pos.x(), pos.y() + box.height() / 2.0); - QVector shape1{LayoutPoint(QPointF(pos.x(), pos.y()), true), LayoutPoint(center2, true)}; + QVector const shape1{LayoutPoint(QPointF(pos.x(), pos.y()), true), LayoutPoint(center2, true)}; - QVector shape2{LayoutPoint(QPointF(center2.x() - box.width() / 2.0, center2.y()), true), - LayoutPoint(QPointF(center2.x() + box.width() / 2.0, center2.y()), true)}; + QVector const shape2{LayoutPoint(QPointF(center2.x() - box.width() / 2.0, center2.y()), true), + LayoutPoint(QPointF(center2.x() + box.width() / 2.0, center2.y()), true)}; return PlaceLabelImg{shape1, shape2}; }; auto DoubletreeShape = [pos, box, LayoutPoint]() { - QRectF 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)); + 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)); - QVector shape1{LayoutPoint(rect.topLeft(), true), LayoutPoint(rect.bottomRight(), true)}; + QVector const shape1{LayoutPoint(rect.topLeft(), true), LayoutPoint(rect.bottomRight(), true)}; - QVector shape2{LayoutPoint(rect.topRight(), true), LayoutPoint(rect.bottomLeft(), true)}; + QVector const shape2{LayoutPoint(rect.topRight(), true), LayoutPoint(rect.bottomLeft(), true)}; return PlaceLabelImg{shape1, shape2}; }; auto CornerShape = [pos, box, LayoutPoint]() { - QVector shape1{LayoutPoint(QPointF(pos.x(), pos.y()), true), - LayoutPoint(QPointF(pos.x(), pos.y() + box.height() / 2.0), true)}; + QVector const shape1{LayoutPoint(QPointF(pos.x(), pos.y()), true), + LayoutPoint(QPointF(pos.x(), pos.y() + box.height() / 2.0), true)}; - QVector shape2{LayoutPoint(QPointF(pos.x() - box.width() / 2.0, pos.y()), true), - LayoutPoint(QPointF(pos.x(), pos.y()), true)}; + QVector const shape2{LayoutPoint(QPointF(pos.x() - box.width() / 2.0, pos.y()), true), + LayoutPoint(QPointF(pos.x(), pos.y()), true)}; return PlaceLabelImg{shape1, shape2}; }; auto TriangleShape = [pos, box, LayoutPoint]() { - QRectF 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)); + 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)); - QVector shape{LayoutPoint(rect.topLeft(), true), LayoutPoint(rect.topRight(), true), - LayoutPoint(rect.bottomRight(), true), LayoutPoint(rect.topLeft(), true)}; + QVector const shape{LayoutPoint(rect.topLeft(), true), LayoutPoint(rect.topRight(), true), + LayoutPoint(rect.bottomRight(), true), LayoutPoint(rect.topLeft(), true)}; return PlaceLabelImg{shape}; }; @@ -1999,13 +1999,13 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab const QPointF center1(pos.x(), pos.y() - box.height() / 2.0); const QPointF center2(pos.x(), pos.y() + box.height() / 2.0); - QVector shape1{LayoutPoint(center1, true), LayoutPoint(center2, true)}; + QVector const shape1{LayoutPoint(center1, true), LayoutPoint(center2, true)}; - QVector shape2{LayoutPoint(QPointF(center1.x() - box.width() / 2.0, center1.y()), true), - LayoutPoint(QPointF(center1.x() + box.width() / 2.0, center1.y()), true)}; + QVector const shape2{LayoutPoint(QPointF(center1.x() - box.width() / 2.0, center1.y()), true), + LayoutPoint(QPointF(center1.x() + box.width() / 2.0, center1.y()), true)}; - QVector shape3{LayoutPoint(QPointF(center2.x() - box.width() / 2.0, center2.y()), true), - LayoutPoint(QPointF(center2.x() + box.width() / 2.0, center2.y()), true)}; + QVector const shape3{LayoutPoint(QPointF(center2.x() - box.width() / 2.0, center2.y()), true), + LayoutPoint(QPointF(center2.x() + box.width() / 2.0, center2.y()), true)}; return PlaceLabelImg{shape1, shape2, shape3}; }; @@ -2013,11 +2013,11 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab auto ButtonShape = [pos, box, LayoutPoint]() { const qreal radius = qMin(box.width() / 2.0, box.height() / 2.0); - QVector shape1{LayoutPoint(QPointF(pos.x(), pos.y() - radius), true), - LayoutPoint(QPointF(pos.x(), pos.y() + radius), true)}; + QVector const shape1{LayoutPoint(QPointF(pos.x(), pos.y() - radius), true), + LayoutPoint(QPointF(pos.x(), pos.y() + radius), true)}; - QVector shape2{LayoutPoint(QPointF(pos.x() - radius, pos.y()), true), - LayoutPoint(QPointF(pos.x() + radius, pos.y()), true)}; + QVector const shape2{LayoutPoint(QPointF(pos.x() - radius, pos.y()), true), + LayoutPoint(QPointF(pos.x() + radius, pos.y()), true)}; const qreal circleSize = 0.85; VArc arc(VPointF(pos), radius * circleSize, 0, 360); diff --git a/src/libs/vlayout/vabstractpiece_p.h b/src/libs/vlayout/vabstractpiece_p.h index b596e8160..fc795e5b3 100644 --- a/src/libs/vlayout/vabstractpiece_p.h +++ b/src/libs/vlayout/vabstractpiece_p.h @@ -135,10 +135,11 @@ inline auto operator>>(QDataStream &dataStream, VAbstractPieceData &piece) -> QD if (actualStreamHeader != VAbstractPieceData::streamHeader) { - QString message = QCoreApplication::tr("VAbstractPieceData prefix mismatch error: actualStreamHeader = 0x%1 " - "and streamHeader = 0x%2") - .arg(actualStreamHeader, 8, 0x10, QLatin1Char('0')) - .arg(VAbstractPieceData::streamHeader, 8, 0x10, QLatin1Char('0')); + QString const message = + QCoreApplication::tr("VAbstractPieceData prefix mismatch error: actualStreamHeader = 0x%1 " + "and streamHeader = 0x%2") + .arg(actualStreamHeader, 8, 0x10, QLatin1Char('0')) + .arg(VAbstractPieceData::streamHeader, 8, 0x10, QLatin1Char('0')); throw VException(message); } @@ -147,10 +148,11 @@ inline auto operator>>(QDataStream &dataStream, VAbstractPieceData &piece) -> QD if (actualClassVersion > VAbstractPieceData::classVersion) { - QString message = QCoreApplication::tr("VAbstractPieceData compatibility error: actualClassVersion = %1 and " - "classVersion = %2") - .arg(actualClassVersion) - .arg(VAbstractPieceData::classVersion); + QString const message = + QCoreApplication::tr("VAbstractPieceData compatibility error: actualClassVersion = %1 and " + "classVersion = %2") + .arg(actualClassVersion) + .arg(VAbstractPieceData::classVersion); throw VException(message); } diff --git a/src/libs/vlayout/vboundary.cpp b/src/libs/vlayout/vboundary.cpp index 9b3837c91..961dba044 100644 --- a/src/libs/vlayout/vboundary.cpp +++ b/src/libs/vlayout/vboundary.cpp @@ -356,7 +356,7 @@ auto VBoundary::InsertDisconnect(QList &sequence, int sequence.insert(i, PrepareSequenceItem(sub2, drawMode, VBoundarySequenceItem::Boundary)); } - QVector> shape = PreparePassmarkShape(passmark, drawMode, item.mirror); + QVector> const shape = PreparePassmarkShape(passmark, drawMode, item.mirror); for (auto &subShape : shape) { sequence.insert(i, PrepareSequenceItem(subShape, drawMode, VBoundarySequenceItem::PassmarkShape)); @@ -378,7 +378,7 @@ auto VBoundary::InsertCutOut(QList &sequence, int i, { auto passmark = item.item.value(); - QVector> shape = PreparePassmarkShape(passmark, drawMode, item.mirror); + QVector> const shape = PreparePassmarkShape(passmark, drawMode, item.mirror); if (shape.isEmpty()) { return false; @@ -511,7 +511,7 @@ auto VBoundary::PrepareExternalVPassmarkShape(const VLayoutPassmark &passmark, b lines = VAbstractPiece::MapVector(lines, matrix); } - QLineF line1 = lines.constFirst(); + QLineF const line1 = lines.constFirst(); QVector shape; if (!drawMode) @@ -568,7 +568,7 @@ auto VBoundary::PrepareTPassmarkShape(const VLayoutPassmark &passmark, bool draw lines = VAbstractPiece::MapVector(lines, matrix); } - QLineF line1 = lines.constFirst(); + QLineF const line1 = lines.constFirst(); QVector shape1; shape1.append(TurnPoint(line1.p1())); shape1.append(TurnPoint(line1.p2())); @@ -617,7 +617,7 @@ auto VBoundary::PrepareUPassmarkShape(const VLayoutPassmark &passmark, bool mirr return {}; } - qreal radius = QLineF(passmark.baseLine.p1(), passmark.lines.constFirst().p1()).length(); + qreal const radius = QLineF(passmark.baseLine.p1(), passmark.lines.constFirst().p1()).length(); QVector lines = passmark.lines; if (mirrorNotch && !m_mirrorLine.isNull()) @@ -633,7 +633,7 @@ auto VBoundary::PrepareUPassmarkShape(const VLayoutPassmark &passmark, bool mirr return {}; } - QLineF line1 = lines.takeFirst(); + QLineF const line1 = lines.takeFirst(); QVector shape; shape.reserve(4 + passmark.lines.size() + 1); @@ -641,7 +641,7 @@ auto VBoundary::PrepareUPassmarkShape(const VLayoutPassmark &passmark, bool mirr shape.append(LayoutPoint(line1.p1(), true, false)); shape.append(LayoutPoint(line1.p2(), true, true)); - QLineF line2 = lines.takeLast(); + QLineF const line2 = lines.takeLast(); for (int i = 0; i < lines.size(); ++i) { diff --git a/src/libs/vlayout/vcontour.cpp b/src/libs/vlayout/vcontour.cpp index ecf690a80..7cf5eab89 100644 --- a/src/libs/vlayout/vcontour.cpp +++ b/src/libs/vlayout/vcontour.cpp @@ -67,7 +67,7 @@ auto OptimizeCombining(const QVector &contour, const QPointF &withdrawE return contour; } - QPointF withdrawFirst = contour.constLast(); + QPointF const withdrawFirst = contour.constLast(); bool optimize = false; int count = 0; vsizetype cutIndex = -1; diff --git a/src/libs/vlayout/vlayoutexporter.cpp b/src/libs/vlayout/vlayoutexporter.cpp index 0cefb1455..ffe857421 100644 --- a/src/libs/vlayout/vlayoutexporter.cpp +++ b/src/libs/vlayout/vlayoutexporter.cpp @@ -484,7 +484,7 @@ void VLayoutExporter::PdfToPs(const QStringList ¶ms) QGuiApplication::restoreOverrideCursor(); #endif - QFile f(params.constLast()); + QFile const f(params.constLast()); if (not f.exists()) { qCritical() << qUtf8Printable(tr("Creating file '%1' failed! %2").arg(params.constLast(), proc.errorString())); @@ -506,13 +506,13 @@ void VLayoutExporter::ExportToPDF(QGraphicsScene *scene, const QList(PrintDPI)); printer.setFullPage(m_ignorePrinterMargins); - QPageLayout::Orientation imageOrientation = + QPageLayout::Orientation const imageOrientation = m_imageRect.height() >= m_imageRect.width() ? QPageLayout::Portrait : QPageLayout::Landscape; - qreal width = FromPixel(m_imageRect.width() * m_xScale + m_margins.left() + m_margins.right(), Unit::Mm); - qreal height = FromPixel(m_imageRect.height() * m_yScale + m_margins.top() + m_margins.bottom(), Unit::Mm); + qreal const width = FromPixel(m_imageRect.width() * m_xScale + m_margins.left() + m_margins.right(), Unit::Mm); + qreal const height = FromPixel(m_imageRect.height() * m_yScale + m_margins.top() + m_margins.bottom(), Unit::Mm); - QSizeF pageSize = imageOrientation == QPageLayout::Portrait ? QSizeF(width, height) : QSizeF(height, width); + QSizeF const pageSize = imageOrientation == QPageLayout::Portrait ? QSizeF(width, height) : QSizeF(height, width); if (not printer.setPageSize(QPageSize(pageSize, QPageSize::Millimeter))) { qWarning() << tr("Cannot set printer page size"); diff --git a/src/libs/vlayout/vlayoutpaper.cpp b/src/libs/vlayout/vlayoutpaper.cpp index 388f4c662..59b11de69 100644 --- a/src/libs/vlayout/vlayoutpaper.cpp +++ b/src/libs/vlayout/vlayoutpaper.cpp @@ -299,7 +299,7 @@ auto VLayoutPaper::SaveResult(const VBestSquare &bestResult, const VLayoutPiece d->globalContour.SetContour(newGContour); VCachedPositions positionChache; - QVector layoutPoints = workDetail.GetMappedLayoutAllowancePoints(); + QVector const layoutPoints = workDetail.GetMappedLayoutAllowancePoints(); positionChache.boundingRect = VLayoutPiece::BoundingRect(layoutPoints); positionChache.layoutAllowancePath = VGObject::PainterPath(layoutPoints); d->positionsCache.append(positionChache); @@ -327,8 +327,8 @@ auto VLayoutPaper::GetPaperItem(bool autoCropLength, bool autoCropWidth, bool te if (autoCropLength || autoCropWidth) { - QScopedPointer scene(new QGraphicsScene()); - QList list = GetItemDetails(textAsPaths, togetherWithNotches, showLayoutAllowance); + QScopedPointer const scene(new QGraphicsScene()); + QList const list = GetItemDetails(textAsPaths, togetherWithNotches, showLayoutAllowance); for (auto *item : list) { scene->addItem(item); diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index 6db4ffeb9..6e72439db 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -197,7 +197,7 @@ auto FindLabelGeometry(const VPatternLabelData &labelData, const VContainer *pat auto RotatePoint(const QPointF &ptCenter, const QPointF &pt, qreal dAng) -> QPointF { QPointF ptDest; - QPointF ptRel = pt - ptCenter; + QPointF const ptRel = pt - ptCenter; ptDest.setX(cos(dAng) * ptRel.x() - sin(dAng) * ptRel.y()); ptDest.setY(sin(dAng) * ptRel.x() + cos(dAng) * ptRel.y()); @@ -250,7 +250,7 @@ auto ConvertPlaceLabels(const VPiece &piece, const VContainer *pattern) -> QVect auto PrepareSAPassmark(const VPiece &piece, const VContainer *pattern, const VPassmark &passmark, PassmarkSide side, bool &ok) -> VLayoutPassmark { - VPiecePassmarkData pData = passmark.Data(); + VPiecePassmarkData const pData = passmark.Data(); const QVector path = piece.GetUnitedPath(pattern); const int nodeIndex = VPiecePath::indexOfNode(path, pData.id); if (nodeIndex == -1) @@ -264,7 +264,7 @@ auto PrepareSAPassmark(const VPiece &piece, const VContainer *pattern, const VPa return {}; } - QVector baseLines = passmark.SAPassmarkBaseLine(piece, pattern, static_cast(side)); + QVector const baseLines = passmark.SAPassmarkBaseLine(piece, pattern, static_cast(side)); if (baseLines.isEmpty()) { const QString errorMsg = @@ -328,7 +328,7 @@ auto PreapreBuiltInSAPassmark(const VPiece &piece, const VContainer *pattern, co QT_WARNING_POP - VPiecePassmarkData pData = passmark.Data(); + VPiecePassmarkData const pData = passmark.Data(); const QVector path = piece.GetUnitedPath(pattern); const int nodeIndex = VPiecePath::indexOfNode(path, pData.id); if (nodeIndex == -1) @@ -387,19 +387,19 @@ auto PrepareGradationPlaceholders(const VContainer *data) -> QMap placeholders; - QString heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight()); + QString const heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight()); placeholders.insert(pl_height, heightValue); placeholders.insert(pl_dimensionX, heightValue); - QString sizeValue = QString::number(VAbstractValApplication::VApp()->GetDimensionSize()); + QString const sizeValue = QString::number(VAbstractValApplication::VApp()->GetDimensionSize()); placeholders.insert(pl_size, sizeValue); placeholders.insert(pl_dimensionY, sizeValue); - QString hipValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHip()); + QString const hipValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHip()); placeholders.insert(pl_hip, hipValue); placeholders.insert(pl_dimensionZ, hipValue); - QString waistValue = QString::number(VAbstractValApplication::VApp()->GetDimensionWaist()); + QString const waistValue = QString::number(VAbstractValApplication::VApp()->GetDimensionWaist()); placeholders.insert(pl_waist, waistValue); placeholders.insert(pl_dimensionW, waistValue); @@ -437,7 +437,7 @@ auto PrepareGradationPlaceholders(const VContainer *data) -> QMap &placeholders, QString line) -> QString { - QChar per('%'); + QChar const per('%'); auto TestDimension = [per, placeholders, line](const QString &placeholder, const QString &errorMsg) { @@ -913,7 +913,7 @@ void VLayoutPiece::SetPieceText(const QString &qsName, const VPieceLabelData &da v[i] = RotatePoint(ptCenter, v.at(i), dAng); } - QScopedPointer item(GetMainPathItem()); + QScopedPointer const item(GetMainPathItem()); d->m_detailLabel = CorrectPosition(item->boundingRect(), v); // generate text @@ -984,7 +984,7 @@ void VLayoutPiece::SetPatternInfo(VAbstractPattern *pDoc, const VPatternLabelDat { v[i] = RotatePoint(ptCenter, v.at(i), dAng); } - QScopedPointer item(GetMainPathItem()); + QScopedPointer const item(GetMainPathItem()); d->m_patternInfo = CorrectPosition(item->boundingRect(), v); // Generate text @@ -1131,9 +1131,9 @@ void VLayoutPiece::SetGrainline(const VPieceGrainline &grainline) //--------------------------------------------------------------------------------------------------------------------- void VLayoutPiece::SetGrainline(const VGrainlineData &geom, const VContainer *pattern) { - QScopedPointer item(GetMainPathItem()); + QScopedPointer const item(GetMainPathItem()); - QLineF mainLine = GrainlineMainLine(geom, pattern, item->boundingRect()); + QLineF const mainLine = GrainlineMainLine(geom, pattern, item->boundingRect()); if (mainLine.isNull()) { return; @@ -1410,8 +1410,8 @@ void VLayoutPiece::SetLayoutAllowancePoints(bool togetherWithNotches) if (togetherWithNotches) { const QVector passmarks = GetMappedPassmarks(); - bool seamAllowance = IsSeamAllowance() && !IsSeamAllowanceBuiltIn(); - bool builtInSeamAllowance = IsSeamAllowance() && IsSeamAllowanceBuiltIn(); + bool const seamAllowance = IsSeamAllowance() && !IsSeamAllowanceBuiltIn(); + bool const builtInSeamAllowance = IsSeamAllowance() && IsSeamAllowanceBuiltIn(); VBoundary boundary(pieceBoundary, seamAllowance, builtInSeamAllowance); boundary.SetPieceName(GetName()); @@ -1541,8 +1541,8 @@ auto VLayoutPiece::ContourPath(bool togetherWithNotches, bool showLayoutAllowanc { if (togetherWithNotches) { - bool seamAllowance = IsSeamAllowance() && IsSeamAllowanceBuiltIn(); - bool builtInSeamAllowance = IsSeamAllowance() && IsSeamAllowanceBuiltIn(); + bool const seamAllowance = IsSeamAllowance() && IsSeamAllowanceBuiltIn(); + bool const builtInSeamAllowance = IsSeamAllowance() && IsSeamAllowanceBuiltIn(); VBoundary boundary(GetFullContourPoints(), seamAllowance, builtInSeamAllowance); boundary.SetPieceName(GetName()); @@ -1788,8 +1788,8 @@ auto VLayoutPiece::IsLayoutAllowanceValid(bool togetherWithNotches) const -> boo if (togetherWithNotches) { const QVector passmarks = GetMappedPassmarks(); - bool seamAllowance = IsSeamAllowance() && !IsSeamAllowanceBuiltIn(); - bool builtInSeamAllowance = IsSeamAllowance() && IsSeamAllowanceBuiltIn(); + bool const seamAllowance = IsSeamAllowance() && !IsSeamAllowanceBuiltIn(); + bool const builtInSeamAllowance = IsSeamAllowance() && IsSeamAllowanceBuiltIn(); VBoundary boundary(base, seamAllowance, builtInSeamAllowance); boundary.SetPieceName(GetName()); @@ -1894,10 +1894,10 @@ void VLayoutPiece::LabelStringsSVGFont(QGraphicsItem *parent, const QVectorFontEngine(tm.GetSVGFontFamily(), SVGFontStyle::Normal, SVGFontWeight::Normal, tm.GetSVGFontPointSize()); - VSvgFont svgFont = engine.Font(); + VSvgFont const svgFont = engine.Font(); if (!svgFont.IsValid()) { - QString errorMsg = tr("Invalid SVG font '%1'. Fallback to outline font.").arg(svgFont.Name()); + QString const errorMsg = tr("Invalid SVG font '%1'. Fallback to outline font.").arg(svgFont.Name()); VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) : qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; @@ -1905,7 +1905,7 @@ void VLayoutPiece::LabelStringsSVGFont(QGraphicsItem *parent, const QVectorSettings()->WidthHairLine(); + qreal const penWidth = VAbstractApplication::VApp()->Settings()->WidthHairLine(); const qreal dW = QLineF(labelShape.at(0), labelShape.at(1)).length(); const qreal dH = QLineF(labelShape.at(1), labelShape.at(2)).length(); @@ -1992,7 +1992,7 @@ void VLayoutPiece::LabelStringsOutlineFont(QGraphicsItem *parent, const QVector< const qreal dW = QLineF(labelShape.at(0), labelShape.at(1)).length(); const qreal dH = QLineF(labelShape.at(1), labelShape.at(2)).length(); const qreal angle = -QLineF(labelShape.at(0), labelShape.at(1)).angle(); - qreal penWidth = settings->WidthHairLine(); + qreal const penWidth = settings->WidthHairLine(); qreal dY = 0; const QVector labelLines = tm.GetLabelSourceLines(qFloor(dW), tm.GetFont()); @@ -2011,13 +2011,13 @@ void VLayoutPiece::LabelStringsOutlineFont(QGraphicsItem *parent, const QVector< fnt.setBold(tl.m_bold); fnt.setItalic(tl.m_italic); - VSingleLineOutlineChar corrector(fnt); + VSingleLineOutlineChar const corrector(fnt); if (settings->GetSingleStrokeOutlineFont() && !corrector.IsPopulated()) { corrector.LoadCorrections(settings->GetPathFontCorrections()); } - QFontMetrics fm(fnt); + QFontMetrics const fm(fnt); if (dY + fm.height() > dH) { @@ -2338,7 +2338,7 @@ auto VLayoutPiece::Edge(const QVector &path, int i) const -> QLineF if (d->m_verticallyFlipped || d->m_horizontallyFlipped) { - QVector newPath = Map(path); + QVector const newPath = Map(path); return {newPath.at(i1), newPath.at(i2)}; } return {d->m_matrix.map(path.at(i1)), d->m_matrix.map(path.at(i2))}; @@ -2385,7 +2385,7 @@ auto VLayoutPiece::ConvertPassmarks(const VPiece &piece, const VContainer *patte auto AddPassmark = [passmark, piece, pattern, &layoutPassmarks](PassmarkSide side) { bool ok = false; - VLayoutPassmark layoutPassmark = PrepareSAPassmark(piece, pattern, passmark, side, ok); + VLayoutPassmark const layoutPassmark = PrepareSAPassmark(piece, pattern, passmark, side, ok); if (ok) { layoutPassmarks.append(layoutPassmark); @@ -2395,7 +2395,7 @@ auto VLayoutPiece::ConvertPassmarks(const VPiece &piece, const VContainer *patte auto AddBuiltInPassmark = [passmark, piece, pattern, &layoutPassmarks]() { bool ok = false; - VLayoutPassmark layoutPassmark = PreapreBuiltInSAPassmark(piece, pattern, passmark, ok); + VLayoutPassmark const layoutPassmark = PreapreBuiltInSAPassmark(piece, pattern, passmark, ok); if (ok) { layoutPassmarks.append(layoutPassmark); @@ -2408,7 +2408,7 @@ auto VLayoutPiece::ConvertPassmarks(const VPiece &piece, const VContainer *patte continue; } - VPiecePassmarkData pData = passmark.Data(); + VPiecePassmarkData const pData = passmark.Data(); switch (pData.passmarkAngleType) { diff --git a/src/libs/vlayout/vlayoutpiece_p.h b/src/libs/vlayout/vlayoutpiece_p.h index a35f71c17..94e1c5f91 100644 --- a/src/libs/vlayout/vlayoutpiece_p.h +++ b/src/libs/vlayout/vlayoutpiece_p.h @@ -175,7 +175,7 @@ inline auto operator>>(QDataStream &dataStream, VLayoutPieceData &piece) -> QDat if (actualStreamHeader != VLayoutPieceData::streamHeader) { - QString message = QCoreApplication::tr("VLayoutPieceData prefix mismatch error: actualStreamHeader = 0x%1 and " + QString const message = QCoreApplication::tr("VLayoutPieceData prefix mismatch error: actualStreamHeader = 0x%1 and " "streamHeader = 0x%2") .arg(actualStreamHeader, 8, 0x10, QLatin1Char('0')) .arg(VLayoutPieceData::streamHeader, 8, 0x10, QLatin1Char('0')); @@ -187,7 +187,7 @@ inline auto operator>>(QDataStream &dataStream, VLayoutPieceData &piece) -> QDat if (actualClassVersion > VLayoutPieceData::classVersion) { - QString message = QCoreApplication::tr("VLayoutPieceData compatibility error: actualClassVersion = %1 and " + QString const message = QCoreApplication::tr("VLayoutPieceData compatibility error: actualClassVersion = %1 and " "classVersion = %2") .arg(actualClassVersion) .arg(VLayoutPieceData::classVersion); diff --git a/src/libs/vlayout/vlayoutpiecepath_p.h b/src/libs/vlayout/vlayoutpiecepath_p.h index 457bc2407..7c30adcdd 100644 --- a/src/libs/vlayout/vlayoutpiecepath_p.h +++ b/src/libs/vlayout/vlayoutpiecepath_p.h @@ -101,10 +101,11 @@ inline auto operator>>(QDataStream &dataStream, VLayoutPiecePathData &path) -> Q if (actualStreamHeader != VLayoutPiecePathData::streamHeader) { - QString message = QCoreApplication::tr("VLayoutPiecePathData prefix mismatch error: actualStreamHeader = 0x%1 " - "and streamHeader = 0x%2") - .arg(actualStreamHeader, 8, 0x10, QLatin1Char('0')) - .arg(VLayoutPiecePathData::streamHeader, 8, 0x10, QLatin1Char('0')); + QString const message = + QCoreApplication::tr("VLayoutPiecePathData prefix mismatch error: actualStreamHeader = 0x%1 " + "and streamHeader = 0x%2") + .arg(actualStreamHeader, 8, 0x10, QLatin1Char('0')) + .arg(VLayoutPiecePathData::streamHeader, 8, 0x10, QLatin1Char('0')); throw VException(message); } @@ -113,10 +114,11 @@ inline auto operator>>(QDataStream &dataStream, VLayoutPiecePathData &path) -> Q if (actualClassVersion > VLayoutPiecePathData::classVersion) { - QString message = QCoreApplication::tr("VLayoutPiecePathData compatibility error: actualClassVersion = %1 and " - "classVersion = %2") - .arg(actualClassVersion) - .arg(VLayoutPiecePathData::classVersion); + QString const message = + QCoreApplication::tr("VLayoutPiecePathData compatibility error: actualClassVersion = %1 and " + "classVersion = %2") + .arg(actualClassVersion) + .arg(VLayoutPiecePathData::classVersion); throw VException(message); } diff --git a/src/libs/vlayout/vposition.cpp b/src/libs/vlayout/vposition.cpp index 8e357465e..3ef9f0a8c 100644 --- a/src/libs/vlayout/vposition.cpp +++ b/src/libs/vlayout/vposition.cpp @@ -229,7 +229,7 @@ auto VPosition::ArrangeDetail(const VPositionData &data, std::atomic_bool *stop, Q_ASSERT(not jobs.isEmpty()); - std::function Nest = [](VPosition position) + std::function const Nest = [](VPosition position) { position.run(); return position.getBestResult(); @@ -246,7 +246,7 @@ auto VPosition::ArrangeDetail(const VPositionData &data, std::atomic_bool *stop, return bestResult; } - QList results = watcher.future().results(); + QList const results = watcher.future().results(); for (auto &result : results) { bestResult.NewResult(result); @@ -502,7 +502,7 @@ void VPosition::CombineEdges(VLayoutPiece &detail, const QLineF &globalEdge, int //--------------------------------------------------------------------------------------------------------------------- void VPosition::RotateEdges(VLayoutPiece &detail, const QLineF &globalEdge, int dEdge, qreal angle) { - QLineF detailEdge = detail.LayoutEdge(dEdge); + QLineF const detailEdge = detail.LayoutEdge(dEdge); // Now we move detail to position near to global contour edge. detail.Translate(globalEdge.x2() - detailEdge.x2(), globalEdge.y2() - detailEdge.y2()); detail.Rotate(globalEdge.p2(), angle); @@ -540,7 +540,7 @@ void VPosition::FollowGrainline() return; } - VPieceGrainline pieceGrainline = m_data.detail.GetGrainline(); + VPieceGrainline const pieceGrainline = m_data.detail.GetGrainline(); QLineF detailGrainline(10, 10, 100, 10); detailGrainline.setAngle(pieceGrainline.GetMainLine().angle()); diff --git a/src/libs/vlayout/vposter.cpp b/src/libs/vlayout/vposter.cpp index b8a6324a8..fd8a7664b 100644 --- a/src/libs/vlayout/vposter.cpp +++ b/src/libs/vlayout/vposter.cpp @@ -66,11 +66,11 @@ auto Grayscale(QImage image) -> QImage for (int ii = 0; ii < image.height(); ii++) { uchar *scan = image.scanLine(ii); - int depth = 4; + int const depth = 4; for (int jj = 0; jj < image.width(); jj++) { QRgb *rgbpixel = reinterpret_cast(scan + jj * depth); - int gray = qGray(*rgbpixel); + int const gray = qGray(*rgbpixel); *rgbpixel = QColor(gray, gray, gray, qAlpha(*rgbpixel)).rgba(); } } @@ -83,7 +83,7 @@ auto WatermarkImageFromCache(const VWatermarkData &watermarkData, const QString -> QPixmap { QPixmap pixmap; - QString imagePath = AbsoluteMPath(watermarkPath, watermarkData.path); + QString const imagePath = AbsoluteMPath(watermarkPath, watermarkData.path); if (not QPixmapCache::find(imagePath, &pixmap)) { @@ -287,8 +287,8 @@ auto VPoster::TextWatermark(QGraphicsItem *parent, const PosterData &img, const text->setRotation(-watermarkData.textRotation); const QRect boundingRect = text->boundingRect().toRect(); - int x = img.rect.x() + (img.rect.width() - boundingRect.width()) / 2; - int y = img.rect.y() + (img.rect.height() - boundingRect.height()) / 2; + int const x = img.rect.x() + (img.rect.width() - boundingRect.width()) / 2; + int const y = img.rect.y() + (img.rect.height() - boundingRect.height()) / 2; text->setX(x); text->setY(y); @@ -309,11 +309,11 @@ auto VPoster::ImageWatermark(QGraphicsItem *parent, const PosterData &img, const QGraphicsItem *image = nullptr; - QFileInfo f(watermarkData.path); + QFileInfo const f(watermarkData.path); if (f.suffix() == "png" || f.suffix() == "jpg" || f.suffix() == "jpeg" || f.suffix() == "bmp") { QString error; - QPixmap watermark = WatermarkImageFromCache(watermarkData, watermarkPath, error); + QPixmap const watermark = WatermarkImageFromCache(watermarkData, watermarkPath, error); if (watermark.isNull()) { @@ -342,8 +342,8 @@ auto VPoster::ImageWatermark(QGraphicsItem *parent, const PosterData &img, const image->setRotation(-watermarkData.imageRotation); const QRect boundingRect = image->boundingRect().toRect(); - int x = img.rect.x() + (img.rect.width() - boundingRect.width()) / 2; - int y = img.rect.y() + (img.rect.height() - boundingRect.height()) / 2; + int const x = img.rect.x() + (img.rect.width() - boundingRect.width()) / 2; + int const y = img.rect.y() + (img.rect.height() - boundingRect.height()) / 2; image->setX(x); image->setY(y); @@ -443,8 +443,8 @@ auto VPoster::PageRect() const -> QRect { QPageLayout layout = printer->pageLayout(); layout.setUnits(QPageLayout::Millimeter); - QMarginsF pMargins = layout.margins(); - QRectF newRect = rect.marginsRemoved(pMargins); + QMarginsF const pMargins = layout.margins(); + QRectF const newRect = rect.marginsRemoved(pMargins); const QRect pageRectFP(0, 0, qFloor(ToPixel(newRect.width())), qFloor(ToPixel(newRect.height()))); return pageRectFP; } @@ -465,9 +465,9 @@ void VPoster::Ruler(QVector &data, QGraphicsItem *parent, QRect const qreal notchHeight = ToPixel(3); // mm const qreal shortNotchHeight = ToPixel(1.1); // mm - Unit patternUnits = VAbstractValApplication::VApp()->patternUnits(); + Unit const patternUnits = VAbstractValApplication::VApp()->patternUnits(); const qreal step = UnitConvertor(1, patternUnits, Unit::Px); - double marksCount = rec.width() / step; + double const marksCount = rec.width() / step; int i = 0; while (i < marksCount) { @@ -496,7 +496,7 @@ void VPoster::Ruler(QVector &data, QGraphicsItem *parent, QRect fnt.setPointSize(10); qreal unitsWidth = 0; - QFontMetrics fm(fnt); + QFontMetrics const fm(fnt); unitsWidth = fm.horizontalAdvance(units->toPlainText()); units->setPos(rec.x() + step * 0.5 - unitsWidth * 0.7, rec.y() + rec.height() - static_cast(allowance) - shortNotchHeight); diff --git a/src/libs/vlayout/vprintlayout.cpp b/src/libs/vlayout/vprintlayout.cpp index 93f1d8bb3..ca1c4d099 100644 --- a/src/libs/vlayout/vprintlayout.cpp +++ b/src/libs/vlayout/vprintlayout.cpp @@ -237,7 +237,7 @@ void VPrintLayout::PrintLayout() { info = QPrinterInfo::defaultPrinter(); } - QSharedPointer printer = PreparePrinter(info, QPrinter::HighResolution); + QSharedPointer const printer = PreparePrinter(info, QPrinter::HighResolution); if (printer.isNull()) { qCritical("%s\n\n%s", qUtf8Printable(tr("Print error")), @@ -282,7 +282,7 @@ void VPrintLayout::PrintPreview() { info = QPrinterInfo::defaultPrinter(); } - QSharedPointer printer = PreparePrinter(info); + QSharedPointer const printer = PreparePrinter(info); if (printer.isNull()) { qCritical("%s\n\n%s", qUtf8Printable(tr("Print error")), @@ -347,8 +347,8 @@ void VPrintLayout::PrintPages(QPrinter *printer) auto *paper = qgraphicsitem_cast(m_layoutPapers.at(i)); if (paper != nullptr) { - QRectF paperRect = paper->rect(); - QSizeF image(paperRect.width() * m_xscale, paperRect.height() * m_yscale); + QRectF const paperRect = paper->rect(); + QSizeF const image(paperRect.width() * m_xscale, paperRect.height() * m_yscale); *poster += posterazor->Calc(image.toSize(), i, m_tiledPDFOrientation); } } @@ -384,7 +384,7 @@ void VPrintLayout::PrintPages(QPrinter *printer) copyCount = printer->copyCount(); } - VWatermarkData data = WatermarkData(); + VWatermarkData const data = WatermarkData(); for (int i = 0; i < copyCount; ++i) { @@ -613,7 +613,7 @@ void VPrintLayout::PreparePaper(vsizetype index) const auto *paper = qgraphicsitem_cast(m_layoutPapers.at(index)); if (paper != nullptr) { - QBrush brush(Qt::white); + QBrush const brush(Qt::white); m_layoutScenes.at(index)->setBackgroundBrush(brush); m_layoutShadows.at(index)->setVisible(false); const float thinPen = 0.1F; @@ -623,7 +623,7 @@ void VPrintLayout::PreparePaper(vsizetype index) const QTransform matrix; matrix.scale(m_xscale, m_yscale); - QList paperDetails = m_layoutDetails.at(index); + QList const paperDetails = m_layoutDetails.at(index); for (auto *detail : paperDetails) { QTransform m = detail->transform(); @@ -640,7 +640,7 @@ void VPrintLayout::RestorePaper(vsizetype index) const { // Restore paper->setPen(QPen(Qt::black, 1)); - QBrush brush(Qt::gray); + QBrush const brush(Qt::gray); m_layoutScenes.at(index)->setBackgroundBrush(brush); m_layoutShadows.at(index)->setVisible(true); } @@ -648,7 +648,7 @@ void VPrintLayout::RestorePaper(vsizetype index) const QTransform matrix; matrix.scale(1. / m_xscale, 1. / m_yscale); - QList paperDetails = m_layoutDetails.at(index); + QList const paperDetails = m_layoutDetails.at(index); for (auto *detail : paperDetails) { QTransform m = detail->transform(); @@ -736,7 +736,7 @@ auto VPrintLayout::ContinueIfLayoutStale(QWidget *parent) -> int msgBox.setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No); msgBox.setDefaultButton(QDialogButtonBox::No); - int dialogResult = msgBox.exec(); + int const dialogResult = msgBox.exec(); if (msgBox.isChecked()) { @@ -760,7 +760,7 @@ auto VPrintLayout::SceneTargetRect(QPrinter *printer, const QRectF &source) -> Q { QPageLayout layout = printer->pageLayout(); layout.setUnits(QPageLayout::Millimeter); - QMarginsF printerMargins = layout.margins(); + QMarginsF const printerMargins = layout.margins(); x = qFloor(ToPixel(printerMargins.left(), Unit::Mm)); y = qFloor(ToPixel(printerMargins.top(), Unit::Mm)); } @@ -770,7 +770,7 @@ auto VPrintLayout::SceneTargetRect(QPrinter *printer, const QRectF &source) -> Q y = 0; } - QPair scaleDiff = PrinterScaleDiff(printer); + QPair const scaleDiff = PrinterScaleDiff(printer); const double xscale = scaleDiff.first; const double yscale = scaleDiff.second; diff --git a/src/libs/vlayout/vrawlayout.cpp b/src/libs/vlayout/vrawlayout.cpp index 61febeebc..69be4ade5 100644 --- a/src/libs/vlayout/vrawlayout.cpp +++ b/src/libs/vlayout/vrawlayout.cpp @@ -69,10 +69,11 @@ auto operator>>(QDataStream &dataStream, VRawLayoutData &data) -> QDataStream & if (actualStreamHeader != VRawLayoutData::streamHeader) { - QString message = QCoreApplication::tr("VRawLayoutData prefix mismatch error: actualStreamHeader = 0x%1 and " - "streamHeader = 0x%2") - .arg(actualStreamHeader, 8, 0x10, '0'_L1) - .arg(VRawLayoutData::streamHeader, 8, 0x10, '0'_L1); + QString const message = + QCoreApplication::tr("VRawLayoutData prefix mismatch error: actualStreamHeader = 0x%1 and " + "streamHeader = 0x%2") + .arg(actualStreamHeader, 8, 0x10, '0'_L1) + .arg(VRawLayoutData::streamHeader, 8, 0x10, '0'_L1); throw VException(message); } @@ -81,10 +82,10 @@ auto operator>>(QDataStream &dataStream, VRawLayoutData &data) -> QDataStream & if (actualClassVersion > VRawLayoutData::classVersion) { - QString message = QCoreApplication::tr("VRawLayoutData compatibility error: actualClassVersion = %1 and " - "classVersion = %2") - .arg(actualClassVersion) - .arg(VRawLayoutData::classVersion); + QString const message = QCoreApplication::tr("VRawLayoutData compatibility error: actualClassVersion = %1 and " + "classVersion = %2") + .arg(actualClassVersion) + .arg(VRawLayoutData::classVersion); throw VException(message); } diff --git a/src/libs/vlayout/vtextmanager.cpp b/src/libs/vlayout/vtextmanager.cpp index a0f3fd98b..2d37eac08 100644 --- a/src/libs/vlayout/vtextmanager.cpp +++ b/src/libs/vlayout/vtextmanager.cpp @@ -66,9 +66,9 @@ QT_WARNING_POP auto FileBaseName(const QString &filePath) -> QString { // Known suffixes to check for - QStringList knownSuffixes = {".val", ".vst", ".vit"}; + QStringList const knownSuffixes = {".val", ".vst", ".vit"}; - QFileInfo fileInfo(filePath); + QFileInfo const fileInfo(filePath); // Check if the file has one of the known suffixes for (const QString &suffix : knownSuffixes) @@ -89,7 +89,7 @@ auto FileBaseName(const QString &filePath) -> QString //--------------------------------------------------------------------------------------------------------------------- auto SplitTextByWidth(const QString &text, const QFont &font, int maxWidth) -> QStringList { - QFontMetrics fontMetrics(font); + QFontMetrics const fontMetrics(font); if (fontMetrics.horizontalAdvance(text) <= maxWidth) { return {text}; @@ -103,7 +103,7 @@ auto SplitTextByWidth(const QString &text, const QFont &font, int maxWidth) -> Q for (int endIndex = 0; endIndex < textLength; ++endIndex) { - QChar currentChar = text.at(endIndex); + QChar const currentChar = text.at(endIndex); const int charWidth = fontMetrics.horizontalAdvance(currentChar); if (lineWidth + charWidth > maxWidth) @@ -131,7 +131,7 @@ auto SplitTextByWidth(const QString &text, const QFont &font, int maxWidth) -> Q auto SplitTextByWidth(const QString &text, const VSvgFont &font, int maxWidth, qreal penWidth) -> QStringList { VSvgFontDatabase *db = VAbstractApplication::VApp()->SVGFontDatabase(); - VSvgFontEngine engine = db->FontEngine(font); + VSvgFontEngine const engine = db->FontEngine(font); if (engine.TextWidth(text, penWidth) <= maxWidth) { @@ -146,7 +146,7 @@ auto SplitTextByWidth(const QString &text, const VSvgFont &font, int maxWidth, q for (int endIndex = 0; endIndex < textLength; ++endIndex) { - QChar currentChar = text.at(endIndex); + QChar const currentChar = text.at(endIndex); const qreal charWidth = engine.TextWidth(currentChar, penWidth); if (lineWidth + charWidth > maxWidth) @@ -200,10 +200,10 @@ auto operator>>(QDataStream &dataStream, TextLine &data) -> QDataStream & if (actualStreamHeader != TextLine::streamHeader) { - QString message = QCoreApplication::tr("TextLine prefix mismatch error: actualStreamHeader = 0x%1 and " - "streamHeader = 0x%2") - .arg(actualStreamHeader, 8, 0x10, '0'_L1) - .arg(TextLine::streamHeader, 8, 0x10, '0'_L1); + QString const message = QCoreApplication::tr("TextLine prefix mismatch error: actualStreamHeader = 0x%1 and " + "streamHeader = 0x%2") + .arg(actualStreamHeader, 8, 0x10, '0'_L1) + .arg(TextLine::streamHeader, 8, 0x10, '0'_L1); throw VException(message); } @@ -212,10 +212,10 @@ auto operator>>(QDataStream &dataStream, TextLine &data) -> QDataStream & if (actualClassVersion > TextLine::classVersion) { - QString message = QCoreApplication::tr("TextLine compatibility error: actualClassVersion = %1 and " - "classVersion = %2") - .arg(actualClassVersion) - .arg(TextLine::classVersion); + QString const message = QCoreApplication::tr("TextLine compatibility error: actualClassVersion = %1 and " + "classVersion = %2") + .arg(actualClassVersion) + .arg(TextLine::classVersion); throw VException(message); } @@ -261,10 +261,11 @@ auto operator>>(QDataStream &dataStream, VTextManager &data) -> QDataStream & if (actualStreamHeader != VTextManager::streamHeader) { - QString message = QCoreApplication::tr("VTextManager prefix mismatch error: actualStreamHeader = 0x%1 and " - "streamHeader = 0x%2") - .arg(actualStreamHeader, 8, 0x10, '0'_L1) - .arg(VTextManager::streamHeader, 8, 0x10, '0'_L1); + QString const message = + QCoreApplication::tr("VTextManager prefix mismatch error: actualStreamHeader = 0x%1 and " + "streamHeader = 0x%2") + .arg(actualStreamHeader, 8, 0x10, '0'_L1) + .arg(VTextManager::streamHeader, 8, 0x10, '0'_L1); throw VException(message); } @@ -273,10 +274,10 @@ auto operator>>(QDataStream &dataStream, VTextManager &data) -> QDataStream & if (actualClassVersion > VTextManager::classVersion) { - QString message = QCoreApplication::tr("VTextManager compatibility error: actualClassVersion = %1 and " - "classVersion = %2") - .arg(actualClassVersion) - .arg(VTextManager::classVersion); + QString const message = QCoreApplication::tr("VTextManager compatibility error: actualClassVersion = %1 and " + "classVersion = %2") + .arg(actualClassVersion) + .arg(VTextManager::classVersion); throw VException(message); } @@ -311,7 +312,7 @@ void PrepareMeasurementsPlaceholders(const VContainer *data, QMap &placeholders) { - QLocale locale(VAbstractApplication::VApp()->Settings()->GetLocale()); + QLocale const locale(VAbstractApplication::VApp()->Settings()->GetLocale()); if (VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Individual) { @@ -337,19 +338,19 @@ void PrepareCustomerPlaceholders(const VAbstractPattern *doc, QMap &placeholders) { - QString heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight()); + QString const heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight()); placeholders.insert(pl_height, heightValue); placeholders.insert(pl_dimensionX, heightValue); - QString sizeValue = QString::number(VAbstractValApplication::VApp()->GetDimensionSize()); + QString const sizeValue = QString::number(VAbstractValApplication::VApp()->GetDimensionSize()); placeholders.insert(pl_size, sizeValue); placeholders.insert(pl_dimensionY, sizeValue); - QString hipValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHip()); + QString const hipValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHip()); placeholders.insert(pl_hip, hipValue); placeholders.insert(pl_dimensionZ, hipValue); - QString waistValue = QString::number(VAbstractValApplication::VApp()->GetDimensionWaist()); + QString const waistValue = QString::number(VAbstractValApplication::VApp()->GetDimensionWaist()); placeholders.insert(pl_waist, waistValue); placeholders.insert(pl_dimensionW, waistValue); @@ -395,7 +396,7 @@ void PrepareFinalMeasurementsPlaceholders(const VAbstractPattern *doc, bool piec if (pieceLabel) { - QScopedPointer cal(new Calculator()); + QScopedPointer const cal(new Calculator()); try { @@ -439,7 +440,7 @@ void PrepareFinalMeasurementsPlaceholders(const VAbstractPattern *doc, bool piec try { - QScopedPointer cal(new Calculator()); + QScopedPointer const cal(new Calculator()); const qreal result = cal->EvalFormula(completeData.DataVariables(), m.formula); placeholders.insert(pl_finalMeasurement + m.name, QString::number(result)); @@ -537,7 +538,7 @@ void InitPiecePlaceholders(QMap &placeholders, const QString & if (data.IsOnFold()) { - QSharedPointer phTr = VAbstractApplication::VApp()->GetPlaceholderTranslator(); + QSharedPointer const phTr = VAbstractApplication::VApp()->GetPlaceholderTranslator(); placeholders[pl_wOnFold] = phTr->translate("Placeholder", "on fold"); } } @@ -545,7 +546,7 @@ void InitPiecePlaceholders(QMap &placeholders, const QString & //--------------------------------------------------------------------------------------------------------------------- auto ReplacePlaceholders(const QMap &placeholders, QString line) -> QString { - QChar per('%'); + QChar const per('%'); auto TestDimension = [per, placeholders, line](const QString &placeholder, const QString &errorMsg) { @@ -709,7 +710,7 @@ auto VTextManager::GetLabelSourceLines(int width, const QFont &font) const -> QV QVector lines; lines.reserve(m_liLines.size()); QFont fnt = font; - int fSize = m_font.pointSize(); + int const fSize = m_font.pointSize(); for (const auto &tl : m_liLines) { @@ -717,8 +718,8 @@ auto VTextManager::GetLabelSourceLines(int width, const QFont &font) const -> QV fnt.setBold(tl.m_bold); fnt.setItalic(tl.m_italic); - QString qsText = tl.m_qsText; - QFontMetrics fm(fnt); + QString const qsText = tl.m_qsText; + QFontMetrics const fm(fnt); if (fm.horizontalAdvance(qsText) > width) { const QStringList brokeLines = BreakTextIntoLines(qsText, fnt, width); @@ -748,7 +749,7 @@ auto VTextManager::GetLabelSourceLines(int width, const VSvgFont &font, qreal pe VSvgFontDatabase *db = VAbstractApplication::VApp()->SVGFontDatabase(); QVector lines; lines.reserve(m_liLines.size()); - int fSize = m_font.pointSize(); + int const fSize = m_font.pointSize(); for (const auto &tl : m_liLines) { @@ -757,16 +758,16 @@ auto VTextManager::GetLabelSourceLines(int width, const VSvgFont &font, qreal pe lineFont.SetBold(tl.m_bold); lineFont.SetItalic(tl.m_italic); - VSvgFontEngine engine = db->FontEngine(lineFont); + VSvgFontEngine const engine = db->FontEngine(lineFont); - VSvgFont svgFont = engine.Font(); + VSvgFont const svgFont = engine.Font(); if (!svgFont.IsValid()) { lines.append(tl); continue; } - QString qsText = tl.m_qsText; + QString const qsText = tl.m_qsText; if (engine.TextWidth(qsText, penWidth) > width) { const QStringList brokeLines = BreakTextIntoLines(qsText, svgFont, width, penWidth); @@ -798,7 +799,7 @@ auto VTextManager::MaxLineWidthOutlineFont(int width) const -> int fnt.setBold(tl.m_bold); fnt.setItalic(tl.m_italic); - QFontMetrics fm(fnt); + QFontMetrics const fm(fnt); QString qsText = tl.m_qsText; @@ -819,7 +820,7 @@ auto VTextManager::MaxLineWidthSVGFont(int width, qreal penWidth) const -> int VSvgFontDatabase *db = VAbstractApplication::VApp()->SVGFontDatabase(); VSvgFontEngine engine = db->FontEngine(m_svgFontFamily, SVGFontStyle::Normal, SVGFontWeight::Normal, m_svgFontPointSize); - VSvgFont svgFont = engine.Font(); + VSvgFont const svgFont = engine.Font(); int maxWidth = 0; for (int i = 0; i < m_liLines.count(); ++i) @@ -904,7 +905,7 @@ void VTextManager::Update(VAbstractPattern *pDoc, const VContainer *pattern) //--------------------------------------------------------------------------------------------------------------------- auto VTextManager::BreakTextIntoLines(const QString &text, const QFont &font, int maxWidth) -> QStringList { - QFontMetrics fontMetrics(font); + QFontMetrics const fontMetrics(font); QStringList words = text.split(' '); QString currentLine; @@ -929,8 +930,8 @@ auto VTextManager::BreakTextIntoLines(const QString &text, const QFont &font, in while (iterator.hasNext()) { const QString &word = iterator.next(); - int wordWidth = fontMetrics.horizontalAdvance(word); - int totalWidth = !currentLine.isEmpty() ? currentLineWidth + spaceWidth + wordWidth : wordWidth; + int const wordWidth = fontMetrics.horizontalAdvance(word); + int const totalWidth = !currentLine.isEmpty() ? currentLineWidth + spaceWidth + wordWidth : wordWidth; if (totalWidth <= maxWidth) { @@ -997,9 +998,9 @@ auto VTextManager::BreakTextIntoLines(const QString &text, const VSvgFont &font, { VSvgFontDatabase *db = VAbstractApplication::VApp()->SVGFontDatabase(); - VSvgFontEngine engine = db->FontEngine(font); + VSvgFontEngine const engine = db->FontEngine(font); - VSvgFont svgFont = engine.Font(); + VSvgFont const svgFont = engine.Font(); if (!svgFont.IsValid()) { return {text}; @@ -1029,8 +1030,8 @@ auto VTextManager::BreakTextIntoLines(const QString &text, const VSvgFont &font, while (iterator.hasNext()) { const QString &word = iterator.next(); - int wordWidth = qRound(engine.TextWidth(word, penWidth)); - int totalWidth = !currentLine.isEmpty() ? currentLineWidth + spaceWidth + wordWidth : wordWidth; + int const wordWidth = qRound(engine.TextWidth(word, penWidth)); + int const totalWidth = !currentLine.isEmpty() ? currentLineWidth + spaceWidth + wordWidth : wordWidth; if (totalWidth <= maxWidth) { diff --git a/src/libs/vmisc/def.cpp b/src/libs/vmisc/def.cpp index b3dbeec64..8e80aedfb 100644 --- a/src/libs/vmisc/def.cpp +++ b/src/libs/vmisc/def.cpp @@ -110,14 +110,14 @@ void InitLanguageList(QComboBox *combobox) englishUS = (en_US == locale); } - QLocale loc = QLocale(locale); - QString lang = loc.nativeLanguageName(); + QLocale const loc = QLocale(locale); + QString const lang = loc.nativeLanguageName(); QString country = TerritoryToString(loc); if (country == "Czechia"_L1) { country = "CzechRepublic"_L1; } - QIcon ico(u"://flags/%1.png"_s.arg(country)); + QIcon const ico(u"://flags/%1.png"_s.arg(country)); combobox->addItem(ico, lang, locale); } @@ -126,10 +126,10 @@ void InitLanguageList(QComboBox *combobox) { // English language is internal and doens't have own *.qm file. // Since Qt 5.12 country names have spaces - QIcon ico(u"://flags/%1.png"_s.arg(TerritoryToString(QLocale::UnitedStates)) + QIcon const ico(u"://flags/%1.png"_s.arg(TerritoryToString(QLocale::UnitedStates)) ); - QString lang = QLocale(en_US).nativeLanguageName(); + QString const lang = QLocale(en_US).nativeLanguageName(); combobox->addItem(ico, lang, en_US); } } @@ -245,7 +245,9 @@ auto darkenPixmap(const QPixmap &pixmap) -> QPixmap { for (int x = 0; x < imgw; ++x) { - int h, s, v; + int h; + int s; + int v; QRgb pixel = img.pixel(x, y); const int a = qAlpha(pixel); QColor hsvColor(pixel); @@ -273,11 +275,11 @@ void ShowInGraphicalShell(const QString &filePath) QProcess::startDetached(QStringLiteral("explorer"), QStringList{"/select", QDir::toNativeSeparators(filePath)}); #else const int timeout = 1000; // ms - QString command = QStringLiteral("dbus-send --reply-timeout=%1 --session --dest=org.freedesktop.FileManager1 " - "--type=method_call /org/freedesktop/FileManager1 " - "org.freedesktop.FileManager1.ShowItems array:string:\"%2\" string:\"\"") - .arg(timeout) - .arg(QUrl::fromLocalFile(filePath).toString()); + QString const command = QStringLiteral("dbus-send --reply-timeout=%1 --session --dest=org.freedesktop.FileManager1 " + "--type=method_call /org/freedesktop/FileManager1 " + "org.freedesktop.FileManager1.ShowItems array:string:\"%2\" string:\"\"") + .arg(timeout) + .arg(QUrl::fromLocalFile(filePath).toString()); // Sending message through dbus will highlighting file QProcess dbus; @@ -554,7 +556,7 @@ void InitLanguages(QComboBox *combobox) InitLanguageList(combobox); // set default translators and language checked - qint32 index = combobox->findData(VAbstractApplication::VApp()->Settings()->GetLocale()); + qint32 const index = combobox->findData(VAbstractApplication::VApp()->Settings()->GetLocale()); if (index != -1) { combobox->setCurrentIndex(index); @@ -569,7 +571,7 @@ void InitPieceLabelLanguages(QComboBox *combobox) combobox->addItem(QApplication::translate("InitPieceLabelLanguages", "Default"), VCommonSettings::defaultPieceLabelLocale); - qint32 index = combobox->findData(VAbstractApplication::VApp()->Settings()->GetPieceLabelLocale()); + qint32 const index = combobox->findData(VAbstractApplication::VApp()->Settings()->GetPieceLabelLocale()); if (index != -1) { combobox->setCurrentIndex(index); @@ -605,10 +607,10 @@ auto operator>>(QDataStream &in, CustomSARecord &record) -> QDataStream & if (actualStreamHeader != CustomSARecord::streamHeader) { - QString message = QCoreApplication::tr("CustomSARecord prefix mismatch error: actualStreamHeader = 0x%1 " - "and streamHeader = 0x%2") - .arg(actualStreamHeader, 8, 0x10, '0'_L1) - .arg(CustomSARecord::streamHeader, 8, 0x10, '0'_L1); + QString const message = QCoreApplication::tr("CustomSARecord prefix mismatch error: actualStreamHeader = 0x%1 " + "and streamHeader = 0x%2") + .arg(actualStreamHeader, 8, 0x10, '0'_L1) + .arg(CustomSARecord::streamHeader, 8, 0x10, '0'_L1); throw VException(message); } @@ -617,10 +619,10 @@ auto operator>>(QDataStream &in, CustomSARecord &record) -> QDataStream & if (actualClassVersion > CustomSARecord::classVersion) { - QString message = QCoreApplication::tr("CustomSARecord compatibility error: actualClassVersion = %1 and " - "classVersion = %2") - .arg(actualClassVersion) - .arg(CustomSARecord::classVersion); + QString const message = QCoreApplication::tr("CustomSARecord compatibility error: actualClassVersion = %1 and " + "classVersion = %2") + .arg(actualClassVersion) + .arg(CustomSARecord::classVersion); throw VException(message); } @@ -713,7 +715,7 @@ auto SplitFilePaths(const QString &path) -> QStringList do { - QFileInfo fileInfo(subPath); + QFileInfo const fileInfo(subPath); lastFileName = fileInfo.fileName(); if (not lastFileName.isEmpty()) { diff --git a/src/libs/vmisc/dialogs/dialogexporttocsv.cpp b/src/libs/vmisc/dialogs/dialogexporttocsv.cpp index 294f6613d..48684996c 100644 --- a/src/libs/vmisc/dialogs/dialogexporttocsv.cpp +++ b/src/libs/vmisc/dialogs/dialogexporttocsv.cpp @@ -216,7 +216,8 @@ void DialogExportToCSV::ShowPreview() ui->groupBoxPreview->setVisible(true); - QxtCsvModel csv(m_fileName, nullptr, IsWithHeader(), GetSeparator(), VTextCodec::codecForMib(GetSelectedMib())); + QxtCsvModel const csv(m_fileName, nullptr, IsWithHeader(), GetSeparator(), + VTextCodec::codecForMib(GetSelectedMib())); const int columns = csv.columnCount(); const int rows = csv.rowCount(); diff --git a/src/libs/vmisc/dialogs/vshortcutdialog.cpp b/src/libs/vmisc/dialogs/vshortcutdialog.cpp index d1cbf56f1..cb4b85bfb 100644 --- a/src/libs/vmisc/dialogs/vshortcutdialog.cpp +++ b/src/libs/vmisc/dialogs/vshortcutdialog.cpp @@ -106,7 +106,7 @@ void VShortcutDialog::ButtonBoxClicked(QAbstractButton *button) { if (ui->buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) { - QStringList shortcutsStringList = ui->keySequenceEdit->keySequence().toString().split(", "_L1); + QStringList const shortcutsStringList = ui->keySequenceEdit->keySequence().toString().split(", "_L1); const auto sequenceList = VAbstractShortcutManager::StringListToKeySequenceList(shortcutsStringList); for (const auto &sequence : sequenceList) @@ -114,7 +114,7 @@ void VShortcutDialog::ButtonBoxClicked(QAbstractButton *button) auto conflictingShortcut = ShortcutAlreadyBound(sequence, m_shortcutObject.type); if (!conflictingShortcut.isEmpty()) { - QString nativeShortcutString = sequence.toString(QKeySequence::NativeText); + QString const nativeShortcutString = sequence.toString(QKeySequence::NativeText); QMessageBox::warning( this, tr("Shortcut Already Used"), tr(R"("%1" is already bound to "%2")").arg(nativeShortcutString, conflictingShortcut)); diff --git a/src/libs/vmisc/projectversion.cpp b/src/libs/vmisc/projectversion.cpp index ae89de2d1..3fcb01d3d 100644 --- a/src/libs/vmisc/projectversion.cpp +++ b/src/libs/vmisc/projectversion.cpp @@ -87,7 +87,7 @@ auto compilerString() -> QString #endif #elif defined(Q_CC_CLANG) // must be before GNU, because clang claims to be GNU too // cppcheck-suppress unassignedVariable - QString isAppleString; + QString const isAppleString; #if defined(__apple_build_version__) // Apple clang has other version numbers isAppleString = " (Apple)"_L1; #endif diff --git a/src/libs/vmisc/qxtcsvmodel.cpp b/src/libs/vmisc/qxtcsvmodel.cpp index f4fac9326..f91ddc2d6 100644 --- a/src/libs/vmisc/qxtcsvmodel.cpp +++ b/src/libs/vmisc/qxtcsvmodel.cpp @@ -554,7 +554,7 @@ static auto qxt_addCsvQuotes(QxtCsvModel::QuoteMode mode, QString field) -> QStr { bool addDoubleQuotes = ((mode & QxtCsvModel::DoubleQuote) && field.contains('"')); bool addSingleQuotes = ((mode & QxtCsvModel::SingleQuote) && field.contains('\'')); - bool quoteField = (mode & QxtCsvModel::AlwaysQuoteOutput) || addDoubleQuotes || addSingleQuotes; + bool const quoteField = (mode & QxtCsvModel::AlwaysQuoteOutput) || addDoubleQuotes || addSingleQuotes; if (quoteField && !addDoubleQuotes && !addSingleQuotes) { if (mode & QxtCsvModel::DoubleQuote) diff --git a/src/libs/vmisc/svgfont/svgdef.cpp b/src/libs/vmisc/svgfont/svgdef.cpp index 1b7d7978f..0b1cd714f 100644 --- a/src/libs/vmisc/svgfont/svgdef.cpp +++ b/src/libs/vmisc/svgfont/svgdef.cpp @@ -40,7 +40,7 @@ using namespace Qt::Literals::StringLiterals; //--------------------------------------------------------------------------------------------------------------------- auto LatinWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return (codePoint > 0x0000 && codePoint <= 0x007F) // Basic Latin || (codePoint >= 0x0080 && codePoint <= 0x00FF) // Latin-1 Supplement @@ -64,7 +64,7 @@ auto LatinWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto GreekWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return (codePoint >= 0x0370 && codePoint <= 0x03FF) // Greek and Coptic || (codePoint >= 0x1F00 && codePoint <= 0x1FFF); // Greek Extended @@ -73,7 +73,7 @@ auto GreekWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto CyrillicWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return (codePoint >= 0x0400 && codePoint <= 0x04FF) // Cyrillic || (codePoint >= 0x0500 && codePoint <= 0x052F) // Cyrillic Supplement @@ -85,7 +85,7 @@ auto CyrillicWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto ArmenianWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return (codePoint >= 0x0530 && codePoint <= 0x058F) // Armenian || (codePoint >= 0xFB00 && codePoint <= 0xFB17); // Alphabetic Pres. Forms @@ -94,7 +94,7 @@ auto ArmenianWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto HebrewWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return (codePoint >= 0x0590 && codePoint <= 0x05FF) // Hebrew, || (codePoint >= 0xFB1D && codePoint <= 0xFB4F); // Alphabetic Presentation Forms @@ -103,7 +103,7 @@ auto HebrewWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto ArabicWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return (codePoint >= 0x0600 && codePoint <= 0x06FF) // Arabic || (codePoint >= 0x0750 && codePoint <= 0x077F) // Arabic Supplement @@ -116,7 +116,7 @@ auto ArabicWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto SyriacWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return (codePoint >= 0x0700 && codePoint <= 0x074F) // Syriac || (codePoint >= 0x0860 && codePoint <= 0x086F); // Syriac Supplement @@ -125,7 +125,7 @@ auto SyriacWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto ThaanaWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return codePoint >= 0x0780 && codePoint <= 0x07BF; // Thaana } @@ -133,7 +133,7 @@ auto ThaanaWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto DevanagariWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return (codePoint >= 0x0900 && codePoint <= 0x097F) // Devanagari, || (codePoint >= 0xA8E0 && codePoint <= 0xA8FF) // Devanagari Extended, @@ -143,7 +143,7 @@ auto DevanagariWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto BengaliWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return codePoint >= 0x0980 && codePoint <= 0x09FF; // Bengali } @@ -151,7 +151,7 @@ auto BengaliWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto GurmukhiWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return codePoint >= 0x0A00 && codePoint <= 0x0A7F; // Gurmukhi } @@ -159,7 +159,7 @@ auto GurmukhiWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto GujaratiWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return codePoint >= 0x0A80 && codePoint <= 0x0AFF; // Gujarati } @@ -167,7 +167,7 @@ auto GujaratiWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto OriyaWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return codePoint >= 0x0B00 && codePoint <= 0x0B7F; // Oriya } @@ -175,7 +175,7 @@ auto OriyaWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto TamilWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return codePoint >= 0x0B80 && codePoint <= 0x0BFF; // Tamil } @@ -183,7 +183,7 @@ auto TamilWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto TeluguWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return codePoint >= 0x0C00 && codePoint <= 0x0C7F; // Telugu } @@ -191,7 +191,7 @@ auto TeluguWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto KannadaWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return codePoint >= 0x0C80 && codePoint <= 0x0CFF; // Kannada } @@ -199,7 +199,7 @@ auto KannadaWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto MalayalamWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return codePoint >= 0x0D00 && codePoint <= 0x0D7F; // Malayalam } @@ -207,7 +207,7 @@ auto MalayalamWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto SinhalaWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return codePoint >= 0x0D80 && codePoint <= 0x0DFF; // Sinhala } @@ -215,7 +215,7 @@ auto SinhalaWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto ThaiWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return codePoint >= 0x0E00 && codePoint <= 0x0E7F; // Thai } @@ -223,7 +223,7 @@ auto ThaiWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto LaoWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return codePoint >= 0x0E80 && codePoint <= 0x0EFF; // Lao } @@ -231,7 +231,7 @@ auto LaoWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto TibetanWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return codePoint >= 0x0F00 && codePoint <= 0x0FFF; // Final Accepted Script Proposal of the First Usable Edition } @@ -239,7 +239,7 @@ auto TibetanWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto MyanmarWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return (codePoint >= 0x1000 && codePoint <= 0x109F) // Myanmar || (codePoint >= 0xAA60 && codePoint <= 0xAA7F) // Myanmar Extended-A @@ -249,7 +249,7 @@ auto MyanmarWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto GeorgianWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return (codePoint >= 0x10A0 && codePoint <= 0x10FF) // Georgian || (codePoint >= 0x2D00 && codePoint <= 0x2D2F) // Supplement @@ -259,7 +259,7 @@ auto GeorgianWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto KhmerWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return (codePoint >= 0x1780 && codePoint <= 0x17FF) // Khmer || (codePoint >= 0x19E0 && codePoint <= 0x19FF); // Khmer Symbols @@ -268,7 +268,7 @@ auto KhmerWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto SimplifiedChineseWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return (codePoint >= 0x20 && codePoint <= 0x5F) || (codePoint >= 0x7B && codePoint <= 0x7D) || codePoint == 0xA0 || codePoint == 0xA7 || codePoint == 0xA9 || codePoint == 0xB7 || @@ -824,7 +824,7 @@ auto SimplifiedChineseWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto TraditionalChineseWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return (codePoint >= 0x20 && codePoint <= 0x40) || (codePoint >= 0x5B && codePoint <= 0x5F) || (codePoint >= 0x7B && codePoint <= 0x7D) || codePoint == 0xA0 || codePoint == 0xA7 || codePoint == 0xA9 || @@ -1410,7 +1410,7 @@ auto TraditionalChineseWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto JapaneseWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return (codePoint >= 0x3040 && codePoint <= 0x309F) // Hiragana || (codePoint >= 0x30A0 && codePoint <= 0x30FF) // Katakana @@ -1420,7 +1420,7 @@ auto JapaneseWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto KoreanWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return (codePoint >= 0x1100 && codePoint <= 0x11FF) || (codePoint >= 0x3130 && codePoint <= 0x318F) || (codePoint >= 0xA960 && codePoint <= 0xA97F) || (codePoint >= 0xD7B0 && codePoint <= 0xD7FF); @@ -1429,7 +1429,7 @@ auto KoreanWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto VietnameseWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return (codePoint >= 0x0020 && codePoint <= 0x002F) || (codePoint >= 0x0030 && codePoint <= 0x0039) || (codePoint >= 0x003A && codePoint <= 0x0040) || (codePoint >= 0x0041 && codePoint <= 0x005A) || @@ -1450,7 +1450,7 @@ auto VietnameseWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto SymbolWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return (codePoint >= 0x2600 && codePoint <= 0x26FF) // Miscellaneous Symbols || (codePoint >= 0x19E0 && codePoint <= 0x19FF) // Khmer Symbols @@ -1467,7 +1467,7 @@ auto SymbolWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto OghamWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return codePoint >= 0x1680 && codePoint <= 0x169F; // Ogham } @@ -1475,7 +1475,7 @@ auto OghamWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto RunicWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return codePoint >= 0x16A0 && codePoint <= 0x16FF; // Runic } @@ -1483,7 +1483,7 @@ auto RunicWritingSystem(QChar c) -> bool //--------------------------------------------------------------------------------------------------------------------- auto NkoWritingSystem(QChar c) -> bool { - char16_t codePoint = c.unicode(); + char16_t const codePoint = c.unicode(); return codePoint >= 0x07C0 && codePoint <= 0x07FF; // Nko } diff --git a/src/libs/vmisc/svgfont/vsvgfont.cpp b/src/libs/vmisc/svgfont/vsvgfont.cpp index 10c91a1f0..89120e786 100644 --- a/src/libs/vmisc/svgfont/vsvgfont.cpp +++ b/src/libs/vmisc/svgfont/vsvgfont.cpp @@ -265,7 +265,7 @@ auto VSvgFont::Hash() const -> QByteArray //--------------------------------------------------------------------------------------------------------------------- auto VSvgFont::Hash(const QString &family, SVGFontStyle style, SVGFontWeight weight) -> QByteArray { - QString combinedString = + QString const combinedString = family + QString::number(static_cast(style)) + QString::number(static_cast(weight)); QByteArray data; diff --git a/src/libs/vmisc/svgfont/vsvgfontdatabase.cpp b/src/libs/vmisc/svgfont/vsvgfontdatabase.cpp index a2a106954..bd04d0adf 100644 --- a/src/libs/vmisc/svgfont/vsvgfontdatabase.cpp +++ b/src/libs/vmisc/svgfont/vsvgfontdatabase.cpp @@ -83,17 +83,17 @@ auto GetStyleScore(SVGFontStyle desiredStyle, SVGFontStyle fontStyle) -> int auto GetWeightScore(SVGFontWeight desiredWeight, SVGFontWeight fontWeight) -> int { // Assign a score based on the proximity of the desired weight to the font weight - int weightDifference = qAbs(static_cast(desiredWeight) - static_cast(fontWeight)); + int const weightDifference = qAbs(static_cast(desiredWeight) - static_cast(fontWeight)); if (weightDifference == 0) { return 100; // Direct match } - int gradationThreshold = 200; + int const gradationThreshold = 200; if (weightDifference <= gradationThreshold) { // Calculate a score based on the proximity of the desired weight to the font weight - int score = 100 - (weightDifference * 100 / gradationThreshold); + int const score = 100 - (weightDifference * 100 / gradationThreshold); return score; } @@ -136,14 +136,14 @@ void VSvgFontDatabase::PopulateFontDatabase(const QString &path) //--------------------------------------------------------------------------------------------------------------------- auto VSvgFontDatabase::IsPopulated() const -> bool { - QMutexLocker locker(svgFontDatabaseMutex()); + QMutexLocker const locker(svgFontDatabaseMutex()); return m_populated; } //--------------------------------------------------------------------------------------------------------------------- void VSvgFontDatabase::InvalidatePath(const QString &path) { - QMutexLocker locker(svgFontDatabaseMutex()); + QMutexLocker const locker(svgFontDatabaseMutex()); Invalidate(path); } @@ -151,7 +151,7 @@ void VSvgFontDatabase::InvalidatePath(const QString &path) //--------------------------------------------------------------------------------------------------------------------- auto VSvgFontDatabase::Families() const -> QStringList { - QMutexLocker locker(svgFontDatabaseMutex()); + QMutexLocker const locker(svgFontDatabaseMutex()); return m_indexFontFamily.keys(); } @@ -159,7 +159,7 @@ auto VSvgFontDatabase::Families() const -> QStringList //--------------------------------------------------------------------------------------------------------------------- auto VSvgFontDatabase::Font(const QString &family, SVGFontStyle style, SVGFontWeight weight) const -> VSvgFont { - QMutexLocker locker(svgFontDatabaseMutex()); + QMutexLocker const locker(svgFontDatabaseMutex()); return QueryFont(family, style, weight); } @@ -167,7 +167,7 @@ auto VSvgFontDatabase::Font(const QString &family, SVGFontStyle style, SVGFontWe //--------------------------------------------------------------------------------------------------------------------- auto VSvgFontDatabase::FontEngine(const VSvgFont &font) const -> VSvgFontEngine { - QMutexLocker locker(svgFontDatabaseMutex()); + QMutexLocker const locker(svgFontDatabaseMutex()); return QueryFontEngine(font.FamilyName(), font.Style(), font.Weight(), font.PointSize()); } @@ -176,7 +176,7 @@ auto VSvgFontDatabase::FontEngine(const VSvgFont &font) const -> VSvgFontEngine auto VSvgFontDatabase::FontEngine(const QString &family, SVGFontStyle style, SVGFontWeight weight, int pointSize) const -> VSvgFontEngine { - QMutexLocker locker(svgFontDatabaseMutex()); + QMutexLocker const locker(svgFontDatabaseMutex()); return QueryFontEngine(family, style, weight, pointSize); } @@ -184,20 +184,20 @@ auto VSvgFontDatabase::FontEngine(const QString &family, SVGFontStyle style, SVG //--------------------------------------------------------------------------------------------------------------------- auto VSvgFontDatabase::Bold(const QString &family, SVGFontStyle style) const -> bool { - QMutexLocker locker(svgFontDatabaseMutex()); + QMutexLocker const locker(svgFontDatabaseMutex()); - VSvgFont font = QueryFont(family, style, SVGFontWeight::Bold); - int weightScore = GetWeightScore(SVGFontWeight::Bold, font.Weight()); + VSvgFont const font = QueryFont(family, style, SVGFontWeight::Bold); + int const weightScore = GetWeightScore(SVGFontWeight::Bold, font.Weight()); return weightScore > 0; } //--------------------------------------------------------------------------------------------------------------------- auto VSvgFontDatabase::Italic(const QString &family, SVGFontStyle style) const -> bool { - QMutexLocker locker(svgFontDatabaseMutex()); + QMutexLocker const locker(svgFontDatabaseMutex()); - VSvgFont font = QueryFont(family, style, SVGFontWeight::Normal); - int styleScore = GetStyleScore(style, font.Style()); + VSvgFont const font = QueryFont(family, style, SVGFontWeight::Normal); + int const styleScore = GetStyleScore(style, font.Style()); return styleScore > 0; } @@ -276,7 +276,7 @@ void VSvgFontDatabase::ParseDirectory(const QString &path, int priority) QDirIterator it(path, {"*.svg"}, QDir::Files, QDirIterator::Subdirectories); while (it.hasNext()) { - QString fontFilePath = it.next(); + QString const fontFilePath = it.next(); QFile fontFile(fontFilePath); if (fontFile.exists() && fontFile.open(QIODevice::ReadOnly)) @@ -291,7 +291,7 @@ void VSvgFontDatabase::ParseDirectory(const QString &path, int priority) font.SetPath(fontFilePath); if (m_fontDB.contains(font.Id())) { - VSvgFont duplicate = m_fontDB.value(font.Id()); + VSvgFont const duplicate = m_fontDB.value(font.Id()); if (font.Priority() >= duplicate.Priority()) { m_fontDB.insert(font.Id(), font); @@ -328,7 +328,7 @@ void VSvgFontDatabase::Invalidate(const QString &path) //--------------------------------------------------------------------------------------------------------------------- auto VSvgFontDatabase::QueryFont(const QString &family, SVGFontStyle style, SVGFontWeight weight) const -> VSvgFont { - QByteArray hash = VSvgFont::Hash(family, style, weight); + QByteArray const hash = VSvgFont::Hash(family, style, weight); if (m_fontCache.contains(hash)) { return {*m_fontCache.object(hash)}; @@ -343,14 +343,14 @@ auto VSvgFontDatabase::QueryFont(const QString &family, SVGFontStyle style, SVGF { if (m_fontDB.contains(fontId)) { - VSvgFont f = m_fontDB.value(fontId); + VSvgFont const f = m_fontDB.value(fontId); - int styleScore = GetStyleScore(style, f.Style()); - int weightScore = GetWeightScore(weight, f.Weight()); + int const styleScore = GetStyleScore(style, f.Style()); + int const weightScore = GetWeightScore(weight, f.Weight()); // Calculate the total match score - int familyScore = 100; - int totalScore = familyScore + styleScore + weightScore; + int const familyScore = 100; + int const totalScore = familyScore + styleScore + weightScore; // Update the best match if the current font has a higher score if (totalScore > bestMatchScore) @@ -372,8 +372,8 @@ auto VSvgFontDatabase::QueryFont(const QString &family, SVGFontStyle style, SVGF auto VSvgFontDatabase::QueryFontEngine(const QString &family, SVGFontStyle style, SVGFontWeight weight, int pointSize) const -> VSvgFontEngine { - VSvgFont font = QueryFont(family, style, weight); - QByteArray hash = font.Hash(); + VSvgFont const font = QueryFont(family, style, weight); + QByteArray const hash = font.Hash(); if (m_fontEngineCache.contains(hash)) { VSvgFontEngine engine = *m_fontEngineCache.object(hash); diff --git a/src/libs/vmisc/svgfont/vsvgfontengine.cpp b/src/libs/vmisc/svgfont/vsvgfontengine.cpp index 6c46128c5..057268756 100644 --- a/src/libs/vmisc/svgfont/vsvgfontengine.cpp +++ b/src/libs/vmisc/svgfont/vsvgfontengine.cpp @@ -109,7 +109,7 @@ auto VSvgFontEngine::FontPixelSize() const -> int return d->m_font.PixelSize(); } - qreal pointSize = d->m_font.PointSizeF(); + qreal const pointSize = d->m_font.PointSizeF(); if (pointSize <= 0) { qWarning("VSvgFontEngine::FontPixelSize: Point size <= 0 (%f), must be greater than 0", pointSize); @@ -128,14 +128,14 @@ auto VSvgFontEngine::FontHeight() const -> qreal //--------------------------------------------------------------------------------------------------------------------- auto VSvgFontEngine::FromFontUnits(qreal val, int pixelSize) const -> qreal { - int pxSize = pixelSize > 0 ? pixelSize : FontPixelSize(); + int const pxSize = pixelSize > 0 ? pixelSize : FontPixelSize(); return pxSize * val / d->m_font.UnitsPerEm(); } //--------------------------------------------------------------------------------------------------------------------- auto VSvgFontEngine::ToFontUnits(qreal val, int pixelSize) const -> qreal { - int pxSize = pixelSize > 0 ? pixelSize : FontPixelSize(); + int const pxSize = pixelSize > 0 ? pixelSize : FontPixelSize(); return val * d->m_font.UnitsPerEm() / pxSize; } @@ -169,7 +169,7 @@ void VSvgFontEngine::AddGlyph(QChar unicode, const QPainterPath &path, qreal hor //--------------------------------------------------------------------------------------------------------------------- auto VSvgFontEngine::DrawPath(const QPointF &point, const QString &str) const -> QPainterPath { - qreal pixelSize = FontPixelSize(); + qreal const pixelSize = FontPixelSize(); if (d->m_font.UnitsPerEm() <= 0 || pixelSize <= 0) { @@ -203,7 +203,7 @@ auto VSvgFontEngine::DrawPath(const QPointF &point, const QString &str) const -> //--------------------------------------------------------------------------------------------------------------------- void VSvgFontEngine::Draw(QPainter *p, const QPointF &point, const QString &str) const { - int pixelSize = FontPixelSize(); + int const pixelSize = FontPixelSize(); if (d->m_font.UnitsPerEm() <= 0 || pixelSize <= 0) { @@ -244,7 +244,7 @@ void VSvgFontEngine::Draw(QPainter *p, const QRectF &rect, const QString &str, Q { SCASSERT(p != nullptr) - int pixelSize = FontPixelSize(); + int const pixelSize = FontPixelSize(); if (d->m_font.UnitsPerEm() <= 0 || pixelSize <= 0) { @@ -262,14 +262,14 @@ void VSvgFontEngine::Draw(QPainter *p, const QRectF &rect, const QString &str, Q QPoint alignmentOffset(0, 0); if (alignment == Qt::AlignHCenter) { - qreal stringWidth = ToFontUnits(rect.width()); - int textWidth = TextHorizAdvX(str); + qreal const stringWidth = ToFontUnits(rect.width()); + int const textWidth = TextHorizAdvX(str); alignmentOffset.setX(qRound(stringWidth / 2. - textWidth / 2.)); } else if (alignment == Qt::AlignRight) { - qreal stringWidth = ToFontUnits(rect.width()); - int textWidth = TextHorizAdvX(str); + qreal const stringWidth = ToFontUnits(rect.width()); + int const textWidth = TextHorizAdvX(str); alignmentOffset.setX(qRound(stringWidth - textWidth)); } @@ -346,11 +346,11 @@ auto VSvgFontEngine::FontSample() const -> QString sample = d->m_font.FamilyName(); } - QList writingSystems = d->m_font.WritingSystems(); + QList const writingSystems = d->m_font.WritingSystems(); for (auto system : writingSystems) { - QString systemSample = WritingSystemSample(system); + QString const systemSample = WritingSystemSample(system); if (CanRender(systemSample)) { if (sample.isEmpty()) @@ -381,7 +381,7 @@ auto VSvgFontEngine::ElidedText(const QString &text, SVGTextElideMode mode, int QString ellipsis; { // We only want to use the ellipsis character if it supported by font. - QChar ellipsisChar = u'\x2026'; + QChar const ellipsisChar = u'\x2026'; if (InFont(ellipsisChar)) { ellipsis = ellipsisChar; @@ -422,8 +422,8 @@ auto VSvgFontEngine::ElidedText(const QString &text, SVGTextElideMode mode, int while (leftIndex < rightIndex && remainingWidth > 0) { - qreal leftAdvance = TextWidth(elidedText.at(leftIndex), penWidth); - qreal rightAdvance = TextWidth(elidedText.at(rightIndex), penWidth); + qreal const leftAdvance = TextWidth(elidedText.at(leftIndex), penWidth); + qreal const rightAdvance = TextWidth(elidedText.at(rightIndex), penWidth); if (leftAdvance <= rightAdvance && remainingWidth >= leftAdvance) { @@ -453,20 +453,20 @@ auto VSvgFontEngine::ElidedText(const QString &text, SVGTextElideMode mode, int //--------------------------------------------------------------------------------------------------------------------- void VSvgFontEngine::RecalculateFontSize() { - int pixelSize = 100; + int const pixelSize = 100; QTransform matrix; matrix.translate(0, FromFontUnits(d->m_font.Ascent(), pixelSize)); matrix.scale(pixelSize / d->m_font.UnitsPerEm(), -pixelSize / d->m_font.UnitsPerEm()); - QRectF standard(0, 0, pixelSize, pixelSize); + QRectF const standard(0, 0, pixelSize, pixelSize); qreal top = standard.top(); qreal bottom = standard.bottom(); QHash::const_iterator i = d->m_glyphs.constBegin(); while (i != d->m_glyphs.constEnd()) { - QPainterPath path = i.value().Path(); - QChar c = i.key(); + QPainterPath const path = i.value().Path(); + QChar const c = i.key(); if (path.isEmpty() || c == u'\0') { ++i; @@ -505,7 +505,7 @@ void VSvgFontEngine::RecalculateFontSize() d->m_font.SetDescent(descent); } - qreal units = ascent + qAbs(descent); + qreal const units = ascent + qAbs(descent); d->m_font.SetUnitsPerEm(units); } } diff --git a/src/libs/vmisc/svgfont/vsvgfontreader.cpp b/src/libs/vmisc/svgfont/vsvgfontreader.cpp index e18f7b8ad..e83e2b7d8 100644 --- a/src/libs/vmisc/svgfont/vsvgfontreader.cpp +++ b/src/libs/vmisc/svgfont/vsvgfontreader.cpp @@ -75,7 +75,7 @@ auto ParseFontWeight(const QString &fontWeight) -> SVGFontWeight } bool ok; - int parsedWeight = fontWeight.toInt(&ok); + int const parsedWeight = fontWeight.toInt(&ok); if (ok) { @@ -104,7 +104,7 @@ auto ParseFontWeight(const QString &fontWeight) -> SVGFontWeight } else { - QString fontWeightLower = fontWeight.toLower(); + QString const fontWeightLower = fontWeight.toLower(); if (fontWeightLower == "normal"_L1) { return SVGFontWeight::Normal; @@ -122,7 +122,7 @@ auto ParseFontWeight(const QString &fontWeight) -> SVGFontWeight auto InitFont(const QXmlStreamAttributes &fontAttr) -> VSvgFont { const auto hax = fontAttr.value("horiz-adv-x"_L1); - qreal horizAdvX = hax.toDouble(); + qreal const horizAdvX = hax.toDouble(); QString id = fontAttr.value("id"_L1).toString(); if (id.isEmpty()) @@ -336,8 +336,8 @@ void VSvgFontReader::AssertRootTag(const QString &tag) const //--------------------------------------------------------------------------------------------------------------------- void VSvgFontReader::SetFontFace(VSvgFont *font) { - QXmlStreamAttributes fontFaceAttr = attributes(); - QString fontFamily = fontFaceAttr.value("font-family"_L1).toString(); + QXmlStreamAttributes const fontFaceAttr = attributes(); + QString const fontFamily = fontFaceAttr.value("font-family"_L1).toString(); const auto unitsPerEmStr = fontFaceAttr.value("units-per-em"_L1); qreal unitsPerEm = unitsPerEmStr.toDouble(); @@ -360,8 +360,8 @@ void VSvgFontReader::SetFontFace(VSvgFont *font) descent = -200; } - QString fontStyle = fontFaceAttr.value("font-style"_L1).toString(); - QString fontWeight = fontFaceAttr.value("font-weight"_L1).toString(); + QString const fontStyle = fontFaceAttr.value("font-style"_L1).toString(); + QString const fontWeight = fontFaceAttr.value("font-weight"_L1).toString(); QString fontName; while (readNextStartElement()) @@ -402,8 +402,8 @@ void VSvgFontReader::ParseSvgGlyph(VSvgFontEngine *engine, const QXmlStreamAttri auto havStr = glyphAttr.value("horiz-adv-x"_L1); auto pathStr = glyphAttr.value("d"_L1); - QChar unicode = (uncStr.isEmpty()) ? u'\0' : uncStr.at(0); - qreal havx = (havStr.isEmpty()) ? -1 : havStr.toDouble(); + QChar const unicode = (uncStr.isEmpty()) ? u'\0' : uncStr.at(0); + qreal const havx = (havStr.isEmpty()) ? -1 : havStr.toDouble(); QPainterPath path; path.setFillRule(Qt::WindingFill); VSVGPathTokenizer tokenizer(pathStr.toString()); diff --git a/src/libs/vmisc/svgfont/vsvgpathtokenizer.cpp b/src/libs/vmisc/svgfont/vsvgpathtokenizer.cpp index 523749fad..3493187b5 100644 --- a/src/libs/vmisc/svgfont/vsvgpathtokenizer.cpp +++ b/src/libs/vmisc/svgfont/vsvgpathtokenizer.cpp @@ -50,8 +50,8 @@ const qreal V_PI = static_cast(M_PI); // pi //--------------------------------------------------------------------------------------------------------------------- auto IsCommand(const QChar &ch) -> bool { - static QSet commandCharacterSet{'m', 'M', 'z', 'Z', 'l', 'L', 'h', 'H', 'v', 'V', - 'c', 'C', 's', 'S', 'q', 'Q', 't', 'T', 'a', 'A'}; + static QSet const commandCharacterSet{'m', 'M', 'z', 'Z', 'l', 'L', 'h', 'H', 'v', 'V', + 'c', 'C', 's', 'S', 'q', 'Q', 't', 'T', 'a', 'A'}; return commandCharacterSet.contains(ch); } @@ -87,7 +87,7 @@ void AddArgumentIfNotEmpty(VSVGPathCommand ¤tCommand, const QString &curre if (!currentToken.isEmpty() && !currentCommand.m_command.isNull()) { bool ok = false; - qreal val = currentToken.toDouble(&ok); + qreal const val = currentToken.toDouble(&ok); if (ok) { currentCommand.m_arguments.push_back(val); @@ -235,7 +235,7 @@ void PathArc(QPainterPath &path, qreal rx, qreal ry, qreal x_axis_rotation, int //--------------------------------------------------------------------------------------------------------------------- VSVGPathTokenizer::VSVGPathTokenizer(const QString &path) { - QMutexLocker locker(svgPathTokenizerMutex()); + QMutexLocker const locker(svgPathTokenizerMutex()); TokenizePathString(path); } @@ -243,7 +243,7 @@ VSVGPathTokenizer::VSVGPathTokenizer(const QString &path) //--------------------------------------------------------------------------------------------------------------------- auto VSVGPathTokenizer::ToPainterPath(QPainterPath &path) const -> bool { - QMutexLocker locker(svgPathTokenizerMutex()); + QMutexLocker const locker(svgPathTokenizerMutex()); // starting point m_x0 = 0; @@ -525,9 +525,9 @@ void VSVGPathTokenizer::Command_c(QPainterPath &path) const m_count = 0; return; } - QPointF c1(m_num[0] + m_offsetX, m_num[1] + m_offsetY); - QPointF c2(m_num[2] + m_offsetX, m_num[3] + m_offsetY); - QPointF e(m_num[4] + m_offsetX, m_num[5] + m_offsetY); + QPointF const c1(m_num[0] + m_offsetX, m_num[1] + m_offsetY); + QPointF const c2(m_num[2] + m_offsetX, m_num[3] + m_offsetY); + QPointF const e(m_num[4] + m_offsetX, m_num[5] + m_offsetY); m_num += 6; m_count -= 6; path.cubicTo(c1, c2, e); @@ -545,9 +545,9 @@ void VSVGPathTokenizer::Command_C(QPainterPath &path) const m_count = 0; return; } - QPointF c1(m_num[0], m_num[1]); - QPointF c2(m_num[2], m_num[3]); - QPointF e(m_num[4], m_num[5]); + QPointF const c1(m_num[0], m_num[1]); + QPointF const c2(m_num[2], m_num[3]); + QPointF const e(m_num[4], m_num[5]); m_num += 6; m_count -= 6; path.cubicTo(c1, c2, e); @@ -574,8 +574,8 @@ void VSVGPathTokenizer::Command_s(QPainterPath &path) const { c1 = QPointF(m_x, m_y); } - QPointF c2(m_num[0] + m_offsetX, m_num[1] + m_offsetY); - QPointF e(m_num[2] + m_offsetX, m_num[3] + m_offsetY); + QPointF const c2(m_num[0] + m_offsetX, m_num[1] + m_offsetY); + QPointF const e(m_num[2] + m_offsetX, m_num[3] + m_offsetY); m_num += 4; m_count -= 4; path.cubicTo(c1, c2, e); @@ -604,8 +604,8 @@ void VSVGPathTokenizer::Command_S(QPainterPath &path) const c1 = QPointF(m_x, m_y); } - QPointF c2(m_num[0], m_num[1]); - QPointF e(m_num[2], m_num[3]); + QPointF const c2(m_num[0], m_num[1]); + QPointF const e(m_num[2], m_num[3]); m_num += 4; m_count -= 4; path.cubicTo(c1, c2, e); @@ -624,8 +624,8 @@ void VSVGPathTokenizer::Command_q(QPainterPath &path) const return; } - QPointF c(m_num[0] + m_offsetX, m_num[1] + m_offsetY); - QPointF e(m_num[2] + m_offsetX, m_num[3] + m_offsetY); + QPointF const c(m_num[0] + m_offsetX, m_num[1] + m_offsetY); + QPointF const e(m_num[2] + m_offsetX, m_num[3] + m_offsetY); m_num += 4; m_count -= 4; path.quadTo(c, e); @@ -644,8 +644,8 @@ void VSVGPathTokenizer::Command_Q(QPainterPath &path) const return; } - QPointF c(m_num[0], m_num[1]); - QPointF e(m_num[2], m_num[3]); + QPointF const c(m_num[0], m_num[1]); + QPointF const e(m_num[2], m_num[3]); m_num += 4; m_count -= 4; path.quadTo(c, e); @@ -664,7 +664,7 @@ void VSVGPathTokenizer::Command_t(QPainterPath &path) const return; } - QPointF e(m_num[0] + m_offsetX, m_num[1] + m_offsetY); + QPointF const e(m_num[0] + m_offsetX, m_num[1] + m_offsetY); m_num += 2; m_count -= 2; QPointF c; @@ -692,7 +692,7 @@ void VSVGPathTokenizer::Command_T(QPainterPath &path) const return; } - QPointF e(m_num[0], m_num[1]); + QPointF const e(m_num[0], m_num[1]); m_num += 2; m_count -= 2; QPointF c; @@ -720,16 +720,16 @@ void VSVGPathTokenizer::Command_a(QPainterPath &path) const return; } - qreal rx = (*m_num++); - qreal ry = (*m_num++); - qreal xAxisRotation = (*m_num++); - qreal largeArcFlag = (*m_num++); - qreal sweepFlag = (*m_num++); - qreal ex = (*m_num++) + m_offsetX; - qreal ey = (*m_num++) + m_offsetY; + qreal const rx = (*m_num++); + qreal const ry = (*m_num++); + qreal const xAxisRotation = (*m_num++); + qreal const largeArcFlag = (*m_num++); + qreal const sweepFlag = (*m_num++); + qreal const ex = (*m_num++) + m_offsetX; + qreal const ey = (*m_num++) + m_offsetY; m_count -= 7; - qreal curx = m_x; - qreal cury = m_y; + qreal const curx = m_x; + qreal const cury = m_y; PathArc(path, rx, ry, xAxisRotation, static_cast(largeArcFlag), static_cast(sweepFlag), ex, ey, curx, cury); m_x = ex; @@ -745,16 +745,16 @@ void VSVGPathTokenizer::Command_A(QPainterPath &path) const m_count = 0; return; } - qreal rx = (*m_num++); - qreal ry = (*m_num++); - qreal xAxisRotation = (*m_num++); - qreal largeArcFlag = (*m_num++); - qreal sweepFlag = (*m_num++); - qreal ex = (*m_num++); - qreal ey = (*m_num++); + qreal const rx = (*m_num++); + qreal const ry = (*m_num++); + qreal const xAxisRotation = (*m_num++); + qreal const largeArcFlag = (*m_num++); + qreal const sweepFlag = (*m_num++); + qreal const ex = (*m_num++); + qreal const ey = (*m_num++); m_count -= 7; - qreal curx = m_x; - qreal cury = m_y; + qreal const curx = m_x; + qreal const cury = m_y; PathArc(path, rx, ry, xAxisRotation, static_cast(largeArcFlag), static_cast(sweepFlag), ex, ey, curx, cury); m_x = ex; @@ -764,7 +764,7 @@ void VSVGPathTokenizer::Command_A(QPainterPath &path) const //--------------------------------------------------------------------------------------------------------------------- auto VSVGPathTokenizer::GetCommands() const -> QList { - QMutexLocker locker(svgPathTokenizerMutex()); + QMutexLocker const locker(svgPathTokenizerMutex()); return m_commands; } diff --git a/src/libs/vmisc/testpath.h b/src/libs/vmisc/testpath.h index 416c99c02..cf48a6c30 100644 --- a/src/libs/vmisc/testpath.h +++ b/src/libs/vmisc/testpath.h @@ -70,7 +70,7 @@ template void DumpVector(const QVector &points, const QString &temp #endif QJsonObject vectorObject; VectorToJson(points, vectorObject); - QJsonDocument vector(vectorObject); + QJsonDocument const vector(vectorObject); QTextStream out(&temp); out << vector.toJson(); diff --git a/src/libs/vmisc/theme/vapplicationstyle.cpp b/src/libs/vmisc/theme/vapplicationstyle.cpp index c162b0be6..c67db2f4f 100644 --- a/src/libs/vmisc/theme/vapplicationstyle.cpp +++ b/src/libs/vmisc/theme/vapplicationstyle.cpp @@ -255,8 +255,8 @@ auto VApplicationStyle::StyleIcon(StandardPixmap standardIcon, const QStyleOptio auto VApplicationStyle::StylesheetIcon(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const -> QIcon { - static QHash icons = StandardIconPaths(); - QString resource = QStringLiteral("://%1/%2").arg(VTheme::ThemeStylesheet(), icons.value(standardIcon)); + static QHash const icons = StandardIconPaths(); + QString const resource = QStringLiteral("://%1/%2").arg(VTheme::ThemeStylesheet(), icons.value(standardIcon)); if (QFileInfo::exists(resource)) { return QIcon(resource); diff --git a/src/libs/vmisc/theme/vpatternpiecestyle.cpp b/src/libs/vmisc/theme/vpatternpiecestyle.cpp index 9980aa2de..67efac56c 100644 --- a/src/libs/vmisc/theme/vpatternpiecestyle.cpp +++ b/src/libs/vmisc/theme/vpatternpiecestyle.cpp @@ -62,9 +62,9 @@ VPatternPieceStyle::VPatternPieceStyle() //--------------------------------------------------------------------------------------------------------------------- void VPatternPieceStyle::LoadJson(const QJsonObject &json) { - QJsonValue toolStyleValues = json[*PatternPieceStyleNodeVar]; + QJsonValue const toolStyleValues = json[*PatternPieceStyleNodeVar]; - QJsonObject obj = toolStyleValues.toObject(); + QJsonObject const obj = toolStyleValues.toObject(); ReadColor(obj, *PieceColorVar, m_pieceColor); ReadColor(obj, *PointColorVar, m_pointColor); @@ -79,7 +79,7 @@ void VPatternPieceStyle::LoadJson(const QJsonObject &json) //--------------------------------------------------------------------------------------------------------------------- auto VPatternPieceStyle::ToJson() const -> QJsonObject { - QJsonObject obj; + QJsonObject const obj; WriteColor(obj, *PieceColorVar, m_pieceColor); WriteColor(obj, *PointColorVar, m_pointColor); diff --git a/src/libs/vmisc/theme/vscenestylesheet.cpp b/src/libs/vmisc/theme/vscenestylesheet.cpp index e1dd9a00e..82f7d5352 100644 --- a/src/libs/vmisc/theme/vscenestylesheet.cpp +++ b/src/libs/vmisc/theme/vscenestylesheet.cpp @@ -158,7 +158,7 @@ auto VSceneStylesheet::CorrectToolColorForDarkTheme(const QColor &color) -> QCol return color; } - QMap adjustments = ToolStyle().ColorAdjustments(); + QMap const adjustments = ToolStyle().ColorAdjustments(); QString colorName = color.name(QColor::HexArgb); if (adjustments.contains(colorName)) diff --git a/src/libs/vmisc/theme/vtheme.cpp b/src/libs/vmisc/theme/vtheme.cpp index 2d161e5fa..38d50a1bf 100644 --- a/src/libs/vmisc/theme/vtheme.cpp +++ b/src/libs/vmisc/theme/vtheme.cpp @@ -185,7 +185,7 @@ auto GetResourceName(const QString &root, const QString &iconName, bool dark) -> //--------------------------------------------------------------------------------------------------------------------- auto GetPixmapResource(const QString &root, const QString &iconName, bool dark) -> QPixmap { - QString resourceName = GetResourceName(root, iconName, dark); + QString const resourceName = GetResourceName(root, iconName, dark); QPixmap pixmap = QPixmap(resourceName); Q_ASSERT(!pixmap.isNull()); return pixmap; @@ -251,14 +251,14 @@ auto VTheme::IsInDarkTheme() -> bool //--------------------------------------------------------------------------------------------------------------------- auto VTheme::ShouldApplyDarkTheme() -> bool { - QPalette palette = qApp->palette(); // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast) + QPalette const palette = qApp->palette(); // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast) return palette.color(QPalette::WindowText).lightness() > palette.color(QPalette::Window).lightness(); } //--------------------------------------------------------------------------------------------------------------------- auto VTheme::ColorSheme() -> VColorSheme { - VThemeMode themeMode = VAbstractApplication::VApp()->Settings()->GetThemeMode(); + VThemeMode const themeMode = VAbstractApplication::VApp()->Settings()->GetThemeMode(); if (themeMode == VThemeMode::Light) { @@ -291,8 +291,8 @@ auto VTheme::ColorSheme() -> VColorSheme //--------------------------------------------------------------------------------------------------------------------- auto VTheme::DefaultThemeName() -> QString { - VColorSheme colorScheme = ColorSheme(); - QString themePrefix = (colorScheme == VColorSheme::Light ? QStringLiteral("Light") : QStringLiteral("Dark")); + VColorSheme const colorScheme = ColorSheme(); + QString const themePrefix = (colorScheme == VColorSheme::Light ? QStringLiteral("Light") : QStringLiteral("Dark")); #if defined(Q_OS_MACX) return QStringLiteral("La-Sierra-%1").arg(themePrefix); @@ -304,7 +304,7 @@ auto VTheme::DefaultThemeName() -> QString //--------------------------------------------------------------------------------------------------------------------- void VTheme::InitApplicationStyle() { - VThemeMode themeMode = VAbstractApplication::VApp()->Settings()->GetThemeMode(); + VThemeMode const themeMode = VAbstractApplication::VApp()->Settings()->GetThemeMode(); if (themeMode == VThemeMode::Light || themeMode == VThemeMode::Dark) { @@ -345,7 +345,7 @@ void VTheme::SetIconTheme() } else { - VThemeMode themeMode = VAbstractApplication::VApp()->Settings()->GetThemeMode(); + VThemeMode const themeMode = VAbstractApplication::VApp()->Settings()->GetThemeMode(); if ((themeMode == VThemeMode::Dark && !ShouldApplyDarkTheme()) || (themeMode == VThemeMode::Light && ShouldApplyDarkTheme())) @@ -365,7 +365,7 @@ void VTheme::SetToAutoTheme() const //--------------------------------------------------------------------------------------------------------------------- void VTheme::InitThemeMode() { - VThemeMode themeMode = VAbstractApplication::VApp()->Settings()->GetThemeMode(); + VThemeMode const themeMode = VAbstractApplication::VApp()->Settings()->GetThemeMode(); if (themeMode == VThemeMode::Light) { @@ -422,7 +422,7 @@ void VTheme::InitThemeMode() //--------------------------------------------------------------------------------------------------------------------- auto VTheme::ThemeStylesheet() -> QString { - VThemeMode themeMode = VAbstractApplication::VApp()->Settings()->GetThemeMode(); + VThemeMode const themeMode = VAbstractApplication::VApp()->Settings()->GetThemeMode(); if (themeMode == VThemeMode::Light) { @@ -509,7 +509,7 @@ auto VTheme::GetFallbackThemeIcon(const QString &iconName, QSize iconSize) -> QI auto VTheme::GetIconResource(const QString &root, const QString &iconName) -> QIcon { QIcon icon; - bool dark = (ColorSheme() == VColorSheme::Dark); + bool const dark = (ColorSheme() == VColorSheme::Dark); QPixmap pixmap = ::GetPixmapResource(root, iconName, dark); icon.addPixmap(pixmap); if (dark) @@ -554,7 +554,7 @@ VTheme::VTheme(QObject *parent) QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); VCommonSettings *settings = VAbstractApplication::VApp()->Settings(); - VThemeMode themeMode = settings->GetThemeMode(); + VThemeMode const themeMode = settings->GetThemeMode(); if (themeMode == VThemeMode::System && VTheme::NativeDarkThemeAvailable()) { if (QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark) diff --git a/src/libs/vmisc/theme/vtoolstyle.cpp b/src/libs/vmisc/theme/vtoolstyle.cpp index 58f5b2dda..b647f1590 100644 --- a/src/libs/vmisc/theme/vtoolstyle.cpp +++ b/src/libs/vmisc/theme/vtoolstyle.cpp @@ -74,13 +74,13 @@ void ReadColorAdjustments(const QJsonObject &values, const QString &variable, QM return; } - QJsonObject colorAdjustmentsObject = valueRef.toObject(); + QJsonObject const colorAdjustmentsObject = valueRef.toObject(); for (const QString &key : colorAdjustmentsObject.keys()) { - QColor keyColor(key); - QColor valueColor = VStylesheetStyle::ReadColorValue(colorAdjustmentsObject.value(key)); - QString colorName = valueColor.name(QColor::HexArgb); + QColor const keyColor(key); + QColor const valueColor = VStylesheetStyle::ReadColorValue(colorAdjustmentsObject.value(key)); + QString const colorName = valueColor.name(QColor::HexArgb); adjustments.insert(keyColor.name(QColor::HexArgb), colorName); } } @@ -109,9 +109,9 @@ VToolStyle::VToolStyle() //--------------------------------------------------------------------------------------------------------------------- void VToolStyle::LoadJson(const QJsonObject &json) { - QJsonValue toolStyleValues = json[*ToolStyleNodeVar]; + QJsonValue const toolStyleValues = json[*ToolStyleNodeVar]; - QJsonObject obj = toolStyleValues.toObject(); + QJsonObject const obj = toolStyleValues.toObject(); ReadColor(obj, *PatternColorVar, m_patternColor); ReadColor(obj, *DisabledColorVar, m_disabledColor); @@ -134,7 +134,7 @@ void VToolStyle::LoadJson(const QJsonObject &json) //--------------------------------------------------------------------------------------------------------------------- auto VToolStyle::ToJson() const -> QJsonObject { - QJsonObject obj; + QJsonObject const obj; WriteColor(obj, *PatternColorVar, m_patternColor); WriteColor(obj, *DisabledColorVar, m_disabledColor); diff --git a/src/libs/vmisc/vabstractapplication.cpp b/src/libs/vmisc/vabstractapplication.cpp index 08fe24f72..cbb3f3ed6 100644 --- a/src/libs/vmisc/vabstractapplication.cpp +++ b/src/libs/vmisc/vabstractapplication.cpp @@ -115,7 +115,7 @@ VAbstractApplication::VAbstractApplication(int &argc, char **argv) : QApplication(argc, argv), undoStack(new QUndoStack(this)) { - QString rules; + QString const rules; #if defined(V_NO_ASSERT) // Ignore SSL-related warnings @@ -587,7 +587,8 @@ void VAbstractApplication::RepopulateFontDatabase(const QString &path) { if (m_svgFontDatabase != nullptr) { - QFuture future = QtConcurrent::run([this, path]() { m_svgFontDatabase->PopulateFontDatabase(path); }); + QFuture const future = + QtConcurrent::run([this, path]() { m_svgFontDatabase->PopulateFontDatabase(path); }); } } diff --git a/src/libs/vmisc/vabstractshortcutmanager.cpp b/src/libs/vmisc/vabstractshortcutmanager.cpp index c6f82d93a..0382b0f71 100644 --- a/src/libs/vmisc/vabstractshortcutmanager.cpp +++ b/src/libs/vmisc/vabstractshortcutmanager.cpp @@ -88,7 +88,7 @@ void VAbstractShortcutManager::UpdateButtonShortcut(const QMultiHash keySequence = StringListToKeySequenceList(shortcut.shortcuts); + QList const keySequence = StringListToKeySequenceList(shortcut.shortcuts); if (!keySequence.isEmpty()) { button->setShortcut(keySequence.constFirst()); diff --git a/src/libs/vmisc/vcommonsettings.cpp b/src/libs/vmisc/vcommonsettings.cpp index 83b691865..49832fb0f 100644 --- a/src/libs/vmisc/vcommonsettings.cpp +++ b/src/libs/vmisc/vcommonsettings.cpp @@ -265,7 +265,7 @@ auto VCommonSettings::CastToLayoutExportFormat(qint8 f) -> qint8 //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetPathIndividualMeasurements() const -> QString { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return settings.value(*settingPathsIndividualMeasurements, QDir::homePath()).toString(); } @@ -280,7 +280,7 @@ void VCommonSettings::SetPathIndividualMeasurements(const QString &value) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetPathMultisizeMeasurements() const -> QString { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return settings.value(*settingPathsMultisizeMeasurements, QDir::homePath()).toString(); } @@ -295,7 +295,7 @@ void VCommonSettings::SetPathMultisizeMeasurements(const QString &value) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetPathPattern() const -> QString { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return settings.value(*settingPathsPattern, QDir::homePath()).toString(); } @@ -310,7 +310,7 @@ void VCommonSettings::SetPathPattern(const QString &value) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetPathManualLayouts() const -> QString { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return settings.value(*settingPathsManualLayouts, QDir::homePath()).toString(); } @@ -325,7 +325,7 @@ void VCommonSettings::SetPathManualLayouts(const QString &value) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetPathCustomImage() const -> QString { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return settings.value(*settingPathsCustomImage, QDir::homePath()).toString(); } @@ -346,7 +346,7 @@ auto VCommonSettings::GetDefPathSVGFonts() -> QString //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetPathSVGFonts() const -> QString { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return settings.value(*settingPathsSVGFonts, GetDefPathSVGFonts()).toString(); } @@ -374,7 +374,7 @@ auto VCommonSettings::GetDefPathFontCorrections() -> QString //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetPathFontCorrections() const -> QString { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return settings.value(*settingPathsFontCorrections, GetDefPathFontCorrections()).toString(); } @@ -395,7 +395,7 @@ auto VCommonSettings::GetDefPathKnownMeasurements() -> QString //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetPathKnownMeasurements() const -> QString { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return settings.value(*settingPathsKnownMeasurements, GetDefPathKnownMeasurements()).toString(); } @@ -462,7 +462,7 @@ void VCommonSettings::SetAutosaveTime(const int &value) auto VCommonSettings::IsLocaleSelected() const -> bool { const QString fakeLocale = QStringLiteral("Fake"); - QString locale = value(*settingConfigurationLocale, fakeLocale).toString(); + QString const locale = value(*settingConfigurationLocale, fakeLocale).toString(); return locale != fakeLocale; } @@ -584,7 +584,7 @@ void VCommonSettings::SetToolboxIconSizeSmall(bool value) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetThemeMode() const -> VThemeMode { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); int val = settings.value(*settingConfigurationThemeMode, static_cast(VThemeMode::System)).toInt(); if (val < 0 || val > 2) @@ -829,7 +829,7 @@ void VCommonSettings::SetDialogSplinePathSize(const QSize &sz) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::IsAutomaticallyCheckUpdates() const -> bool { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return settings.value(*settingAutomaticallyCheckUpdates, true).toBool(); } @@ -844,7 +844,7 @@ void VCommonSettings::SetAutomaticallyCheckUpdates(bool value) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetLatestSkippedVersion() const -> unsigned { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return settings.value(*settingLatestSkippedVersion, 0x0).toUInt(); } @@ -859,7 +859,7 @@ void VCommonSettings::SetLatestSkippedVersion(unsigned value) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetDateOfLastRemind() const -> QDate { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return settings.value(*settingDateOfLastRemind, QDate(1900, 1, 1)).toDate(); } @@ -951,7 +951,7 @@ void VCommonSettings::SetCSVWithHeader(bool withHeader) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetCSVWithHeader() const -> bool { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return settings.value(*settingCSVWithHeader, GetDefCSVWithHeader()).toBool(); } @@ -971,7 +971,7 @@ void VCommonSettings::SetCSVCodec(int mib) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetCSVCodec() const -> int { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return settings.value(*settingCSVCodec, GetDefCSVCodec()).toInt(); } @@ -1005,7 +1005,7 @@ void VCommonSettings::SetCSVSeparator(const QChar &separator) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetCSVSeparator() const -> QChar { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); const quint8 separator = static_cast(settings.value(*settingCSVSeparator, 3).toUInt()); switch (separator) { @@ -1363,7 +1363,7 @@ void VCommonSettings::SetPieceShowMainPath(bool value) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::IsDontUseNativeDialog() const -> bool { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return settings.value(*settingConfigurationDontUseNativeDialog, false).toBool(); } @@ -1409,7 +1409,7 @@ auto VCommonSettings::WidthHairLine() const -> qreal //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetScrollingDuration() const -> int { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return GetCachedValue(settings, scrollingDurationCached, *settingScrollingDuration, defaultScrollingDuration, scrollingDurationMin, scrollingDurationMax); } @@ -1426,7 +1426,7 @@ void VCommonSettings::SetScrollingDuration(int duration) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetScrollingUpdateInterval() const -> int { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return GetCachedValue(settings, scrollingUpdateIntervalCached, *settingScrollingUpdateInterval, defaultScrollingUpdateInterval, scrollingUpdateIntervalMin, scrollingUpdateIntervalMax); } @@ -1443,7 +1443,7 @@ void VCommonSettings::SetScrollingUpdateInterval(int updateInterval) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetSensorMouseScale() const -> qreal { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return GetCachedValue(settings, scrollingSensorMouseScaleCached, *settingScrollingSensorMouseScale, defaultSensorMouseScale, sensorMouseScaleMin, sensorMouseScaleMax); } @@ -1460,7 +1460,7 @@ void VCommonSettings::SetSensorMouseScale(qreal scale) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetWheelMouseScale() const -> qreal { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return GetCachedValue(settings, scrollingWheelMouseScaleCached, *settingScrollingWheelMouseScale, defaultWheelMouseScale, wheelMouseScaleMin, wheelMouseScaleMax); } @@ -1477,7 +1477,7 @@ void VCommonSettings::SetWheelMouseScale(qreal scale) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetScrollingAcceleration() const -> qreal { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return GetCachedValue(settings, scrollingAccelerationCached, *settingScrollingAcceleration, defaultScrollingAcceleration, scrollingAccelerationMin, scrollingAccelerationMax); } @@ -1494,7 +1494,7 @@ void VCommonSettings::SetScrollingAcceleration(qreal acceleration) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::IsOpenGLRender() const -> bool { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return settings.value(*settingPatternUseOpenGLRender, 0).toBool(); } @@ -1509,7 +1509,7 @@ void VCommonSettings::SetOpenGLRender(bool value) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetGraphicalOutput() const -> bool { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return settings.value(*settingPatternGraphicalOutput, 1).toBool(); } @@ -1551,8 +1551,8 @@ void VCommonSettings::SetTiledPDFMargins(const QMarginsF &value, const Unit &uni //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetTiledPDFOrientation() const -> PageOrientation { - bool defaultValue = static_cast(PageOrientation::Portrait); - bool result = value(*settingTiledPDFOrientation, defaultValue).toBool(); + bool const defaultValue = static_cast(PageOrientation::Portrait); + bool const result = value(*settingTiledPDFOrientation, defaultValue).toBool(); return static_cast(result); } @@ -1577,15 +1577,15 @@ void VCommonSettings::SetWatermarkEditorSize(const QSize &sz) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetWatermarkCustomColors() const -> QVector { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); - QStringList colors = settings.value(*settingPatternGraphicalOutput, 1).toStringList(); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QStringList const colors = settings.value(*settingPatternGraphicalOutput, 1).toStringList(); QVector customColors; customColors.reserve(colors.size()); for (const auto &color : colors) { - QColor c(color); + QColor const c(color); if (c.isValid()) { customColors.append(c); @@ -1625,7 +1625,7 @@ void VCommonSettings::SetWatermarkCustomColors(QVector colors) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::IsAskCollectStatistic() const -> bool { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return settings.value(*settingsStatistictAskCollect, 1).toBool(); } @@ -1640,7 +1640,7 @@ void VCommonSettings::SetAskCollectStatistic(bool value) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::IsCollectStatistic() const -> bool { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return settings.value(*settingsStatistictCollect, 1).toBool(); } @@ -1655,7 +1655,7 @@ void VCommonSettings::SetCollectStatistic(bool value) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::GetClientID() const -> QString { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return settings.value(*settingsStatistictClientID, QString()).toString(); } @@ -1670,7 +1670,7 @@ void VCommonSettings::SetClientID(const QString &clientID) //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::IsTranslateFormula() const -> bool { - QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); return settings.value(*settingsPatternTranslateFormula, 1).toBool(); } diff --git a/src/libs/vmisc/vtablesearch.cpp b/src/libs/vmisc/vtablesearch.cpp index ed7e26a9b..b702f20bb 100644 --- a/src/libs/vmisc/vtablesearch.cpp +++ b/src/libs/vmisc/vtablesearch.cpp @@ -118,7 +118,7 @@ auto VTableSearch::FindTableItems(QString term) -> QList options |= QRegularExpression::UseUnicodePropertiesOption; } - QRegularExpression re(term, options); + QRegularExpression const re(term, options); if (not re.isValid()) { @@ -134,8 +134,8 @@ auto VTableSearch::FindTableItems(QString term) -> QList QTableWidgetItem *cell = table->item(r, c); if (cell != nullptr) { - QString text = cell->text(); - QRegularExpressionMatch match = re.match(text); + QString const text = cell->text(); + QRegularExpressionMatch const match = re.match(text); if (match.hasMatch()) { list.append(cell); @@ -154,7 +154,7 @@ auto VTableSearch::FindCurrentMatchIndex() const -> int return 0; } - QList selectedItems = table->selectedItems(); + QList const selectedItems = table->selectedItems(); if (selectedItems.isEmpty()) { return 0; diff --git a/src/libs/vmisc/vtextcodec.cpp b/src/libs/vmisc/vtextcodec.cpp index e7c9c659a..ac5673159 100644 --- a/src/libs/vmisc/vtextcodec.cpp +++ b/src/libs/vmisc/vtextcodec.cpp @@ -76,12 +76,12 @@ VTextCodec::VTextCodec(QStringConverter::Encoding encoding) //--------------------------------------------------------------------------------------------------------------------- auto VTextCodec::codecForName(const QString &name) -> VTextCodec * { - QMap codecs = QtCodecs(); + QMap const codecs = QtCodecs(); auto i = codecs.constBegin(); while (i != codecs.constEnd()) { - QStringList aliases = i.value(); + QStringList const aliases = i.value(); if (aliases.contains(name)) { return MakeCodec(i.key()); @@ -101,7 +101,7 @@ auto VTextCodec::codecForLocale() -> VTextCodec * //--------------------------------------------------------------------------------------------------------------------- auto VTextCodec::codecForMib(int mib) -> VTextCodec * { - QMap mibs = CodecMibs(); + QMap const mibs = CodecMibs(); auto i = mibs.constBegin(); while (i != mibs.constEnd()) @@ -125,7 +125,7 @@ auto VTextCodec::availableMibs() -> QList //--------------------------------------------------------------------------------------------------------------------- auto VTextCodec::availableCodecs() -> QList { - QMap codecs = QtCodecs(); + QMap const codecs = QtCodecs(); QList names; names.reserve(codecs.size()); diff --git a/src/libs/vmisc/vvalentinasettings.cpp b/src/libs/vmisc/vvalentinasettings.cpp index b600e2171..89525e860 100644 --- a/src/libs/vmisc/vvalentinasettings.cpp +++ b/src/libs/vmisc/vvalentinasettings.cpp @@ -217,7 +217,7 @@ void VValentinaSettings::SetLabelLanguage(const QString &value) //--------------------------------------------------------------------------------------------------------------------- auto VValentinaSettings::GetPathLayout() const -> QString { - QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName()); + QSettings const settings(this->format(), this->scope(), this->organizationName(), this->applicationName()); return settings.value(*settingPathsLayout, QDir::homePath()).toString(); } diff --git a/src/libs/vobj/delaunay.cpp b/src/libs/vobj/delaunay.cpp index 64a3ef501..ef320cef2 100644 --- a/src/libs/vobj/delaunay.cpp +++ b/src/libs/vobj/delaunay.cpp @@ -361,7 +361,7 @@ static void compute_circle(point2d_t *pt0, point2d_t *pt1, point2d_t *pt2, real static auto in_circle(point2d_t *pt0, point2d_t *pt1, point2d_t *pt2, point2d_t *p) -> int { #if PREDICATE == EXACT_PREDICATE - real res = incircle(&(pt0->x), &(pt1->x), &(pt2->x), &(p->x)); + real const res = incircle(&(pt0->x), &(pt1->x), &(pt2->x), &(p->x)); if (res > REAL_ZERO) return INSIDE; else if (res < REAL_ZERO) @@ -781,7 +781,7 @@ static auto del_valid_link(halfedge_t *b) -> halfedge_t * if (g != g_p && d != d_p) { - int a = in_circle(g, d, g_p, d_p); + int const a = in_circle(g, d, g_p, d_p); if (a != ON_CIRCLE) { @@ -924,11 +924,11 @@ void del_divide_and_conquer(delaunay_t *del, int start, int end) { delaunay_t left, right; - int n = (end - start + 1); + int const n = (end - start + 1); if (n > 3) { - int i = (n / 2) + (n & 1); + int const i = (n / 2) + (n & 1); left.points = del->points; right.points = del->points; del_divide_and_conquer(&left, start, start + i - 1); diff --git a/src/libs/vobj/vobjengine.cpp b/src/libs/vobj/vobjengine.cpp index 08370ed52..60336c8c2 100644 --- a/src/libs/vobj/vobjengine.cpp +++ b/src/libs/vobj/vobjengine.cpp @@ -169,7 +169,7 @@ void VObjEngine::drawPath(const QPainterPath &path) return; } - qint64 sq = Square(polygon); + qint64 const sq = Square(polygon); ++planeCount; *stream << "o Plane." << u"%1"_s.arg(planeCount, 3, 10, '0'_L1) << Qt::endl; @@ -203,11 +203,11 @@ void VObjEngine::drawPath(const QPainterPath &path) { skipFace = false; } - int num_verts = static_cast(res->faces[offset]); + int const num_verts = static_cast(res->faces[offset]); offset++; for (int j = 0; j < num_verts; j++) { - int p0 = static_cast(res->faces[offset + j]); + int const p0 = static_cast(res->faces[offset + j]); pf[j] = QPointF(points[p0].x, points[p0].y); } if (skipFace == false) @@ -217,8 +217,8 @@ void VObjEngine::drawPath(const QPainterPath &path) { face << QPointF(pf[ind]); } - QPolygonF united = polygon.united(face); - qint64 sqUnited = Square(united); + QPolygonF const united = polygon.united(face); + qint64 const sqUnited = Square(united); if (sqUnited <= sq) { // This face incide our base polygon. drawPolygon(pf, num_verts, QPaintEngine::OddEvenMode); @@ -263,8 +263,8 @@ void VObjEngine::drawPoints(const QPointF *points, int pointCount) { for (int i = 0; i < pointCount; ++i) { - qreal x = ((points[i].x() - 0) / qFloor(size.width() / 2.0)) - 1.0; - qreal y = (((points[i].y() - 0) / qFloor(size.width() / 2.0)) - 1.0) * -1; + qreal const x = ((points[i].x() - 0) / qFloor(size.width() / 2.0)) - 1.0; + qreal const y = (((points[i].y() - 0) / qFloor(size.width() / 2.0)) - 1.0) * -1; *stream << "v" << " " << QString::number(x, 'f', 6) << " " << QString::number(y, 'f', 6) << " " @@ -349,7 +349,7 @@ auto VObjEngine::Square(const QPolygonF &poly) const -> qint64 QVector x; QVector y; - vsizetype n = poly.count(); + vsizetype const n = poly.count(); qreal s, res = 0; qint64 sq = 0; diff --git a/src/libs/vpatterndb/calculator.cpp b/src/libs/vpatterndb/calculator.cpp index 382042529..4e2b7b5f1 100644 --- a/src/libs/vpatterndb/calculator.cpp +++ b/src/libs/vpatterndb/calculator.cpp @@ -77,9 +77,9 @@ auto Calculator::EvalFormula(const QHash qreal { // Converting with locale is much faster in case of single numerical value. - QLocale c(QLocale::C); + QLocale const c(QLocale::C); bool ok = false; - qreal result = c.toDouble(formula, &ok); + qreal const result = c.toDouble(formula, &ok); if (ok) { return result; @@ -101,14 +101,14 @@ auto Calculator::VarFactory(const QString &a_szName, void *a_pUserData) -> qreal if (calc->m_vars != nullptr && calc->m_vars->contains(a_szName)) { - QSharedPointer val(new qreal(*calc->m_vars->value(a_szName)->GetValue())); + QSharedPointer const val(new qreal(*calc->m_vars->value(a_szName)->GetValue())); calc->m_varsValues.append(val); return val.data(); } if (a_szName.startsWith('#')) { - QSharedPointer val(new qreal(std::numeric_limits::quiet_NaN())); + QSharedPointer const val(new qreal(std::numeric_limits::quiet_NaN())); calc->m_varsValues.append(val); return val.data(); } diff --git a/src/libs/vpatterndb/testpassmark.cpp b/src/libs/vpatterndb/testpassmark.cpp index 1cf4d4bc0..3c5c3a2fa 100644 --- a/src/libs/vpatterndb/testpassmark.cpp +++ b/src/libs/vpatterndb/testpassmark.cpp @@ -46,7 +46,7 @@ auto PassmarkShapeToJson(const QVector &shape) -> QJsonArray QJsonArray shapeArray; for (auto line : shape) { - QJsonObject lineObject{ + QJsonObject const lineObject{ {"type", "QLineF"}, {"p1", PointToJson(line.p1())}, {"p2", PointToJson(line.p2())}, @@ -80,10 +80,10 @@ void DumpPassmarkData(const VPiecePassmarkData &data, const QString &templateNam // not see a difference. temp.fileName(); // call to create a file on disk #endif - QJsonObject dataObject{ + QJsonObject const dataObject{ {"data", data.toJson()}, }; - QJsonDocument vector(dataObject); + QJsonDocument const vector(dataObject); QTextStream out(&temp); out << vector.toJson(); @@ -112,10 +112,10 @@ void DumpPassmarkShape(const QVector &shape, const QString &templateName // not see a difference. temp.fileName(); // call to create a file on disk #endif - QJsonObject shapeObject{ + QJsonObject const shapeObject{ {"shape", PassmarkShapeToJson(shape)}, }; - QJsonDocument vector(shapeObject); + QJsonDocument const vector(shapeObject); QTextStream out(&temp); out << vector.toJson(); diff --git a/src/libs/vpatterndb/variables/vpiecearea.cpp b/src/libs/vpatterndb/variables/vpiecearea.cpp index 93dd8ca83..1b601b549 100644 --- a/src/libs/vpatterndb/variables/vpiecearea.cpp +++ b/src/libs/vpatterndb/variables/vpiecearea.cpp @@ -53,7 +53,7 @@ VPieceArea::VPieceArea(PieceAreaType type, quint32 pieceId, const VPiece &piece, // cppcheck-suppress unknownMacro SCASSERT(data != nullptr) - QString shortName = PieceShortName(piece); + QString const shortName = PieceShortName(piece); VContainer tempData = *data; auto *currentSA = new VIncrement(&tempData, currentSeamAllowance); diff --git a/src/libs/vpatterndb/vcontainer.cpp b/src/libs/vpatterndb/vcontainer.cpp index 42587f673..463f5a9d8 100644 --- a/src/libs/vpatterndb/vcontainer.cpp +++ b/src/libs/vpatterndb/vcontainer.cpp @@ -238,7 +238,7 @@ auto VContainer::GetPieceForPiecePath(quint32 id) const -> quint32 void VContainer::RegisterUniqueName(VGObject *obj) const { SCASSERT(obj != nullptr) - QSharedPointer pointer(obj); + QSharedPointer const pointer(obj); RegisterUniqueName(pointer); } @@ -264,7 +264,7 @@ void VContainer::RegisterUniqueName(const QSharedPointer &obj) const auto VContainer::AddGObject(VGObject *obj) -> quint32 { SCASSERT(obj != nullptr) - QSharedPointer pointer(obj); + QSharedPointer const pointer(obj); return AddGObject(pointer); } @@ -584,7 +584,7 @@ auto VContainer::DataMeasurements() const -> const QMap const QMap> { QMap> measurements = DataVar(VarType::Measurement); - QMap> separators = DataVar(VarType::MeasurementSeparator); + QMap> const separators = DataVar(VarType::MeasurementSeparator); measurements.insert(separators); @@ -601,7 +601,7 @@ auto VContainer::DataIncrements() const -> const QMap const QMap> { QMap> increments = DataVar(VarType::Increment); - QMap> separators = DataVar(VarType::IncrementSeparator); + QMap> const separators = DataVar(VarType::IncrementSeparator); increments.insert(separators); @@ -648,7 +648,7 @@ auto VContainer::DataAnglesCurves() const -> const QMap const QMap> { QMap> externalAreas = DataVar(VarType::PieceExternalArea); - QMap> seamLineAreas = DataVar(VarType::PieceSeamLineArea); + QMap> const seamLineAreas = DataVar(VarType::PieceSeamLineArea); externalAreas.insert(seamLineAreas); @@ -717,7 +717,7 @@ template auto VContainer::DataVar(const VarType &type) const -> con { if (i.value()->GetType() == type) { - QSharedPointer var = GetVariable(i.key()); + QSharedPointer const var = GetVariable(i.key()); map.insert(d->trVars->VarToUser(i.key()), var); } } diff --git a/src/libs/vpatterndb/vformula.cpp b/src/libs/vpatterndb/vformula.cpp index a594cf926..62af88541 100644 --- a/src/libs/vpatterndb/vformula.cpp +++ b/src/libs/vpatterndb/vformula.cpp @@ -238,7 +238,7 @@ void VFormula::Eval() { try { - QScopedPointer cal(new Calculator()); + QScopedPointer const cal(new Calculator()); result = cal->EvalFormula(d->data->DataVariables(), d->formula); } catch (qmu::QmuParserError &e) diff --git a/src/libs/vpatterndb/vpassmark.cpp b/src/libs/vpatterndb/vpassmark.cpp index 3db45d2a4..340f27e8f 100644 --- a/src/libs/vpatterndb/vpassmark.cpp +++ b/src/libs/vpatterndb/vpassmark.cpp @@ -82,7 +82,7 @@ auto PointsToSegments(const QVector &points) -> QVector lines.reserve(points.size() - 1); for (int i = 0; i < points.size() - 1; ++i) { - QLineF segment = QLineF(points.at(i), points.at(i + 1)); + QLineF const segment = QLineF(points.at(i), points.at(i + 1)); if (segment.length() > 0) { lines.append(segment); @@ -713,7 +713,7 @@ auto VPassmark::FindIntersection(const QLineF &line, const QVector &sea { QLineF testLine = line; testLine.setLength(testLine.length() * 10); - QVector intersections = VAbstractCurve::CurveIntersectLine(seamAllowance, testLine); + QVector const intersections = VAbstractCurve::CurveIntersectLine(seamAllowance, testLine); if (not intersections.isEmpty()) { return {line.p1(), intersections.constLast()}; @@ -953,7 +953,7 @@ auto VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const -> QVector< } QLineF edge1 = QLineF(m_data.passmarkSAPoint, m_data.previousSAPoint); - QLineF edge2 = QLineF(m_data.passmarkSAPoint, m_data.nextSAPoint); + QLineF const edge2 = QLineF(m_data.passmarkSAPoint, m_data.nextSAPoint); edge1.setAngle(edge1.angle() + edge1.angleTo(edge2) / 2.); edge1.setLength(length); diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp index 0b1050863..232172dd5 100644 --- a/src/libs/vpatterndb/vpiece.cpp +++ b/src/libs/vpatterndb/vpiece.cpp @@ -264,7 +264,7 @@ auto VPiece::CuttingPathPoints(const VContainer *data) const -> QVector //--------------------------------------------------------------------------------------------------------------------- auto VPiece::PassmarksLines(const VContainer *data) const -> QVector { - QVector passmarks = Passmarks(data); + QVector const passmarks = Passmarks(data); QVector lines; for (auto &passmark : passmarks) { @@ -393,7 +393,7 @@ auto VPiece::PlaceLabelPath(const VContainer *data) const -> QPainterPath const auto label = data->GeometricObject(placeLabel); if (label->IsVisible()) { - VLayoutPlaceLabel layoutLabel(*label); + VLayoutPlaceLabel const layoutLabel(*label); path.addPath(LabelShapePath(layoutLabel)); const QLineF mirrorLine = SeamMirrorLine(data); @@ -1128,7 +1128,7 @@ auto VPiece::GetPassmarkPreviousSAPoints(const QVector &path, vsizet do { const VSAPoint previous = points.at(nodeIndex); - QLineF line(passmarkSAPoint, previous); + QLineF const line(passmarkSAPoint, previous); if (line.length() > accuracyPointOnLine) { point = previous; @@ -1168,7 +1168,7 @@ auto VPiece::GetPassmarkNextSAPoints(const QVector &path, vsizetype do { const VSAPoint next = points.at(nodeIndex); - QLineF line(passmarkSAPoint, next); + QLineF const line(passmarkSAPoint, next); if (line.length() >= ToPixel(1, Unit::Mm)) { point = next; @@ -1349,7 +1349,8 @@ auto VPiece::Area(const QVector &shape, const VContainer *data) const - //--------------------------------------------------------------------------------------------------------------------- auto VPiece::GlobalPassmarkLength(const VContainer *data) const -> qreal { - QString passmarkLengthVariable = VAbstractValApplication::VApp()->getCurrentDocument()->GetPassmarkLengthVariable(); + QString const passmarkLengthVariable = + VAbstractValApplication::VApp()->getCurrentDocument()->GetPassmarkLengthVariable(); if (passmarkLengthVariable.isEmpty()) { return 0; @@ -1359,7 +1360,7 @@ auto VPiece::GlobalPassmarkLength(const VContainer *data) const -> qreal try { - QSharedPointer var = data->GetVariable(passmarkLengthVariable); + QSharedPointer const var = data->GetVariable(passmarkLengthVariable); length = *var->GetValue(); if (VAbstractValApplication::VApp()->toPixel(length) <= accuracyPointOnLine) @@ -1383,7 +1384,8 @@ auto VPiece::GlobalPassmarkLength(const VContainer *data) const -> qreal //--------------------------------------------------------------------------------------------------------------------- qreal VPiece::GlobalPassmarkWidth(const VContainer *data) const { - QString passmarkWidthVariable = VAbstractValApplication::VApp()->getCurrentDocument()->GetPassmarkWidthVariable(); + QString const passmarkWidthVariable = + VAbstractValApplication::VApp()->getCurrentDocument()->GetPassmarkWidthVariable(); if (passmarkWidthVariable.isEmpty()) { return 0; @@ -1393,7 +1395,7 @@ qreal VPiece::GlobalPassmarkWidth(const VContainer *data) const try { - QSharedPointer var = data->GetVariable(passmarkWidthVariable); + QSharedPointer const var = data->GetVariable(passmarkWidthVariable); width = *var->GetValue(); if (VAbstractValApplication::VApp()->toPixel(width) <= accuracyPointOnLine) @@ -1428,7 +1430,7 @@ auto VPiece::MainPathToJson() const -> QJsonObject QJsonArray nodesArray; for (qint32 i = 0; i < d->m_path.CountNodes(); ++i) { - QJsonObject nodeObject{ + QJsonObject const nodeObject{ {"id", static_cast(d->m_path.at(i).GetId())}, {"type", static_cast(d->m_path.at(i).GetTypeTool())}, {"reverse", d->m_path.at(i).GetReverse()}, @@ -1482,11 +1484,11 @@ void VPiece::DumpPiece(const VPiece &piece, const VContainer *data, const QStrin {"piece", piece.MainPathToJson()}, }; - QJsonObject json{ + QJsonObject const json{ {"testCase", testCase}, }; - QJsonDocument document(json); + QJsonDocument const document(json); QTextStream out(&temp); out << document.toJson(); diff --git a/src/libs/vpatterndb/vpiecenode_p.h b/src/libs/vpatterndb/vpiecenode_p.h index d374efed4..8cacbc771 100644 --- a/src/libs/vpatterndb/vpiecenode_p.h +++ b/src/libs/vpatterndb/vpiecenode_p.h @@ -139,10 +139,10 @@ inline auto operator>>(QDataStream &in, VPieceNodeData &p) -> QDataStream & if (actualStreamHeader != VPieceNodeData::streamHeader) { - QString message = QCoreApplication::tr("VPieceNodeData prefix mismatch error: actualStreamHeader = 0x%1 " - "and streamHeader = 0x%2") - .arg(actualStreamHeader, 8, 0x10, QChar('0')) - .arg(VPieceNodeData::streamHeader, 8, 0x10, QChar('0')); + QString const message = QCoreApplication::tr("VPieceNodeData prefix mismatch error: actualStreamHeader = 0x%1 " + "and streamHeader = 0x%2") + .arg(actualStreamHeader, 8, 0x10, QChar('0')) + .arg(VPieceNodeData::streamHeader, 8, 0x10, QChar('0')); throw VException(message); } @@ -151,10 +151,10 @@ inline auto operator>>(QDataStream &in, VPieceNodeData &p) -> QDataStream & if (actualClassVersion > VPieceNodeData::classVersion) { - QString message = QCoreApplication::tr("VPieceNodeData compatibility error: actualClassVersion = %1 and " - "classVersion = %2") - .arg(actualClassVersion) - .arg(VPieceNodeData::classVersion); + QString const message = QCoreApplication::tr("VPieceNodeData compatibility error: actualClassVersion = %1 and " + "classVersion = %2") + .arg(actualClassVersion) + .arg(VPieceNodeData::classVersion); throw VException(message); } diff --git a/src/libs/vpatterndb/vpiecepath.cpp b/src/libs/vpatterndb/vpiecepath.cpp index 23b5d27c9..d5ee59844 100644 --- a/src/libs/vpatterndb/vpiecepath.cpp +++ b/src/libs/vpatterndb/vpiecepath.cpp @@ -80,7 +80,7 @@ auto CurveStartPoint(VSAPoint candidate, const VContainer *data, const VPieceNod QVector intersections; for (auto i = 0; i < curvePoints.count() - 1; ++i) { - QLineF segment(curvePoints.at(i), curvePoints.at(i + 1)); + QLineF const segment(curvePoints.at(i), curvePoints.at(i + 1)); intersections << VAbstractCurve::CurveIntersectLine(points, segment); } @@ -120,7 +120,7 @@ auto CurveEndPoint(VSAPoint candidate, const VContainer *data, const VPieceNode QVector intersections; for (auto i = 0; i < curvePoints.count() - 1; ++i) { - QLineF segment(curvePoints.at(i), curvePoints.at(i + 1)); + QLineF const segment(curvePoints.at(i), curvePoints.at(i + 1)); intersections << VAbstractCurve::CurveIntersectLine(points, segment); } @@ -571,7 +571,7 @@ auto VPiecePath::SeamAllowancePoints(const VContainer *data, qreal width, bool r //--------------------------------------------------------------------------------------------------------------------- auto VPiecePath::PainterPath(const VContainer *data, const QVector &cuttingPath) const -> QPainterPath { - QVector points = PathPoints(data, cuttingPath); + QVector const points = PathPoints(data, cuttingPath); QVector casted; CastTo(points, casted); return MakePainterPath(casted); @@ -775,7 +775,7 @@ auto VPiecePath::OnEdge(quint32 p1, quint32 p2) const -> bool qDebug() << "Not enough points."; return false; } - int i = IndexOfNode(list, p1); + int const i = IndexOfNode(list, p1); vsizetype j1 = 0, j2 = 0; if (i == list.size() - 1) @@ -821,10 +821,10 @@ auto VPiecePath::Edge(quint32 p1, quint32 p2) const -> vsizetype } const QVector list = ListNodePoint(); - int i = IndexOfNode(list, p1); - int j = IndexOfNode(list, p2); + int const i = IndexOfNode(list, p1); + int const j = IndexOfNode(list, p2); - int min = qMin(i, j); + int const min = qMin(i, j); if (min == 0 && (i == list.size() - 1 || j == list.size() - 1)) { @@ -1018,7 +1018,7 @@ auto VPiecePath::IsVisible(const QHash cal(new Calculator()); + QScopedPointer const cal(new Calculator()); const qreal result = cal->EvalFormula(vars, GetVisibilityTrigger()); if (qIsInf(result) || qIsNaN(result)) @@ -1281,7 +1281,7 @@ auto VPiecePath::NodeName(const QVector &nodes, vsizetype nodeIndex, try { - QSharedPointer obj = data->GetGObject(nodes.at(nodeIndex).GetId()); + QSharedPointer const obj = data->GetGObject(nodes.at(nodeIndex).GetId()); return obj->name(); } catch (const VExceptionBadId &) diff --git a/src/libs/vpatterndb/vtranslatevars.cpp b/src/libs/vpatterndb/vtranslatevars.cpp index 6767c8ba4..73d8bdf7f 100644 --- a/src/libs/vpatterndb/vtranslatevars.cpp +++ b/src/libs/vpatterndb/vtranslatevars.cpp @@ -759,7 +759,7 @@ auto VTranslateVars::FormulaToUser(const QString &formula, bool osSeparator) con QMap numbers; try { - QScopedPointer cal(new qmu::QmuTokenParser(formula, false, false)); // Eval formula + QScopedPointer const cal(new qmu::QmuTokenParser(formula, false, false)); // Eval formula tokens = cal->GetTokens(); // Tokens (variables, measurements) numbers = cal->GetNumbers(); // All numbers in expression for changing decimal separator } diff --git a/src/libs/vpropertyexplorer/checkablemessagebox.cpp b/src/libs/vpropertyexplorer/checkablemessagebox.cpp index 302f0b68a..a4faac88e 100644 --- a/src/libs/vpropertyexplorer/checkablemessagebox.cpp +++ b/src/libs/vpropertyexplorer/checkablemessagebox.cpp @@ -300,7 +300,7 @@ auto CheckableMessageBox::askAgain(QSettings *settings, const QString &settingsS if (settings) { settings->beginGroup(QLatin1String(kDoNotAskAgainKey)); - bool shouldNotAsk = settings->value(settingsSubKey, false).toBool(); + bool const shouldNotAsk = settings->value(settingsSubKey, false).toBool(); settings->endGroup(); if (shouldNotAsk) { diff --git a/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.cpp b/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.cpp index 897c17571..ab4d300ec 100644 --- a/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.cpp @@ -64,7 +64,7 @@ auto VPE::QVector3DProperty::data(int column, int role) const -> QVariant { if (column == DPC_Data && Qt::DisplayRole == role) { - Vector3D tmpVect = getVector(); + Vector3D const tmpVect = getVector(); return u"(%1, %2, %3)"_s.arg(QString::number(tmpVect.X), QString::number(tmpVect.Y), QString::number(tmpVect.Z)); } @@ -165,6 +165,6 @@ void VPE::QVector3DProperty::setValue(const QVariant &value) auto VPE::QVector3DProperty::getValue() const -> QVariant { - Vector3D tmpVect = getVector(); + Vector3D const tmpVect = getVector(); return u"%1,%2,%3"_s.arg(QString::number(tmpVect.X), QString::number(tmpVect.Y), QString::number(tmpVect.Z)); } diff --git a/src/libs/vpropertyexplorer/plugins/vfileproperty.cpp b/src/libs/vpropertyexplorer/plugins/vfileproperty.cpp index 3ded7d82b..226af5c2c 100644 --- a/src/libs/vpropertyexplorer/plugins/vfileproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vfileproperty.cpp @@ -72,7 +72,7 @@ auto VPE::VFileProperty::data(int column, int role) const -> QVariant { if (column == DPC_Data && (Qt::DisplayRole == role || Qt::EditRole == role)) { - QFileInfo tmpFile(d_ptr->VariantValue.toString()); + QFileInfo const tmpFile(d_ptr->VariantValue.toString()); return tmpFile.fileName(); } else diff --git a/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp b/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp index 44f61c2e0..da17efcdd 100644 --- a/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp +++ b/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp @@ -111,7 +111,7 @@ auto VPE::VFileEditWidget::getFile() const -> QString void VPE::VFileEditWidget::onToolButtonClicked() { - QString filepath = + QString const filepath = (Directory ? QFileDialog::getExistingDirectory(nullptr, tr("Directory"), CurrentFilePath, QFileDialog::ShowDirsOnly #ifdef Q_OS_LINUX @@ -213,7 +213,7 @@ auto VPE::VFileEditWidget::checkMimeData(const QMimeData *data, QString &file) c { if (data->hasUrls()) { - QList tmpUrlList = data->urls(); + QList const tmpUrlList = data->urls(); QFileInfo tmpFileInfo; auto tmpUrl = std::find_if(tmpUrlList.cbegin(), tmpUrlList.cend(), @@ -241,7 +241,7 @@ auto VPE::VFileEditWidget::checkFileFilter(const QString &file) const -> bool return true; } - QFileInfo tmpFileInfo(file); + QFileInfo const tmpFileInfo(file); if ((Directory && !tmpFileInfo.isDir()) || (!Directory && !tmpFileInfo.isFile())) { @@ -252,8 +252,8 @@ auto VPE::VFileEditWidget::checkFileFilter(const QString &file) const -> bool [file](const QString &tmpFilter) { const QString wildcardFilter = QRegularExpression::wildcardToRegularExpression(tmpFilter); - QRegularExpression tmpRegExpFilter(QRegularExpression::anchoredPattern(wildcardFilter), - QRegularExpression::CaseInsensitiveOption); + QRegularExpression const tmpRegExpFilter(QRegularExpression::anchoredPattern(wildcardFilter), + QRegularExpression::CaseInsensitiveOption); return tmpRegExpFilter.match(file).hasMatch(); }); } diff --git a/src/libs/vpropertyexplorer/plugins/vlinecolorproperty.cpp b/src/libs/vpropertyexplorer/plugins/vlinecolorproperty.cpp index 550752c46..ed8b0a900 100644 --- a/src/libs/vpropertyexplorer/plugins/vlinecolorproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vlinecolorproperty.cpp @@ -92,7 +92,7 @@ auto VPE::VLineColorProperty::createEditor(QWidget *parent, const QStyleOptionVi auto *tmpEditor = new QComboBox(parent); tmpEditor->setPalette(parent->palette()); - int size = tmpEditor->iconSize().height(); + int const size = tmpEditor->iconSize().height(); // On Mac pixmap should be little bit smaller. #if defined(Q_OS_MAC) size -= 2; // Two pixels should be enough. diff --git a/src/libs/vpropertyexplorer/plugins/vobjectproperty.cpp b/src/libs/vpropertyexplorer/plugins/vobjectproperty.cpp index 0f89c1c25..c3d999fce 100644 --- a/src/libs/vpropertyexplorer/plugins/vobjectproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vobjectproperty.cpp @@ -94,7 +94,7 @@ auto VPE::VObjectProperty::setEditorData(QWidget *editor) -> bool QComboBox* tmpEditor = qobject_cast(editor); if (tmpEditor) { - quint32 objId = VProperty::d_ptr->VariantValue.toUInt(); + quint32 const objId = VProperty::d_ptr->VariantValue.toUInt(); qint32 tmpIndex = tmpEditor->findData(objId); if (tmpIndex == -1) diff --git a/src/libs/vpropertyexplorer/plugins/vpointfproperty.cpp b/src/libs/vpropertyexplorer/plugins/vpointfproperty.cpp index 3e6af03f3..22d036c57 100644 --- a/src/libs/vpropertyexplorer/plugins/vpointfproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vpointfproperty.cpp @@ -143,12 +143,12 @@ auto VPE::VPointFProperty::clone(bool include_children, VProperty *container) co void VPE::VPointFProperty::setValue(const QVariant &value) { - QPointF tmpPoint = value.toPointF(); + QPointF const tmpPoint = value.toPointF(); setPointF(tmpPoint); } auto VPE::VPointFProperty::getValue() const -> QVariant { - QPointF tmpValue = getPointF(); + QPointF const tmpValue = getPointF(); return QString("%1,%2").arg(QString::number(tmpValue.x()), QString::number(tmpValue.y())); } diff --git a/src/libs/vpropertyexplorer/vproperty.cpp b/src/libs/vpropertyexplorer/vproperty.cpp index 64e86e632..fec2fabd5 100644 --- a/src/libs/vpropertyexplorer/vproperty.cpp +++ b/src/libs/vpropertyexplorer/vproperty.cpp @@ -137,7 +137,7 @@ auto VPE::VProperty::setEditorData(QWidget *editor) -> bool return false; } - QByteArray n = editor->metaObject()->userProperty().name(); + QByteArray const n = editor->metaObject()->userProperty().name(); if (!n.isEmpty()) { @@ -158,7 +158,7 @@ auto VPE::VProperty::getEditorData(const QWidget *editor) const -> QVariant return QVariant(); } - QByteArray n = editor->metaObject()->userProperty().name(); + QByteArray const n = editor->metaObject()->userProperty().name(); if (!n.isEmpty()) { diff --git a/src/libs/vpropertyexplorer/vpropertydelegate.cpp b/src/libs/vpropertyexplorer/vpropertydelegate.cpp index 820486b12..8212ac549 100644 --- a/src/libs/vpropertyexplorer/vpropertydelegate.cpp +++ b/src/libs/vpropertyexplorer/vpropertydelegate.cpp @@ -124,9 +124,10 @@ void VPE::VPropertyDelegate::paint(QPainter* painter, const QStyleOptionViewItem QStyledItemDelegate::paint(painter, option, index); } - QColor tmpPenColor = static_cast(QApplication::style()->styleHint(QStyle::SH_Table_GridLineColor, &option)); + QColor const tmpPenColor = + static_cast(QApplication::style()->styleHint(QStyle::SH_Table_GridLineColor, &option)); - QPen tmpOldPen = painter->pen(); + QPen const tmpOldPen = painter->pen(); painter->setPen(QPen(tmpPenColor)); painter->drawLine(option.rect.right(), option.rect.y(), option.rect.right(), option.rect.bottom()); painter->drawLine(option.rect.x(), option.rect.bottom(), option.rect.right(), option.rect.bottom()); diff --git a/src/libs/vpropertyexplorer/vpropertyformwidget.cpp b/src/libs/vpropertyexplorer/vpropertyformwidget.cpp index 93a285eeb..ad895b482 100644 --- a/src/libs/vpropertyexplorer/vpropertyformwidget.cpp +++ b/src/libs/vpropertyexplorer/vpropertyformwidget.cpp @@ -183,7 +183,7 @@ void VPE::VPropertyFormWidget::buildEditor(VProperty *property, QFormLayout *for // add new row if (type == Property::Complex) { - QString name = "" + property->getName() + ""; + QString const name = "" + property->getName() + ""; formLayout->addRow(name, tmpEditor); } else @@ -225,8 +225,8 @@ void VPE::VPropertyFormWidget::commitData(int row) } else if (tmpEditorWidget.Editor && tmpProperty) { - QVariant newValue = tmpProperty->getEditorData(tmpEditorWidget.Editor); - QVariant oldValue = tmpProperty->data(VProperty::DPC_Data, Qt::EditRole); + QVariant const newValue = tmpProperty->getEditorData(tmpEditorWidget.Editor); + QVariant const oldValue = tmpProperty->data(VProperty::DPC_Data, Qt::EditRole); if (oldValue != newValue) { VProperty *parent = tmpProperty->getParent(); @@ -378,7 +378,7 @@ void VPE::VPropertyFormWidget::commitData(const QWidget *editor) for (int i = 0; i < d_ptr->EditorWidgets.count(); ++i) { - VPropertyFormWidgetPrivate::SEditorWidget &tmpEditorWidget = d_ptr->EditorWidgets[i]; + VPropertyFormWidgetPrivate::SEditorWidget const &tmpEditorWidget = d_ptr->EditorWidgets[i]; if (tmpEditorWidget.Editor == editor) { commitData(i); diff --git a/src/libs/vpropertyexplorer/vpropertymodel.cpp b/src/libs/vpropertyexplorer/vpropertymodel.cpp index f0e88bfd3..c8d61c058 100644 --- a/src/libs/vpropertyexplorer/vpropertymodel.cpp +++ b/src/libs/vpropertyexplorer/vpropertymodel.cpp @@ -62,8 +62,8 @@ auto VPE::VPropertyModel::addProperty(VProperty *property, const QString &id, co if (emitsignals) { VProperty* tmpParent = getProperty(parentid); - vpesizetype tmpRow = tmpParent != nullptr ? tmpParent->getRowCount() - : d_ptr->Properties->getRootPropertyCount(); + vpesizetype const tmpRow = + tmpParent != nullptr ? tmpParent->getRowCount() : d_ptr->Properties->getRootPropertyCount(); beginInsertRows((tmpParent != nullptr ? getIndexFromProperty(tmpParent) : QModelIndex()), static_cast(tmpRow), static_cast(tmpRow)); } @@ -143,9 +143,9 @@ auto VPE::VPropertyModel::parent(const QModelIndex &index) const -> QModelIndex if (parentItem) { VProperty* grandParentItem = parentItem->getParent(); - vpesizetype parents_row = - grandParentItem != nullptr ? grandParentItem->getChildRow(parentItem) - : d_ptr->Properties->getRootProperties().indexOf(parentItem); + vpesizetype const parents_row = grandParentItem != nullptr + ? grandParentItem->getChildRow(parentItem) + : d_ptr->Properties->getRootProperties().indexOf(parentItem); if (parents_row >= 0) { @@ -175,10 +175,10 @@ auto VPE::VPropertyModel::setData(const QModelIndex &index, const QVariant &valu VProperty* tmpProperty = getProperty(index); if (index.column() == 1 && tmpProperty) { - bool tmpHasChanged = tmpProperty->setData(value, role); + bool const tmpHasChanged = tmpProperty->setData(value, role); if (tmpProperty->getUpdateParent() && tmpHasChanged) { // If neccessary, update the parent as well - QModelIndex tmpParentIndex = parent(index); + QModelIndex const tmpParentIndex = parent(index); emit dataChanged(tmpParentIndex, tmpParentIndex); } @@ -299,7 +299,7 @@ auto VPE::VPropertyModel::getIndexFromProperty(VProperty *property, int column) void VPE::VPropertyModel::onDataChangedByModel(VProperty* property) { - QModelIndex tmpIndex = getIndexFromProperty(property, 1); + QModelIndex const tmpIndex = getIndexFromProperty(property, 1); if (tmpIndex.isValid()) { emit dataChanged(tmpIndex, tmpIndex); @@ -342,7 +342,7 @@ void VPE::VPropertyModel::setPropertySet(VPropertySet *property_set, bool emit_s auto VPE::VPropertyModel::takeProperty(const QString &id) -> VPE::VProperty * { - QModelIndex tmpIndex = getIndexFromProperty(getProperty(id)); + QModelIndex const tmpIndex = getIndexFromProperty(getProperty(id)); if (d_ptr->Properties && tmpIndex.isValid()) { beginRemoveRows(tmpIndex.parent(), tmpIndex.row(), tmpIndex.row()); @@ -356,7 +356,7 @@ auto VPE::VPropertyModel::takeProperty(const QString &id) -> VPE::VProperty * void VPE::VPropertyModel::removeProperty(const QString &id) { - QModelIndex tmpIndex = getIndexFromProperty(getProperty(id)); + QModelIndex const tmpIndex = getIndexFromProperty(getProperty(id)); if (d_ptr->Properties && tmpIndex.isValid()) { beginRemoveRows(tmpIndex.parent(), tmpIndex.row(), tmpIndex.row()); diff --git a/src/libs/vpropertyexplorer/vpropertyset.cpp b/src/libs/vpropertyexplorer/vpropertyset.cpp index 34b21d76e..b6fc8b904 100644 --- a/src/libs/vpropertyexplorer/vpropertyset.cpp +++ b/src/libs/vpropertyexplorer/vpropertyset.cpp @@ -64,7 +64,7 @@ auto VPE::VPropertySet::addProperty(VProperty *property, const QString &id, VPro return false; } - QString tmpOldID = getPropertyID(property); + QString const tmpOldID = getPropertyID(property); if (!tmpOldID.isEmpty()) { d_ptr->Properties.remove(tmpOldID); @@ -235,7 +235,7 @@ void VPE::VPropertySet::cloneProperty(VProperty* property_to_clone, VProperty *p return; } - QString tmpID = getPropertyID(property_to_clone, false); + QString const tmpID = getPropertyID(property_to_clone, false); // We want to clone the children ourselves (because of the IDs) VProperty* tmpNewProperty = property_to_clone->clone(false); diff --git a/src/libs/vpropertyexplorer/vserializedproperty.cpp b/src/libs/vpropertyexplorer/vserializedproperty.cpp index cd59e9411..4073bccb3 100644 --- a/src/libs/vpropertyexplorer/vserializedproperty.cpp +++ b/src/libs/vpropertyexplorer/vserializedproperty.cpp @@ -63,7 +63,7 @@ void VPE::VSerializedProperty::initChildren(const VProperty *property, const VPr const QList& tmpChildren = property->getChildren(); for (auto *tmpChild : tmpChildren) { - QString tmpChildID = set->getPropertyID(property); + QString const tmpChildID = set->getPropertyID(property); Children.append(VSerializedProperty(tmpChild, tmpChildID, set)); } } diff --git a/src/libs/vtest/abstracttest.cpp b/src/libs/vtest/abstracttest.cpp index 383267ada..a669eec48 100644 --- a/src/libs/vtest/abstracttest.cpp +++ b/src/libs/vtest/abstracttest.cpp @@ -73,7 +73,7 @@ auto FillPath(const QVector &path, qreal accuracy) -> QVector { pathFilled.append(path.at(i)); - QLineF line(path.at(i), path.at(i + 1)); + QLineF const line(path.at(i), path.at(i + 1)); if (line.length() > accuracy) { qreal len = accuracy; @@ -104,7 +104,7 @@ void AbstractTest::PieceFromJson(const QString &json, VPiece &piece, QSharedPoin { QByteArray saveData; PrepareDocument(json, saveData); - QJsonDocument loadDoc(QJsonDocument::fromJson(saveData)); + QJsonDocument const loadDoc(QJsonDocument::fromJson(saveData)); const QString testCaseKey = QStringLiteral("testCase"); const QString bdKey = QStringLiteral("bd"); @@ -141,7 +141,7 @@ void AbstractTest::PassmarkDataFromJson(const QString &json, VPiecePassmarkData { QByteArray saveData; PrepareDocument(json, saveData); - QJsonDocument loadDoc(QJsonDocument::fromJson(saveData)); + QJsonDocument const loadDoc(QJsonDocument::fromJson(saveData)); const QString dataKey = QStringLiteral("data"); @@ -224,7 +224,7 @@ void AbstractTest::PassmarkShapeFromJson(const QString &json, QVector &s { QByteArray saveData; PrepareDocument(json, saveData); - QJsonDocument loadDoc(QJsonDocument::fromJson(saveData)); + QJsonDocument const loadDoc(QJsonDocument::fromJson(saveData)); const QString shapeKey = QStringLiteral("shape"); const QString typeKey = QStringLiteral("type"); @@ -232,7 +232,7 @@ void AbstractTest::PassmarkShapeFromJson(const QString &json, QVector &s QJsonObject shapeObject = loadDoc.object(); TestRoot(shapeObject, shapeKey, json); - QJsonArray vectorArray = shapeObject[shapeKey].toArray(); + QJsonArray const vectorArray = shapeObject[shapeKey].toArray(); for (auto item : vectorArray) { QJsonObject lineObject = item.toObject(); @@ -393,10 +393,10 @@ auto AbstractTest::TranslationsPath() -> QString //--------------------------------------------------------------------------------------------------------------------- auto AbstractTest::RunTimeout(int defMsecs) -> int { - QString timeout = qEnvironmentVariable("VTEST_RUN_TIMEOUT", QString::number(defMsecs)); + QString const timeout = qEnvironmentVariable("VTEST_RUN_TIMEOUT", QString::number(defMsecs)); bool ok = false; - int msecs = timeout.toInt(&ok); + int const msecs = timeout.toInt(&ok); return ok ? msecs : defMsecs; } @@ -408,14 +408,14 @@ auto AbstractTest::Run(int exit, const QString &program, const QStringList &argu const QString parameters = QStringLiteral("Program: %1 \nArguments: %2.").arg(program, arguments.join(QStringLiteral(", "))); - QFileInfo info(program); + QFileInfo const info(program); if (not info.exists()) { error = QStringLiteral("Can't find binary.\n%1").arg(parameters); return TST_EX_BIN; } - QScopedPointer process(new QProcess()); + QScopedPointer const process(new QProcess()); process->setWorkingDirectory(info.absoluteDir().absolutePath()); process->start(program, arguments); @@ -455,7 +455,7 @@ auto AbstractTest::Run(int exit, const QString &program, const QStringList &argu //--------------------------------------------------------------------------------------------------------------------- auto AbstractTest::CopyRecursively(const QString &srcFilePath, const QString &tgtFilePath) const -> bool { - QFileInfo srcFileInfo(srcFilePath); + QFileInfo const srcFileInfo(srcFilePath); if (srcFileInfo.isDir()) { QDir targetDir(tgtFilePath); @@ -466,7 +466,7 @@ auto AbstractTest::CopyRecursively(const QString &srcFilePath, const QString &tg qWarning("Can't create dir '%s'.", qUtf8Printable(dirName)); return false; } - QDir sourceDir(srcFilePath); + QDir const sourceDir(srcFilePath); const QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System); for (auto &fileName : fileNames) @@ -545,7 +545,7 @@ void AbstractTest::ReadStringValue(const QJsonObject &itemObject, const QString { if (itemObject.contains(attribute)) { - QJsonValue attributeValue = itemObject[attribute]; + QJsonValue const attributeValue = itemObject[attribute]; if (attributeValue.isString()) { value = attributeValue.toString(); @@ -576,7 +576,7 @@ void AbstractTest::ReadBooleanValue(const QJsonObject &itemObject, const QString { if (itemObject.contains(attribute)) { - QJsonValue attributeValue = itemObject[attribute]; + QJsonValue const attributeValue = itemObject[attribute]; if (attributeValue.isBool()) { value = attributeValue.toBool(); @@ -593,7 +593,7 @@ void AbstractTest::ReadBooleanValue(const QJsonObject &itemObject, const QString if (not defaultValue.isEmpty()) { bool ok = false; - int defVal = defaultValue.toInt(&ok); + int const defVal = defaultValue.toInt(&ok); if (not ok) { @@ -635,7 +635,7 @@ void AbstractTest::ReadSplinePointValues(const QJsonObject &itemObject, const QS QJsonArray nodes = itemObject[attribute].toArray(); for (int i = 0; i < nodes.size(); ++i) { - QJsonObject item = nodes[i].toObject(); + QJsonObject const item = nodes[i].toObject(); VSplinePoint point; ReadSplinePointValue(item, point); points.append(point); @@ -704,7 +704,7 @@ void AbstractTest::ReadDoubleValue(const QJsonObject &itemObject, const QString { if (itemObject.contains(attribute)) { - QJsonValue attributeValue = itemObject[attribute]; + QJsonValue const attributeValue = itemObject[attribute]; if (attributeValue.isDouble()) { value = static_cast(attributeValue.toDouble()); @@ -743,7 +743,7 @@ void AbstractTest::ReadDoubleValue(const QJsonObject &itemObject, const QString { if (itemObject.contains(attribute)) { - QJsonValue attributeValue = itemObject[attribute]; + QJsonValue const attributeValue = itemObject[attribute]; if (attributeValue.isDouble()) { value = static_cast(static_cast(attributeValue.toDouble())); @@ -782,7 +782,7 @@ void AbstractTest::ReadDoubleValue(const QJsonObject &itemObject, const QString { if (itemObject.contains(attribute)) { - QJsonValue attributeValue = itemObject[attribute]; + QJsonValue const attributeValue = itemObject[attribute]; if (attributeValue.isDouble()) { value = static_cast(attributeValue.toDouble()); @@ -899,10 +899,10 @@ void AbstractTest::DBFromJson(const QJsonObject &dbObject, QSharedPointer inline auto AbstractTest::VectorFromJson(const QString &json) { QByteArray saveData; PrepareDocument(json, saveData); - QJsonDocument loadDoc(QJsonDocument::fromJson(saveData)); + QJsonDocument const loadDoc(QJsonDocument::fromJson(saveData)); const QString vectorKey = QStringLiteral("vector"); QJsonObject vectorObject = loadDoc.object(); TestRoot(vectorObject, vectorKey, json); - QJsonArray vectorArray = vectorObject[vectorKey].toArray(); + QJsonArray const vectorArray = vectorObject[vectorKey].toArray(); QVector vector; vector.reserve(vectorArray.size()); diff --git a/src/libs/vtools/dialogs/dialogtoolbox.cpp b/src/libs/vtools/dialogs/dialogtoolbox.cpp index 980f8b10f..a25fd25f3 100644 --- a/src/libs/vtools/dialogs/dialogtoolbox.cpp +++ b/src/libs/vtools/dialogs/dialogtoolbox.cpp @@ -113,7 +113,7 @@ auto DoublePoint(const VPieceNode &firstNode, const VPieceNode &secondNode, cons return false; } - bool sameCoordinates = VFuzzyComparePoints(firstPoint->toQPointF(), secondPoint->toQPointF()); + bool const sameCoordinates = VFuzzyComparePoints(firstPoint->toQPointF(), secondPoint->toQPointF()); if (sameCoordinates) { error = QObject::tr("Points '%1' and '%2' have the same coordinates.") @@ -288,9 +288,9 @@ auto EvalToolFormula(QDialog *dialog, const FormulaData &data, bool &flag) -> qr try { // Translate to internal look. - QString formula = VAbstractApplication::VApp()->TrVars()->FormulaFromUser( + QString const formula = VAbstractApplication::VApp()->TrVars()->FormulaFromUser( data.formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator()); - QScopedPointer cal(new Calculator()); + QScopedPointer const cal(new Calculator()); result = cal->EvalFormula(data.variables, formula); if (qIsInf(result) || qIsNaN(result)) @@ -370,7 +370,7 @@ void CheckPointLabel(QDialog *dialog, QLineEdit *edit, QLabel *labelEditNamePoin SCASSERT(labelEditNamePoint != nullptr) const QString name = edit->text(); - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); if (name.isEmpty() || (pointName != name && not data->IsUnique(name)) || not rx.match(name).hasMatch()) { flag = false; @@ -915,7 +915,7 @@ auto InvalidSegment(QListWidget *listWidget, const VContainer *data, QString &er error = QObject::tr("Point '%1' does not lie on a curve '%2'").arg(point->name(), curve1->name()); - bool validSegment = curve1->IsPointOnCurve(point->toQPointF()); + bool const validSegment = curve1->IsPointOnCurve(point->toQPointF()); if (not validSegment) { return true; diff --git a/src/libs/vtools/dialogs/support/dialogeditlabel.cpp b/src/libs/vtools/dialogs/support/dialogeditlabel.cpp index ba30d16d2..6e47c4f4e 100644 --- a/src/libs/vtools/dialogs/support/dialogeditlabel.cpp +++ b/src/libs/vtools/dialogs/support/dialogeditlabel.cpp @@ -59,9 +59,9 @@ namespace auto FileBaseName(const QString &filePath) -> QString { // Known suffixes to check for - QStringList knownSuffixes = {".val", ".vst", ".vit"}; + QStringList const knownSuffixes = {".val", ".vst", ".vit"}; - QFileInfo fileInfo(filePath); + QFileInfo const fileInfo(filePath); // Check if the file has one of the known suffixes for (const QString &suffix : knownSuffixes) @@ -332,7 +332,7 @@ void DialogEditLabel::ExportTemplate() { VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings(); - QString filters(tr("Label template") + "(*.xml)"_L1); + QString const filters(tr("Label template") + "(*.xml)"_L1); const QString path = settings->GetPathLabelTemplate(); QString fileName = @@ -344,7 +344,7 @@ void DialogEditLabel::ExportTemplate() return; } - QFileInfo f(fileName); + QFileInfo const f(fileName); if (f.suffix().isEmpty() && f.suffix() != "xml"_L1) { fileName += ".xml"_L1; @@ -386,7 +386,7 @@ void DialogEditLabel::ImportTemplate() } } - QString filter(tr("Label template") + " (*.xml)"_L1); + QString const filter(tr("Label template") + " (*.xml)"_L1); // Use standard path to label templates const QString path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathLabelTemplate(); const QString fileName = QFileDialog::getOpenFileName(this, tr("Import template"), path, filter, nullptr, @@ -507,7 +507,7 @@ void DialogEditLabel::SetupControls() auto DialogEditLabel::SortedActions() const -> QMap { QMap sortedActions; - QChar per('%'); + QChar const per('%'); auto i = m_placeholders.constBegin(); while (i != m_placeholders.constEnd()) { @@ -520,7 +520,7 @@ auto DialogEditLabel::SortedActions() const -> QMap //--------------------------------------------------------------------------------------------------------------------- void DialogEditLabel::InitPlaceholdersMenu() { - QMap sortedActions = SortedActions(); + QMap const sortedActions = SortedActions(); auto i = sortedActions.constBegin(); while (i != sortedActions.constEnd()) { @@ -536,7 +536,7 @@ void DialogEditLabel::InitPlaceholdersMenu() void DialogEditLabel::InitPlaceholders() { // Pattern tags - QLocale locale(VAbstractApplication::VApp()->Settings()->GetLocale()); + QLocale const locale(VAbstractApplication::VApp()->Settings()->GetLocale()); const QString date = locale.toString(QDate::currentDate(), m_doc->GetLabelDateFormat()); m_placeholders.insert(pl_date, qMakePair(tr("Date"), date)); @@ -585,19 +585,19 @@ void DialogEditLabel::InitPlaceholders() FileBaseName(VAbstractValApplication::VApp()->GetPatternPath()))); m_placeholders.insert(pl_mFileName, qMakePair(tr("Measurements file name"), FileBaseName(m_doc->MPath()))); - QString heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight()); + QString const heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight()); m_placeholders.insert(pl_height, qMakePair(tr("Height", "dimension"), heightValue)); m_placeholders.insert(pl_dimensionX, qMakePair(tr("Dimension X", "dimension"), heightValue)); - QString sizeValue = QString::number(VAbstractValApplication::VApp()->GetDimensionSize()); + QString const sizeValue = QString::number(VAbstractValApplication::VApp()->GetDimensionSize()); m_placeholders.insert(pl_size, qMakePair(tr("Size", "dimension"), sizeValue)); m_placeholders.insert(pl_dimensionY, qMakePair(tr("Dimension Y", "dimension"), sizeValue)); - QString hipValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHip()); + QString const hipValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHip()); m_placeholders.insert(pl_hip, qMakePair(tr("Hip", "dimension"), hipValue)); m_placeholders.insert(pl_dimensionZ, qMakePair(tr("Dimension Z", "dimension"), hipValue)); - QString waistValue = QString::number(VAbstractValApplication::VApp()->GetDimensionWaist()); + QString const waistValue = QString::number(VAbstractValApplication::VApp()->GetDimensionWaist()); m_placeholders.insert(pl_waist, qMakePair(tr("Waist", "dimension"), waistValue)); m_placeholders.insert(pl_dimensionW, qMakePair(tr("Dimension W", "dimension"), waistValue)); @@ -659,7 +659,7 @@ void DialogEditLabel::InitPlaceholders() auto i = measurements.constBegin(); while (i != measurements.constEnd()) { - QString description = i.value()->GetGuiText().isEmpty() ? i.key() : i.value()->GetGuiText(); + QString const description = i.value()->GetGuiText().isEmpty() ? i.key() : i.value()->GetGuiText(); m_placeholders.insert(pl_measurement + i.key(), qMakePair(tr("Measurement: %1").arg(description), QString::number(*i.value()->GetValue()))); ++i; @@ -680,7 +680,7 @@ void DialogEditLabel::InitPlaceholders() try { - QScopedPointer cal(new Calculator()); + QScopedPointer const cal(new Calculator()); const qreal result = cal->EvalFormula(completeData.DataVariables(), m.formula); m_placeholders.insert(pl_finalMeasurement + m.name, @@ -699,7 +699,7 @@ void DialogEditLabel::InitPlaceholders() } } - QSharedPointer phTr = VAbstractApplication::VApp()->GetPlaceholderTranslator(); + QSharedPointer const phTr = VAbstractApplication::VApp()->GetPlaceholderTranslator(); // Piece tags m_placeholders.insert(pl_pLetter, qMakePair(tr("Piece letter"), QString())); @@ -723,7 +723,7 @@ void DialogEditLabel::InitPlaceholders() //--------------------------------------------------------------------------------------------------------------------- auto DialogEditLabel::ReplacePlaceholders(QString line) const -> QString { - QChar per('%'); + QChar const per('%'); auto TestDimension = [per, this, line](const QString &placeholder, const QString &errorMsg) { @@ -826,14 +826,14 @@ void DialogEditLabel::SetPiece(const VPiece &piece) m_placeholders[pl_pQuantity].second = QString::number(pieceData.GetQuantity()); if (pieceData.IsOnFold()) { - QSharedPointer phTr = VAbstractApplication::VApp()->GetPlaceholderTranslator(); + QSharedPointer const phTr = VAbstractApplication::VApp()->GetPlaceholderTranslator(); m_placeholders[pl_wOnFold].second = phTr->translate("Placeholder", "on fold"); } VContainer completeData = m_doc->GetCompleteData(); completeData.FillPiecesAreas(VAbstractValApplication::VApp()->patternUnits()); - QScopedPointer cal(new Calculator()); + QScopedPointer const cal(new Calculator()); try { diff --git a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp index a138a1e81..11ab38db9 100644 --- a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp +++ b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp @@ -286,7 +286,7 @@ void DialogEditWrongFormula::PutVal(QTableWidgetItem *item) QTextCursor cursor = ui->plainTextEditFormula->textCursor(); if (ui->radioButtonFunctions->isChecked()) { - QString function = valItem->data(Qt::UserRole).toString(); + QString const function = valItem->data(Qt::UserRole).toString(); const VTranslateVars *trVars = VAbstractApplication::VApp()->TrVars(); const QMap functionsArguments = trVars->GetFunctionsArguments(); cursor.insertText(valItem->text() + functionsArguments.value(function)); @@ -696,7 +696,7 @@ void DialogEditWrongFormula::ShowMeasurements(const QListsetText(QString()); if (VKnownMeasurementsDatabase *db = VAbstractApplication::VApp()->KnownMeasurementsDatabase()) { - VKnownMeasurements known = db->KnownMeasurements(var->GetKnownMeasurementsId()); + VKnownMeasurements const known = db->KnownMeasurements(var->GetKnownMeasurementsId()); if (known.IsValid()) { itemFullName->setText(known.Measurement(var->GetName()).fullName); @@ -804,7 +804,7 @@ void DialogEditWrongFormula::SetMeasurementDescription(QTableWidgetItem *item, c { if (VKnownMeasurementsDatabase *db = VAbstractApplication::VApp()->KnownMeasurementsDatabase()) { - VKnownMeasurements known = db->KnownMeasurements(stable->GetKnownMeasurementsId()); + VKnownMeasurements const known = db->KnownMeasurements(stable->GetKnownMeasurementsId()); if (known.IsValid()) { description = known.Measurement(stable->GetName()).description; @@ -828,8 +828,8 @@ void DialogEditWrongFormula::SetPieceAreaDescription(QTableWidgetItem *item, con try { - VPiece piece = m_data->GetPiece(var->GetPieceId()); - QString name = piece.GetName(); + VPiece const piece = m_data->GetPiece(var->GetPieceId()); + QString const name = piece.GetName(); if (not name.isEmpty()) { description += QStringLiteral(" '%1'").arg(piece.GetName()); diff --git a/src/libs/vtools/dialogs/support/dialogundo.cpp b/src/libs/vtools/dialogs/support/dialogundo.cpp index bdf454276..3c6fbb131 100644 --- a/src/libs/vtools/dialogs/support/dialogundo.cpp +++ b/src/libs/vtools/dialogs/support/dialogundo.cpp @@ -46,7 +46,7 @@ DialogUndo::DialogUndo(QWidget *parent) VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c()); - bool opening = VAbstractValApplication::VApp()->getOpeningPattern(); + bool const opening = VAbstractValApplication::VApp()->getOpeningPattern(); if (opening) { ui->pushButtonUndo->setDisabled(opening); diff --git a/src/libs/vtools/dialogs/tools/dialogalongline.cpp b/src/libs/vtools/dialogs/tools/dialogalongline.cpp index 1039ffc6f..b0720fb77 100644 --- a/src/libs/vtools/dialogs/tools/dialogalongline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogalongline.cpp @@ -277,8 +277,8 @@ void DialogAlongLine::SetCurrentLength() } catch (const VExceptionBadId &) { - QScopedPointer p1(new VPointF()); - QScopedPointer p2(new VPointF()); + QScopedPointer const p1(new VPointF()); + QScopedPointer const p2(new VPointF()); length = new VLengthLine(p1.data(), GetFirstPointId(), p2.data(), GetSecondPointId(), *data->GetPatternUnit()); } @@ -408,12 +408,12 @@ void DialogAlongLine::ShowDialog(bool click) const QSharedPointer p1 = data->GeometricObject(GetFirstPointId()); const QSharedPointer p2 = data->GeometricObject(GetSecondPointId()); - QLineF baseLine(static_cast(*p1), static_cast(*p2)); + QLineF const baseLine(static_cast(*p1), static_cast(*p2)); - QLineF line(static_cast(*p1), scene->getScenePos()); + QLineF const line(static_cast(*p1), scene->getScenePos()); qreal len = line.length(); - qreal angleTo = baseLine.angleTo(line); + qreal const angleTo = baseLine.angleTo(line); if (angleTo > 90 && angleTo < 270) { len *= -1; diff --git a/src/libs/vtools/dialogs/tools/dialogarc.cpp b/src/libs/vtools/dialogs/tools/dialogarc.cpp index ba1cc64be..cdf6dac40 100644 --- a/src/libs/vtools/dialogs/tools/dialogarc.cpp +++ b/src/libs/vtools/dialogs/tools/dialogarc.cpp @@ -269,7 +269,7 @@ void DialogArc::ShowDialog(bool click) auto *scene = qobject_cast(VAbstractValApplication::VApp()->getCurrentScene()); SCASSERT(scene != nullptr) const QSharedPointer point = data->GeometricObject(GetCenter()); - QLineF line = QLineF(static_cast(*point), scene->getScenePos()); + QLineF const line = QLineF(static_cast(*point), scene->getScenePos()); auto Angle = [line]() { @@ -451,7 +451,7 @@ void DialogArc::changeEvent(QEvent *event) //--------------------------------------------------------------------------------------------------------------------- void DialogArc::ValidateAlias() { - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); VArc arc; arc.SetAliasSuffix(GetAliasSuffix()); if (not GetAliasSuffix().isEmpty() && diff --git a/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp b/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp index af5a09a51..0743c29c8 100644 --- a/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp +++ b/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp @@ -296,7 +296,7 @@ void DialogArcWithLength::ShowDialog(bool click) auto *scene = qobject_cast(VAbstractValApplication::VApp()->getCurrentScene()); SCASSERT(scene != nullptr) const QSharedPointer point = data->GeometricObject(GetCenter()); - QLineF line = QLineF(static_cast(*point), scene->getScenePos()); + QLineF const line = QLineF(static_cast(*point), scene->getScenePos()); auto Angle = [line]() { @@ -336,7 +336,7 @@ void DialogArcWithLength::ShowDialog(bool click) { const qreal r = Visualization::FindLengthFromUser(m_radius, data->DataVariables()); const qreal angle1 = Visualization::FindValFromUser(m_f1, data->DataVariables()); - VArc arc(*point, r, angle1, line.angle()); + VArc const arc(*point, r, angle1, line.angle()); SetLength(QString::number(VAbstractValApplication::VApp()->fromPixel(arc.GetLength()))); @@ -495,7 +495,7 @@ void DialogArcWithLength::changeEvent(QEvent *event) //--------------------------------------------------------------------------------------------------------------------- void DialogArcWithLength::ValidateAlias() { - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); VArc arc; arc.SetAliasSuffix(GetAliasSuffix()); if (not GetAliasSuffix().isEmpty() && diff --git a/src/libs/vtools/dialogs/tools/dialogbisector.cpp b/src/libs/vtools/dialogs/tools/dialogbisector.cpp index 3953a7068..b505b6d59 100644 --- a/src/libs/vtools/dialogs/tools/dialogbisector.cpp +++ b/src/libs/vtools/dialogs/tools/dialogbisector.cpp @@ -368,16 +368,16 @@ void DialogBisector::ShowDialog(bool click) const QSharedPointer p2 = data->GeometricObject(GetSecondPointId()); const QSharedPointer p3 = data->GeometricObject(GetThirdPointId()); - qreal angle = VToolBisector::BisectorAngle(static_cast(*p1), static_cast(*p2), - static_cast(*p3)); + qreal const angle = VToolBisector::BisectorAngle(static_cast(*p1), static_cast(*p2), + static_cast(*p3)); QLineF baseLine(static_cast(*p2), static_cast(*p3)); baseLine.setAngle(angle); - QLineF line(static_cast(*p2), scene->getScenePos()); + QLineF const line(static_cast(*p2), scene->getScenePos()); qreal len = line.length(); - qreal angleTo = baseLine.angleTo(line); + qreal const angleTo = baseLine.angleTo(line); if (angleTo > 90 && angleTo < 270) { len *= -1; @@ -475,7 +475,7 @@ void DialogBisector::FinishCreating() //--------------------------------------------------------------------------------------------------------------------- void DialogBisector::InitIcons() { - QString resource = QStringLiteral("icon"); + QString const resource = QStringLiteral("icon"); ui->toolButtonExprLength->setIcon(VTheme::GetIconResource(resource, QStringLiteral("24x24/fx.png"))); ui->label_3->setPixmap(VTheme::GetPixmapResource(resource, QStringLiteral("24x24/equal.png"))); diff --git a/src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp b/src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp index c811c5529..48475cdf2 100644 --- a/src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp @@ -264,7 +264,7 @@ void DialogCubicBezier::SaveData() //--------------------------------------------------------------------------------------------------------------------- void DialogCubicBezier::ValidateAlias() { - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); VCubicBezier spline = spl; spline.SetAliasSuffix(ui->lineEditAlias->text()); if (not ui->lineEditAlias->text().isEmpty() && diff --git a/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp b/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp index 053a46989..7bd7f76f9 100644 --- a/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp @@ -278,7 +278,7 @@ void DialogCubicBezierPath::currentPointChanged(int index) //--------------------------------------------------------------------------------------------------------------------- void DialogCubicBezierPath::ValidateAlias() { - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); VCubicBezierPath tempPath = path; tempPath.SetAliasSuffix(ui->lineEditAlias->text()); if (not ui->lineEditAlias->text().isEmpty() && diff --git a/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp b/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp index c221902d7..7627c77ac 100644 --- a/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp @@ -232,7 +232,7 @@ void DialogCurveIntersectAxis::ShowDialog(bool click) auto *scene = qobject_cast(VAbstractValApplication::VApp()->getCurrentScene()); SCASSERT(scene != nullptr) const QSharedPointer point = data->GeometricObject(GetBasePointId()); - QLineF line = QLineF(static_cast(*point), scene->getScenePos()); + QLineF const line = QLineF(static_cast(*point), scene->getScenePos()); // Radius of point circle, but little bigger. Need handle with hover sizes. if (line.length() <= ScaledRadius(SceneScale(VAbstractValApplication::VApp()->getCurrentScene())) * 1.5) @@ -383,10 +383,10 @@ void DialogCurveIntersectAxis::changeEvent(QEvent *event) //--------------------------------------------------------------------------------------------------------------------- void DialogCurveIntersectAxis::ValidateAlias() { - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); const QSharedPointer curve = data->GeometricObject(getCurveId()); - QPair alias = SegmentAliases(curve->getType(), GetAliasSuffix1(), GetAliasSuffix2()); + QPair const alias = SegmentAliases(curve->getType(), GetAliasSuffix1(), GetAliasSuffix2()); if (not GetAliasSuffix1().isEmpty() && (not rx.match(alias.first).hasMatch() || @@ -420,7 +420,7 @@ void DialogCurveIntersectAxis::ValidateAlias() //--------------------------------------------------------------------------------------------------------------------- void DialogCurveIntersectAxis::InitIcons() { - QString resource = QStringLiteral("icon"); + QString const resource = QStringLiteral("icon"); ui->toolButtonExprAngle->setIcon(VTheme::GetIconResource(resource, QStringLiteral("24x24/fx.png"))); ui->label_3->setPixmap(VTheme::GetPixmapResource(resource, QStringLiteral("24x24/equal.png"))); diff --git a/src/libs/vtools/dialogs/tools/dialogcutarc.cpp b/src/libs/vtools/dialogs/tools/dialogcutarc.cpp index 60bb5fd61..7d9aa95f6 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutarc.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcutarc.cpp @@ -256,7 +256,7 @@ void DialogCutArc::ArcChanged() //--------------------------------------------------------------------------------------------------------------------- void DialogCutArc::ValidateAlias() { - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); VArc arc1; arc1.SetAliasSuffix(GetAliasSuffix1()); @@ -308,7 +308,7 @@ void DialogCutArc::FinishCreating() //--------------------------------------------------------------------------------------------------------------------- void DialogCutArc::InitIcons() { - QString resource = QStringLiteral("icon"); + QString const resource = QStringLiteral("icon"); ui->toolButtonExprLength->setIcon(VTheme::GetIconResource(resource, QStringLiteral("24x24/fx.png"))); ui->label_4->setPixmap(VTheme::GetPixmapResource(resource, QStringLiteral("24x24/equal.png"))); @@ -458,7 +458,7 @@ void DialogCutArc::ShowDialog(bool click) SCASSERT(scene != nullptr) const QSharedPointer arc = data->GeometricObject(getArcId()); - QPointF p = arc->ClosestPoint(scene->getScenePos()); + QPointF const p = arc->ClosestPoint(scene->getScenePos()); qreal len = arc->GetLengthByPoint(p); len = !arc->IsFlipped() ? qBound(0.0, len, arc->GetLength()) : qBound(arc->GetLength(), -len, 0.0); diff --git a/src/libs/vtools/dialogs/tools/dialogcutspline.cpp b/src/libs/vtools/dialogs/tools/dialogcutspline.cpp index 3a175d8eb..8af930cf1 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutspline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcutspline.cpp @@ -245,7 +245,7 @@ void DialogCutSpline::SplineChanged() //--------------------------------------------------------------------------------------------------------------------- void DialogCutSpline::ValidateAlias() { - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); VSpline spl1; spl1.SetAliasSuffix(GetAliasSuffix1()); @@ -297,7 +297,7 @@ void DialogCutSpline::FinishCreating() //--------------------------------------------------------------------------------------------------------------------- void DialogCutSpline::InitIcons() { - QString resource = QStringLiteral("icon"); + QString const resource = QStringLiteral("icon"); ui->toolButtonExprLength->setIcon(VTheme::GetIconResource(resource, QStringLiteral("24x24/fx.png"))); ui->label_4->setPixmap(VTheme::GetPixmapResource(resource, QStringLiteral("24x24/equal.png"))); @@ -424,8 +424,8 @@ void DialogCutSpline::ShowDialog(bool click) SCASSERT(scene != nullptr) const QSharedPointer spl = data->GeometricObject(getSplineId()); - QPointF p = spl->ClosestPoint(scene->getScenePos()); - qreal len = spl->GetLengthByPoint(p); + QPointF const p = spl->ClosestPoint(scene->getScenePos()); + qreal const len = spl->GetLengthByPoint(p); SetFormula(QString::number(FromPixel(len, *data->GetPatternUnit()))); } diff --git a/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp b/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp index 382a2bc5f..a48250782 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp @@ -245,7 +245,7 @@ void DialogCutSplinePath::SplinePathChanged() //--------------------------------------------------------------------------------------------------------------------- void DialogCutSplinePath::ValidateAlias() { - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); VSplinePath path1; path1.SetAliasSuffix(GetAliasSuffix1()); @@ -297,7 +297,7 @@ void DialogCutSplinePath::FinishCreating() //--------------------------------------------------------------------------------------------------------------------- void DialogCutSplinePath::InitIcons() { - QString resource = QStringLiteral("icon"); + QString const resource = QStringLiteral("icon"); ui->toolButtonExprLength->setIcon(VTheme::GetIconResource(resource, QStringLiteral("24x24/fx.png"))); ui->label_4->setPixmap(VTheme::GetPixmapResource(resource, QStringLiteral("24x24/equal.png"))); @@ -425,8 +425,8 @@ void DialogCutSplinePath::ShowDialog(bool click) const QSharedPointer curve = data->GeometricObject(getSplinePathId()); - QPointF p = curve->ClosestPoint(scene->getScenePos()); - qreal len = curve->GetLengthByPoint(p); + QPointF const p = curve->ClosestPoint(scene->getScenePos()); + qreal const len = curve->GetLengthByPoint(p); SetFormula(QString::number(FromPixel(len, *data->GetPatternUnit()))); } diff --git a/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp b/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp index 1a450e1a0..68296144e 100644 --- a/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp +++ b/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp @@ -620,8 +620,8 @@ void DialogEllipticalArc::ShowDialog(bool click) if (m_stage == 1) // radius 2 { - QLineF radius2Line(center->x(), center->y(), center->x(), center->y() - 100); - QPointF p = VGObject::ClosestPoint(radius2Line, scene->getScenePos()); + QLineF const radius2Line(center->x(), center->y(), center->x(), center->y() - 100); + QPointF const p = VGObject::ClosestPoint(radius2Line, scene->getScenePos()); line = QLineF(static_cast(*center), p); // Radius of point circle, but little bigger. Need to handle with hover sizes. @@ -758,7 +758,7 @@ void DialogEllipticalArc::changeEvent(QEvent *event) //--------------------------------------------------------------------------------------------------------------------- void DialogEllipticalArc::ValidateAlias() { - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); VEllipticalArc arc; arc.SetAliasSuffix(GetAliasSuffix()); if (not GetAliasSuffix().isEmpty() && diff --git a/src/libs/vtools/dialogs/tools/dialogendline.cpp b/src/libs/vtools/dialogs/tools/dialogendline.cpp index 74194d98d..dc2af6a17 100644 --- a/src/libs/vtools/dialogs/tools/dialogendline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogendline.cpp @@ -349,7 +349,7 @@ void DialogEndLine::ShowDialog(bool click) auto *scene = qobject_cast(VAbstractValApplication::VApp()->getCurrentScene()); SCASSERT(scene != nullptr) const QSharedPointer point = data->GeometricObject(GetBasePointId()); - QLineF line = QLineF(static_cast(*point), scene->getScenePos()); + QLineF const line = QLineF(static_cast(*point), scene->getScenePos()); // Radius of point circle, but little bigger. Need handle with hover sizes. if (line.length() <= ScaledRadius(SceneScale(VAbstractValApplication::VApp()->getCurrentScene())) * 1.5) diff --git a/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.cpp b/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.cpp index 74f0fe0b9..3593f9a01 100644 --- a/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.cpp +++ b/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.cpp @@ -332,7 +332,7 @@ void DialogFlippingByAxis::SuffixChanged() if (m_suffix != suffix) { - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); const QStringList uniqueNames = data->AllUniqueNames(); for (auto &uniqueName : uniqueNames) { @@ -431,7 +431,7 @@ void DialogFlippingByAxis::ShowSourceDetails(int row) if (sourceItem.penStyle.isEmpty() || sourceItem.penStyle == TypeLineDefault) { - int index = ui->comboBoxPenStyle->currentIndex(); + int const index = ui->comboBoxPenStyle->currentIndex(); ui->comboBoxPenStyle->setItemText(index, '<' + tr("Default") + '>'); } @@ -440,7 +440,7 @@ void DialogFlippingByAxis::ShowSourceDetails(int row) if (sourceItem.color.isEmpty() || sourceItem.color == ColorDefault) { const QSharedPointer curve = data->GeometricObject(sourceItem.id); - int index = ui->comboBoxColor->currentIndex(); + int const index = ui->comboBoxColor->currentIndex(); ui->comboBoxColor->setItemIcon(index, LineColor(ui->comboBoxColor->palette().color(QPalette::Text), ui->comboBoxColor->iconSize().height(), curve->GetColor())); } @@ -557,7 +557,7 @@ void DialogFlippingByAxis::SaveData() void DialogFlippingByAxis::PointChanged() { QColor color; - quint32 id = getCurrentObjectId(ui->comboBoxOriginPoint); + quint32 const id = getCurrentObjectId(ui->comboBoxOriginPoint); auto obj = std::find_if(sourceObjects.begin(), sourceObjects.end(), [id](const SourceItem &sItem) { return sItem.id == id; }); if (obj != sourceObjects.end()) @@ -596,7 +596,7 @@ void DialogFlippingByAxis::FillSourceList() for (auto &sourceItem : sourceObjects) { const QSharedPointer obj = data->GetGObject(sourceItem.id); - bool valid = SourceAliasValid(sourceItem, obj, data, OriginAlias(sourceItem.id, sourceObjects, obj)); + bool const valid = SourceAliasValid(sourceItem, obj, data, OriginAlias(sourceItem.id, sourceObjects, obj)); auto *item = new QListWidgetItem(valid ? obj->ObjectName() : obj->ObjectName() + '*'); item->setToolTip(obj->ObjectName()); @@ -675,7 +675,7 @@ auto DialogFlippingByAxis::GetNotes() const -> QString //--------------------------------------------------------------------------------------------------------------------- auto DialogFlippingByAxis::IsValid() const -> bool { - bool ready = flagError && flagName && flagGroupName && flagAlias; + bool const ready = flagError && flagName && flagGroupName && flagAlias; if (ready) { diff --git a/src/libs/vtools/dialogs/tools/dialogflippingbyline.cpp b/src/libs/vtools/dialogs/tools/dialogflippingbyline.cpp index 1f85f692f..337820474 100644 --- a/src/libs/vtools/dialogs/tools/dialogflippingbyline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogflippingbyline.cpp @@ -354,7 +354,7 @@ void DialogFlippingByLine::SuffixChanged() if (m_suffix != suffix) { - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); const QStringList uniqueNames = data->AllUniqueNames(); for (auto &uniqueName : uniqueNames) { @@ -454,7 +454,7 @@ void DialogFlippingByLine::ShowSourceDetails(int row) if (sourceItem.penStyle.isEmpty() || sourceItem.penStyle == TypeLineDefault) { ; - int index = ui->comboBoxPenStyle->currentIndex(); + int const index = ui->comboBoxPenStyle->currentIndex(); ui->comboBoxPenStyle->setItemText(index, '<' + tr("Default") + '>'); } @@ -463,7 +463,7 @@ void DialogFlippingByLine::ShowSourceDetails(int row) if (sourceItem.color.isEmpty() || sourceItem.color == ColorDefault) { const QSharedPointer curve = data->GeometricObject(sourceItem.id); - int index = ui->comboBoxColor->currentIndex(); + int const index = ui->comboBoxColor->currentIndex(); ui->comboBoxColor->setItemIcon(index, LineColor(ui->comboBoxColor->palette().color(QPalette::Text), ui->comboBoxColor->iconSize().height(), curve->GetColor())); } @@ -584,11 +584,11 @@ void DialogFlippingByLine::PointChanged() ChangeColor(ui->labelFirstLinePoint, color); ChangeColor(ui->labelSecondLinePoint, color); - quint32 id1 = getCurrentObjectId(ui->comboBoxFirstLinePoint); + quint32 const id1 = getCurrentObjectId(ui->comboBoxFirstLinePoint); auto obj1 = std::find_if(sourceObjects.begin(), sourceObjects.end(), [id1](const SourceItem &sItem) { return sItem.id == id1; }); - quint32 id2 = getCurrentObjectId(ui->comboBoxSecondLinePoint); + quint32 const id2 = getCurrentObjectId(ui->comboBoxSecondLinePoint); auto obj2 = std::find_if(sourceObjects.begin(), sourceObjects.end(), [id2](const SourceItem &sItem) { return sItem.id == id2; }); @@ -630,7 +630,7 @@ void DialogFlippingByLine::FillSourceList() for (auto &sourceItem : sourceObjects) { const QSharedPointer obj = data->GetGObject(sourceItem.id); - bool valid = SourceAliasValid(sourceItem, obj, data, OriginAlias(sourceItem.id, sourceObjects, obj)); + bool const valid = SourceAliasValid(sourceItem, obj, data, OriginAlias(sourceItem.id, sourceObjects, obj)); auto *item = new QListWidgetItem(valid ? obj->ObjectName() : obj->ObjectName() + '*'); item->setToolTip(obj->ObjectName()); @@ -709,7 +709,7 @@ auto DialogFlippingByLine::GetNotes() const -> QString //--------------------------------------------------------------------------------------------------------------------- auto DialogFlippingByLine::IsValid() const -> bool { - bool ready = flagError && flagName && flagGroupName && flagAlias; + bool const ready = flagError && flagName && flagGroupName && flagAlias; if (ready) { diff --git a/src/libs/vtools/dialogs/tools/dialoglineintersect.cpp b/src/libs/vtools/dialogs/tools/dialoglineintersect.cpp index 241a020bd..925cc013e 100644 --- a/src/libs/vtools/dialogs/tools/dialoglineintersect.cpp +++ b/src/libs/vtools/dialogs/tools/dialoglineintersect.cpp @@ -236,10 +236,10 @@ void DialogLineIntersect::PointNameChanged() const QSharedPointer p1Line2 = data->GeometricObject(p1Line2Id); const QSharedPointer p2Line2 = data->GeometricObject(p2Line2Id); - QLineF line1(static_cast(*p1Line1), static_cast(*p2Line1)); - QLineF line2(static_cast(*p1Line2), static_cast(*p2Line2)); + QLineF const line1(static_cast(*p1Line1), static_cast(*p2Line1)); + QLineF const line2(static_cast(*p1Line2), static_cast(*p2Line2)); QPointF fPoint; - QLineF::IntersectType intersect = line1.intersects(line2, &fPoint); + QLineF::IntersectType const intersect = line1.intersects(line2, &fPoint); flagError = not(set.size() < 3 || intersect == QLineF::NoIntersection); color = flagError ? OkColor(this) : errorColor; @@ -277,10 +277,10 @@ auto DialogLineIntersect::CheckIntersecion() -> bool const QSharedPointer p1L2 = data->GeometricObject(GetP1Line2()); const QSharedPointer p2L2 = data->GeometricObject(GetP2Line2()); - QLineF line1(static_cast(*p1L1), static_cast(*p2L1)); - QLineF line2(static_cast(*p1L2), static_cast(*p2L2)); + QLineF const line1(static_cast(*p1L1), static_cast(*p2L1)); + QLineF const line2(static_cast(*p1L2), static_cast(*p2L2)); QPointF fPoint; - QLineF::IntersectType intersect = line1.intersects(line2, &fPoint); + QLineF::IntersectType const intersect = line1.intersects(line2, &fPoint); return intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection; } catch (const VExceptionBadId &) diff --git a/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp b/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp index f39c654e0..6e1b145cc 100644 --- a/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp +++ b/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp @@ -255,7 +255,7 @@ void DialogLineIntersectAxis::ShowDialog(bool click) auto *scene = qobject_cast(VAbstractValApplication::VApp()->getCurrentScene()); SCASSERT(scene != nullptr) const QSharedPointer point = data->GeometricObject(GetBasePointId()); - QLineF line = QLineF(static_cast(*point), scene->getScenePos()); + QLineF const line = QLineF(static_cast(*point), scene->getScenePos()); // Radius of point circle, but little bigger. Need handle with hover sizes. if (line.length() <= ScaledRadius(SceneScale(VAbstractValApplication::VApp()->getCurrentScene())) * 1.5) diff --git a/src/libs/vtools/dialogs/tools/dialogmove.cpp b/src/libs/vtools/dialogs/tools/dialogmove.cpp index 2b9b45f73..66459d0a9 100644 --- a/src/libs/vtools/dialogs/tools/dialogmove.cpp +++ b/src/libs/vtools/dialogs/tools/dialogmove.cpp @@ -525,7 +525,7 @@ void DialogMove::SuffixChanged() if (m_suffix != suffix) { - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); const QStringList uniqueNames = data->AllUniqueNames(); for (const auto &uniqueName : uniqueNames) { @@ -625,7 +625,7 @@ void DialogMove::ShowSourceDetails(int row) if (sourceItem.penStyle.isEmpty() || sourceItem.penStyle == TypeLineDefault) { const QSharedPointer curve = data->GeometricObject(sourceItem.id); - int index = ui->comboBoxPenStyle->currentIndex(); + int const index = ui->comboBoxPenStyle->currentIndex(); ui->comboBoxPenStyle->setItemText(index, '<' + tr("Default") + '>'); } @@ -634,7 +634,7 @@ void DialogMove::ShowSourceDetails(int row) if (sourceItem.color.isEmpty() || sourceItem.color == ColorDefault) { const QSharedPointer curve = data->GeometricObject(sourceItem.id); - int index = ui->comboBoxColor->currentIndex(); + int const index = ui->comboBoxColor->currentIndex(); ui->comboBoxColor->setItemIcon(index, LineColor(ui->comboBoxColor->palette().color(QPalette::Text), ui->comboBoxColor->iconSize().height(), curve->GetColor())); } @@ -844,7 +844,7 @@ void DialogMove::FillSourceList() for (auto &sourceItem : sourceObjects) { const QSharedPointer obj = data->GetGObject(sourceItem.id); - bool valid = SourceAliasValid(sourceItem, obj, data, OriginAlias(sourceItem.id, sourceObjects, obj)); + bool const valid = SourceAliasValid(sourceItem, obj, data, OriginAlias(sourceItem.id, sourceObjects, obj)); auto *item = new QListWidgetItem(valid ? obj->ObjectName() : obj->ObjectName() + '*'); item->setToolTip(obj->ObjectName()); @@ -939,7 +939,7 @@ auto DialogMove::GetNotes() const -> QString //--------------------------------------------------------------------------------------------------------------------- auto DialogMove::IsValid() const -> bool { - bool ready = flagAngle && flagRotationAngle && flagLength && flagName && flagGroupName && flagAlias; + bool const ready = flagAngle && flagRotationAngle && flagLength && flagName && flagGroupName && flagAlias; if (ready) { diff --git a/src/libs/vtools/dialogs/tools/dialognormal.cpp b/src/libs/vtools/dialogs/tools/dialognormal.cpp index c4f51c50c..ec48b75e6 100644 --- a/src/libs/vtools/dialogs/tools/dialognormal.cpp +++ b/src/libs/vtools/dialogs/tools/dialognormal.cpp @@ -494,10 +494,10 @@ void DialogNormal::ShowDialog(bool click) QLineF baseLine(static_cast(*p1), static_cast(*p2)); baseLine.setAngle(baseLine.angle() + 90); - QLineF line(static_cast(*p1), scene->getScenePos()); + QLineF const line(static_cast(*p1), scene->getScenePos()); qreal len = line.length(); - qreal angleTo = baseLine.angleTo(line); + qreal const angleTo = baseLine.angleTo(line); if (angleTo > 90 && angleTo < 270) { len *= -1; diff --git a/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp b/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp index ecb0bdcf8..7662c71ed 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp @@ -223,7 +223,7 @@ void DialogPointFromCircleAndTangent::ShowDialog(bool click) auto *scene = qobject_cast(VAbstractValApplication::VApp()->getCurrentScene()); SCASSERT(scene != nullptr) const QSharedPointer center = data->GeometricObject(GetCircleCenterId()); - QLineF line = QLineF(static_cast(*center), scene->getScenePos()); + QLineF const line = QLineF(static_cast(*center), scene->getScenePos()); SetCircleRadius(QString::number(FromPixel(line.length(), *data->GetPatternUnit()))); } diff --git a/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp b/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp index ab8fc2cde..8824563c5 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp @@ -205,7 +205,7 @@ void DialogPointOfContact::ShowDialog(bool click) const QSharedPointer center = data->GeometricObject(GetCenter()); - QLineF line(static_cast(*center), scene->getScenePos()); + QLineF const line(static_cast(*center), scene->getScenePos()); SetRadius(QString::number(FromPixel(line.length(), *data->GetPatternUnit()))); } diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp index 715cb5d05..1081101a5 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp @@ -265,10 +265,10 @@ void DialogPointOfIntersectionCircles::ShowDialog(bool click) auto *scene = qobject_cast(VAbstractValApplication::VApp()->getCurrentScene()); SCASSERT(scene != nullptr) - QSharedPointer center = + QSharedPointer const center = data->GeometricObject(m_stage == 1 ? GetFirstCircleCenterId() : GetSecondCircleCenterId()); - QLineF line(static_cast(*center), scene->getScenePos()); + QLineF const line(static_cast(*center), scene->getScenePos()); if (m_stage == 1) { diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.cpp b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.cpp index 59a5e9286..d239f9903 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.cpp @@ -258,14 +258,14 @@ void DialogPointOfIntersectionCurves::CurveChanged() //--------------------------------------------------------------------------------------------------------------------- void DialogPointOfIntersectionCurves::ValidateAlias() { - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); const QSharedPointer curve1 = data->GeometricObject(GetFirstCurveId()); - QPair curve1Alias = + QPair const curve1Alias = SegmentAliases(curve1->getType(), GetCurve1AliasSuffix1(), GetCurve1AliasSuffix2()); const QSharedPointer curve2 = data->GeometricObject(GetSecondCurveId()); - QPair curve2Alias = + QPair const curve2Alias = SegmentAliases(curve2->getType(), GetCurve2AliasSuffix1(), GetCurve2AliasSuffix2()); QSet uniqueAliases; diff --git a/src/libs/vtools/dialogs/tools/dialogrotation.cpp b/src/libs/vtools/dialogs/tools/dialogrotation.cpp index 16ed9cb0a..eb16148d4 100644 --- a/src/libs/vtools/dialogs/tools/dialogrotation.cpp +++ b/src/libs/vtools/dialogs/tools/dialogrotation.cpp @@ -427,7 +427,7 @@ void DialogRotation::SuffixChanged() if (m_suffix != suffix) { - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); const QStringList uniqueNames = data->AllUniqueNames(); for (const auto &uniqueName : uniqueNames) { @@ -544,7 +544,7 @@ void DialogRotation::changeEvent(QEvent *event) //--------------------------------------------------------------------------------------------------------------------- void DialogRotation::PointChanged() { - quint32 id = getCurrentObjectId(ui->comboBoxOriginPoint); + quint32 const id = getCurrentObjectId(ui->comboBoxOriginPoint); auto obj = std::find_if(sourceObjects.begin(), sourceObjects.end(), [id](const SourceItem &sItem) { return sItem.id == id; }); @@ -577,7 +577,7 @@ void DialogRotation::FillSourceList() for (auto &sourceItem : sourceObjects) { const QSharedPointer obj = data->GetGObject(sourceItem.id); - bool valid = SourceAliasValid(sourceItem, obj, data, OriginAlias(sourceItem.id, sourceObjects, obj)); + bool const valid = SourceAliasValid(sourceItem, obj, data, OriginAlias(sourceItem.id, sourceObjects, obj)); auto *item = new QListWidgetItem(valid ? obj->ObjectName() : obj->ObjectName() + '*'); item->setToolTip(obj->ObjectName()); @@ -723,7 +723,7 @@ void DialogRotation::ShowSourceDetails(int row) if (sourceItem.penStyle.isEmpty() || sourceItem.penStyle == TypeLineDefault) { - int index = ui->comboBoxPenStyle->currentIndex(); + int const index = ui->comboBoxPenStyle->currentIndex(); ui->comboBoxPenStyle->setItemText(index, '<' + tr("Default") + '>'); } @@ -732,7 +732,7 @@ void DialogRotation::ShowSourceDetails(int row) if (sourceItem.color.isEmpty() || sourceItem.color == ColorDefault) { const QSharedPointer curve = data->GeometricObject(sourceItem.id); - int index = ui->comboBoxColor->currentIndex(); + int const index = ui->comboBoxColor->currentIndex(); ui->comboBoxColor->setItemIcon(index, LineColor(ui->comboBoxColor->palette().color(QPalette::Text), ui->comboBoxColor->iconSize().height(), curve->GetColor())); } @@ -816,7 +816,7 @@ auto DialogRotation::GetNotes() const -> QString //--------------------------------------------------------------------------------------------------------------------- auto DialogRotation::IsValid() const -> bool { - bool ready = flagAngle && flagName && flagError && flagGroupName && flagAlias; + bool const ready = flagAngle && flagName && flagError && flagGroupName && flagAlias; if (ready) { diff --git a/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp b/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp index 1b08673b2..fafbe67b8 100644 --- a/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp +++ b/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp @@ -505,7 +505,7 @@ void DialogShoulderPoint::ShowDialog(bool click) SCASSERT(scene != nullptr) const QSharedPointer p3 = data->GeometricObject(GetP3()); - QLineF line(static_cast(*p3), scene->getScenePos()); + QLineF const line(static_cast(*p3), scene->getScenePos()); SetFormula(QString::number(FromPixel(line.length(), *data->GetPatternUnit()))); } diff --git a/src/libs/vtools/dialogs/tools/dialogspline.cpp b/src/libs/vtools/dialogs/tools/dialogspline.cpp index 629d5d33f..2a16efa7a 100644 --- a/src/libs/vtools/dialogs/tools/dialogspline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogspline.cpp @@ -437,7 +437,7 @@ void DialogSpline::EvalLength2() //--------------------------------------------------------------------------------------------------------------------- void DialogSpline::ValidateAlias() { - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); VSpline spline = spl; spline.SetAliasSuffix(ui->lineEditAlias->text()); diff --git a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp index a91d72692..e14c8f357 100644 --- a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp @@ -543,7 +543,7 @@ void DialogSplinePath::FXLength2() //--------------------------------------------------------------------------------------------------------------------- void DialogSplinePath::ValidateAlias() { - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); VSplinePath tempPath = path; tempPath.SetAliasSuffix(ui->lineEditAlias->text()); @@ -914,7 +914,7 @@ void DialogSplinePath::DataPoint(const VSplinePoint &p) ChangeCurrentData(ui->comboBoxPoint, p.P().id()); ui->comboBoxPoint->blockSignals(false); - int row = ui->listWidget->currentRow(); + int const row = ui->listWidget->currentRow(); const QString field = tr("Not used"); const QString emptyRes = QChar('_'); diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index 2917f6ba0..37743f40f 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -257,7 +257,7 @@ void DialogTool::FillComboBoxCurves(QComboBox *box) const { if (i.key() != toolId) { - QSharedPointer obj = i.value(); + QSharedPointer const obj = i.value(); if (obj->getType() == GOType::Arc || obj->getType() == GOType::EllipticalArc || obj->getType() == GOType::Spline || obj->getType() == GOType::SplinePath || obj->getType() == GOType::CubicBezier || obj->getType() == GOType::CubicBezierPath) @@ -595,7 +595,7 @@ void DialogTool::setCurrentCurveId(QComboBox *box, const quint32 &value) const auto DialogTool::getCurrentObjectId(QComboBox *box) -> quint32 { SCASSERT(box != nullptr) - qint32 index = box->currentIndex(); + qint32 const index = box->currentIndex(); if (index != -1) { return qvariant_cast(box->itemData(index)); diff --git a/src/libs/vtools/dialogs/tools/dialogtruedarts.cpp b/src/libs/vtools/dialogs/tools/dialogtruedarts.cpp index cc914376e..b46c2baa4 100644 --- a/src/libs/vtools/dialogs/tools/dialogtruedarts.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtruedarts.cpp @@ -407,7 +407,7 @@ void DialogTrueDarts::CheckName(QLineEdit *edit, QLabel *labelEditNamePoint, con const QString name = edit->text(); const QString secondName = secondPointName->text(); - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); if (name.isEmpty() || secondName == name || (pointD1Name != name && pointD2Name != name && data->IsUnique(name) == false) || rx.match(name).hasMatch() == false) diff --git a/src/libs/vtools/dialogs/tools/piece/dialoginsertnode.cpp b/src/libs/vtools/dialogs/tools/piece/dialoginsertnode.cpp index 6cfc5daae..cee7ebd91 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialoginsertnode.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialoginsertnode.cpp @@ -101,7 +101,7 @@ auto DialogInsertNode::GetNodes() const -> QVector QVector nodes; for (qint32 i = 0; i < ui->listWidget->count(); ++i) { - VPieceNode node = qvariant_cast(ui->listWidget->item(i)->data(Qt::UserRole)); + VPieceNode const node = qvariant_cast(ui->listWidget->item(i)->data(Qt::UserRole)); for (int n = 1; n <= nodeNumbers.value(node.GetId(), 1); ++n) { nodes.append(node); @@ -212,7 +212,7 @@ void DialogInsertNode::ShowContextMenu(const QPoint &pos) return; } - QScopedPointer menu(new QMenu()); + QScopedPointer const menu(new QMenu()); QListWidgetItem *rowItem = ui->listWidget->item(row); SCASSERT(rowItem != nullptr); @@ -242,7 +242,7 @@ void DialogInsertNode::NodeSelected() return; } - VPieceNode node = qvariant_cast(item->data(Qt::UserRole)); + VPieceNode const node = qvariant_cast(item->data(Qt::UserRole)); ui->spinBoxNodeNumber->setEnabled(true); ui->spinBoxNodeNumber->blockSignals(true); ui->spinBoxNodeNumber->setValue(nodeNumbers.value(node.GetId(), 1)); @@ -259,7 +259,7 @@ void DialogInsertNode::NodeNumberChanged(int val) return; } - VPieceNode node = qvariant_cast(item->data(Qt::UserRole)); + VPieceNode const node = qvariant_cast(item->data(Qt::UserRole)); nodeNumbers[node.GetId()] = val; } diff --git a/src/libs/vtools/dialogs/tools/piece/dialogpatternmaterials.cpp b/src/libs/vtools/dialogs/tools/piece/dialogpatternmaterials.cpp index bedd0e2e0..a84a09761 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogpatternmaterials.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogpatternmaterials.cpp @@ -80,7 +80,7 @@ DialogPatternMaterials::~DialogPatternMaterials() void DialogPatternMaterials::SetPatternMaterials(const QMap &list) { ui->tableWidget->setRowCount(userMaterialPlaceholdersQuantity); - QChar per('%'); + QChar const per('%'); for (int i = 0; i < userMaterialPlaceholdersQuantity; ++i) { diff --git a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp index 67817b6bf..5e5b681e8 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp @@ -358,7 +358,7 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos) auto rowNode = qvariant_cast(rowItem->data(Qt::UserRole)); QMenu menu; - QHash contextMenu = InitContextMenu(&menu, rowNode); + QHash const contextMenu = InitContextMenu(&menu, rowNode); QAction *selectedAction = menu.exec(ui->listWidget->viewport()->mapToGlobal(pos)); auto selectedOption = static_cast( @@ -1009,7 +1009,7 @@ void DialogPiecePath::EvalPassmarkAngle() //--------------------------------------------------------------------------------------------------------------------- void DialogPiecePath::FXWidth() { - QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); + QScopedPointer const dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Edit seam allowance width")); dialog->SetFormula(GetFormulaSAWidth()); dialog->setCheckLessThanZero(true); @@ -1023,7 +1023,7 @@ void DialogPiecePath::FXWidth() //--------------------------------------------------------------------------------------------------------------------- void DialogPiecePath::FXWidthBefore() { - QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); + QScopedPointer const dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Edit seam allowance width before")); dialog->SetFormula(GetFormulaSAWidthBefore()); dialog->setCheckLessThanZero(true); @@ -1037,7 +1037,7 @@ void DialogPiecePath::FXWidthBefore() //--------------------------------------------------------------------------------------------------------------------- void DialogPiecePath::FXWidthAfter() { - QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); + QScopedPointer const dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Edit seam allowance width after")); dialog->SetFormula(GetFormulaSAWidthAfter()); dialog->setCheckLessThanZero(true); @@ -1051,7 +1051,7 @@ void DialogPiecePath::FXWidthAfter() //--------------------------------------------------------------------------------------------------------------------- void DialogPiecePath::FXVisible() { - QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); + QScopedPointer const dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Control visibility")); dialog->SetFormula(GetFormulaVisible()); if (dialog->exec() == QDialog::Accepted) @@ -1063,7 +1063,7 @@ void DialogPiecePath::FXVisible() //--------------------------------------------------------------------------------------------------------------------- void DialogPiecePath::FXPassmarkLength() { - QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); + QScopedPointer const dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Edit passmark length")); dialog->SetFormula(GetFormulaPassmarkLength()); dialog->setCheckZero(true); @@ -1078,7 +1078,7 @@ void DialogPiecePath::FXPassmarkLength() //--------------------------------------------------------------------------------------------------------------------- void DialogPiecePath::FXPassmarkWidth() { - QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); + QScopedPointer const dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Edit passmark width")); dialog->SetFormula(GetFormulaPassmarkWidth()); dialog->setCheckZero(true); @@ -1092,7 +1092,7 @@ void DialogPiecePath::FXPassmarkWidth() //--------------------------------------------------------------------------------------------------------------------- void DialogPiecePath::FXPassmarkAngle() { - QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); + QScopedPointer const dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Edit passmark angle")); dialog->SetFormula(GetFormulaPassmarkAngle()); dialog->setPostfix(degreeSymbol); @@ -1801,7 +1801,7 @@ void DialogPiecePath::SetPieceId(quint32 id) //--------------------------------------------------------------------------------------------------------------------- auto DialogPiecePath::GetFormulaSAWidth() const -> QString { - QString width = ui->plainTextEditFormulaWidth->toPlainText(); + QString const width = ui->plainTextEditFormulaWidth->toPlainText(); return VTranslateVars::TryFormulaFromUser(width, VAbstractApplication::VApp()->Settings()->GetOsSeparator()); } @@ -1920,21 +1920,21 @@ void DialogPiecePath::NewItem(const VPieceNode &node) //--------------------------------------------------------------------------------------------------------------------- auto DialogPiecePath::GetFormulaSAWidthBefore() const -> QString { - QString width = ui->plainTextEditFormulaWidthBefore->toPlainText(); + QString const width = ui->plainTextEditFormulaWidthBefore->toPlainText(); return VTranslateVars::TryFormulaFromUser(width, VAbstractApplication::VApp()->Settings()->GetOsSeparator()); } //--------------------------------------------------------------------------------------------------------------------- auto DialogPiecePath::GetFormulaSAWidthAfter() const -> QString { - QString width = ui->plainTextEditFormulaWidthAfter->toPlainText(); + QString const width = ui->plainTextEditFormulaWidthAfter->toPlainText(); return VTranslateVars::TryFormulaFromUser(width, VAbstractApplication::VApp()->Settings()->GetOsSeparator()); } //--------------------------------------------------------------------------------------------------------------------- auto DialogPiecePath::GetFormulaVisible() const -> QString { - QString formula = ui->plainTextEditFormulaVisible->toPlainText(); + QString const formula = ui->plainTextEditFormulaVisible->toPlainText(); return VTranslateVars::TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator()); } @@ -1955,7 +1955,7 @@ void DialogPiecePath::SetFormulaVisible(const QString &formula) //--------------------------------------------------------------------------------------------------------------------- auto DialogPiecePath::GetFormulaPassmarkLength() const -> QString { - QString formula = ui->plainTextEditPassmarkLength->toPlainText(); + QString const formula = ui->plainTextEditPassmarkLength->toPlainText(); return VTranslateVars::TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator()); } @@ -1976,7 +1976,7 @@ void DialogPiecePath::SetFormulaPassmarkLength(const QString &formula) //--------------------------------------------------------------------------------------------------------------------- auto DialogPiecePath::GetFormulaPassmarkWidth() const -> QString { - QString formula = ui->plainTextEditPassmarkWidth->toPlainText(); + QString const formula = ui->plainTextEditPassmarkWidth->toPlainText(); return VTranslateVars::TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator()); } @@ -1997,7 +1997,7 @@ void DialogPiecePath::SetFormulaPassmarkWidth(const QString &formula) //--------------------------------------------------------------------------------------------------------------------- auto DialogPiecePath::GetFormulaPassmarkAngle() const -> QString { - QString formula = ui->plainTextEditPassmarkWidth->toPlainText(); + QString const formula = ui->plainTextEditPassmarkWidth->toPlainText(); return VTranslateVars::TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator()); } @@ -2053,7 +2053,7 @@ void DialogPiecePath::InitPassmarkLengthFormula(const VPieceNode &node) if (passmarkLength.isEmpty()) { - qreal length = UnitConvertor(1, Unit::Cm, VAbstractValApplication::VApp()->patternUnits()); + qreal const length = UnitConvertor(1, Unit::Cm, VAbstractValApplication::VApp()->patternUnits()); ui->plainTextEditPassmarkLength->setPlainText(VAbstractApplication::VApp()->LocaleToString(length)); } else @@ -2063,7 +2063,7 @@ void DialogPiecePath::InitPassmarkLengthFormula(const VPieceNode &node) } else { - qreal length = UnitConvertor(1, Unit::Cm, VAbstractValApplication::VApp()->patternUnits()); + qreal const length = UnitConvertor(1, Unit::Cm, VAbstractValApplication::VApp()->patternUnits()); ui->plainTextEditPassmarkLength->setPlainText(VAbstractApplication::VApp()->LocaleToString(length)); } @@ -2099,7 +2099,7 @@ void DialogPiecePath::InitPassmarkWidthFormula(const VPieceNode &node) if (passmarkWidth.isEmpty()) { - qreal width = UnitConvertor(0.85, Unit::Cm, VAbstractValApplication::VApp()->patternUnits()); + qreal const width = UnitConvertor(0.85, Unit::Cm, VAbstractValApplication::VApp()->patternUnits()); ui->plainTextEditPassmarkWidth->setPlainText(VAbstractApplication::VApp()->LocaleToString(width)); } else @@ -2109,7 +2109,7 @@ void DialogPiecePath::InitPassmarkWidthFormula(const VPieceNode &node) } else { - qreal width = UnitConvertor(0.85, Unit::Cm, VAbstractValApplication::VApp()->patternUnits()); + qreal const width = UnitConvertor(0.85, Unit::Cm, VAbstractValApplication::VApp()->patternUnits()); ui->plainTextEditPassmarkWidth->setPlainText(VAbstractApplication::VApp()->LocaleToString(width)); } @@ -2117,7 +2117,7 @@ void DialogPiecePath::InitPassmarkWidthFormula(const VPieceNode &node) } else { - qreal width = UnitConvertor(0.85, Unit::Cm, VAbstractValApplication::VApp()->patternUnits()); + qreal const width = UnitConvertor(0.85, Unit::Cm, VAbstractValApplication::VApp()->patternUnits()); ui->plainTextEditPassmarkWidth->setPlainText(VAbstractApplication::VApp()->LocaleToString(width)); } ChangeColor(ui->labelEditPassmarkWidth, OkColor(this)); diff --git a/src/libs/vtools/dialogs/tools/piece/dialogplacelabel.cpp b/src/libs/vtools/dialogs/tools/piece/dialogplacelabel.cpp index 613c00ee6..75244d7cc 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogplacelabel.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogplacelabel.cpp @@ -387,7 +387,7 @@ void DialogPlaceLabel::EvalVisible() //--------------------------------------------------------------------------------------------------------------------- void DialogPlaceLabel::FXWidth() { - QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); + QScopedPointer const dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Edit rectangle width")); dialog->SetFormula(GetWidth()); dialog->setCheckLessThanZero(true); @@ -401,7 +401,7 @@ void DialogPlaceLabel::FXWidth() //--------------------------------------------------------------------------------------------------------------------- void DialogPlaceLabel::FXHeight() { - QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); + QScopedPointer const dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Edit rectangle width")); dialog->SetFormula(GetHeight()); dialog->setCheckLessThanZero(true); @@ -415,7 +415,7 @@ void DialogPlaceLabel::FXHeight() //--------------------------------------------------------------------------------------------------------------------- void DialogPlaceLabel::FXAngle() { - QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); + QScopedPointer const dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Edit angle")); dialog->SetFormula(GetAngle()); dialog->setPostfix(degreeSymbol); @@ -428,7 +428,7 @@ void DialogPlaceLabel::FXAngle() //--------------------------------------------------------------------------------------------------------------------- void DialogPlaceLabel::FXVisible() { - QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); + QScopedPointer const dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Control visibility")); dialog->SetFormula(GetFormulaVisible()); if (dialog->exec() == QDialog::Accepted) @@ -574,7 +574,7 @@ void DialogPlaceLabel::InitIcons() //--------------------------------------------------------------------------------------------------------------------- auto DialogPlaceLabel::GetFormulaVisible() const -> QString { - QString formula = ui->plainTextEditFormulaVisible->toPlainText(); + QString const formula = ui->plainTextEditFormulaVisible->toPlainText(); return VTranslateVars::TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator()); } diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp index ef900cb8a..ced0b9df5 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp @@ -139,7 +139,7 @@ void InitComboBoxFormats(QComboBox *box, const QStringList &items, const QString box->blockSignals(true); box->addItems(items); - int index = box->findText(currentFormat); + int const index = box->findText(currentFormat); if (index != -1) { box->setCurrentIndex(index); @@ -596,9 +596,9 @@ void DialogSeamAllowance::SaveData() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::CheckTabPathsState() { - bool isValid = flagFormula && flagFormulaBefore && flagFormulaAfter; - bool isMainPathValid = flagMainPathIsValid && flagMirrorLineIsValid; - bool isNameAndUUIDValid = flagName && flagUUID; + bool const isValid = flagFormula && flagFormulaBefore && flagFormulaAfter; + bool const isMainPathValid = flagMainPathIsValid && flagMirrorLineIsValid; + bool const isNameAndUUIDValid = flagName && flagUUID; m_ftb->SetTabText(TabOrder::Paths, (isValid && flagMainPathIsValid && isNameAndUUIDValid) ? tr("Paths") : tr("Paths") + '*'_L1); @@ -1069,9 +1069,9 @@ void DialogSeamAllowance::DetailUUIDChanged() auto *edit = qobject_cast(sender()); if (edit) { - static QRegularExpression re("^$|^{[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-" + static QRegularExpression const re("^$|^{[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-" "[0-9a-fA-F]{12}}$"); - QRegularExpressionMatch match = re.match(edit->text()); + QRegularExpressionMatch const match = re.match(edit->text()); if (match.hasMatch()) { @@ -1101,7 +1101,7 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos) auto rowNode = qvariant_cast(rowItem->data(Qt::UserRole)); QMenu menu; - QHash contextMenu = InitMainPathContextMenu(&menu, rowNode); + QHash const contextMenu = InitMainPathContextMenu(&menu, rowNode); QAction *selectedAction = menu.exec(uiTabPaths->listWidgetMainPath->viewport()->mapToGlobal(pos)); auto selectedOption = static_cast( @@ -1202,7 +1202,7 @@ void DialogSeamAllowance::ShowCustomSAContextMenu(const QPoint &pos) return; } - QScopedPointer menu(new QMenu()); + QScopedPointer const menu(new QMenu()); QAction *actionOption = menu->addAction(QIcon::fromTheme(preferencesOtherIcon), tr("Options")); QListWidgetItem *rowItem = uiTabPaths->listWidgetCustomSA->item(row); @@ -1254,7 +1254,7 @@ void DialogSeamAllowance::ShowInternalPathsContextMenu(const QPoint &pos) return; } - QScopedPointer menu(new QMenu()); + QScopedPointer const menu(new QMenu()); QAction *actionOption = menu->addAction(QIcon::fromTheme(preferencesOtherIcon), tr("Options")); QAction *actionDelete = menu->addAction(QIcon::fromTheme(editDeleteIcon), tr("Delete")); @@ -1289,7 +1289,7 @@ void DialogSeamAllowance::ShowPinsContextMenu(const QPoint &pos) return; } - QScopedPointer menu(new QMenu()); + QScopedPointer const menu(new QMenu()); QAction *actionDelete = menu->addAction(QIcon::fromTheme(editDeleteIcon), tr("Delete")); QAction *selectedAction = menu->exec(uiTabPins->listWidgetPins->viewport()->mapToGlobal(pos)); @@ -1332,7 +1332,7 @@ void DialogSeamAllowance::ShowPlaceLabelsContextMenu(const QPoint &pos) newLabel.SetLabelType(type); m_newPlaceLabels.insert(labelId, newLabel); - QPointer saveCommand = new SavePlaceLabelOptions( + QPointer const saveCommand = new SavePlaceLabelOptions( toolId, currentLabel, newLabel, VAbstractValApplication::VApp()->getCurrentDocument(), const_cast(data), labelId); m_undoStack.append(saveCommand); @@ -1756,11 +1756,11 @@ void DialogSeamAllowance::PathDialogClosed(int result) SCASSERT(dialogTool != nullptr); try { - VPiecePath currentPath = CurrentPath(dialogTool->GetToolId()); - VPiecePath newPath = dialogTool->GetPiecePath(); + VPiecePath const currentPath = CurrentPath(dialogTool->GetToolId()); + VPiecePath const newPath = dialogTool->GetPiecePath(); m_newPaths.insert(dialogTool->GetToolId(), newPath); - QPointer saveCommand = new SavePiecePathOptions( + QPointer const saveCommand = new SavePiecePathOptions( toolId, currentPath, newPath, VAbstractValApplication::VApp()->getCurrentDocument(), const_cast(data), dialogTool->GetToolId()); m_undoStack.append(saveCommand); @@ -1786,7 +1786,7 @@ void DialogSeamAllowance::PlaceLabelDialogClosed(int result) SCASSERT(dialogTool != nullptr); try { - VPlaceLabelItem currentLabel = CurrentPlaceLabel(dialogTool->GetToolId()); + VPlaceLabelItem const currentLabel = CurrentPlaceLabel(dialogTool->GetToolId()); const QHash> *vars = data->DataVariables(); @@ -1813,7 +1813,7 @@ void DialogSeamAllowance::PlaceLabelDialogClosed(int result) m_newPlaceLabels.insert(dialogTool->GetToolId(), newLabel); - QPointer saveCommand = new SavePlaceLabelOptions( + QPointer const saveCommand = new SavePlaceLabelOptions( toolId, currentLabel, newLabel, VAbstractValApplication::VApp()->getCurrentDocument(), const_cast(data), dialogTool->GetToolId()); m_undoStack.append(saveCommand); @@ -2094,7 +2094,7 @@ void DialogSeamAllowance::UpdateGrainlineValues() qsFormula = VAbstractApplication::VApp()->TrVars()->FormulaFromUser( qsFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator()); Calculator cal; - qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula); + qreal const dVal = cal.EvalFormula(data->DataVariables(), qsFormula); if (qIsInf(dVal) || qIsNaN(dVal)) { throw qmu::QmuParserError(tr("Infinite/undefined result")); @@ -2175,7 +2175,7 @@ void DialogSeamAllowance::UpdateDetailLabelValues() qsFormula = VAbstractApplication::VApp()->TrVars()->FormulaFromUser( qsFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator()); Calculator cal; - qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula); + qreal const dVal = cal.EvalFormula(data->DataVariables(), qsFormula); if (qIsInf(dVal) || qIsNaN(dVal)) { throw qmu::QmuParserError(tr("Infinite/undefined result")); @@ -2258,7 +2258,7 @@ void DialogSeamAllowance::UpdatePatternLabelValues() qsFormula = VAbstractApplication::VApp()->TrVars()->FormulaFromUser( qsFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator()); Calculator cal; - qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula); + qreal const dVal = cal.EvalFormula(data->DataVariables(), qsFormula); if (qIsInf(dVal) || qIsNaN(dVal)) { throw qmu::QmuParserError(tr("Infinite/undefined result")); @@ -2490,7 +2490,7 @@ void DialogSeamAllowance::EditGrainlineFormula() dlg.setCheckZero(bCheckZero); if (dlg.exec() == QDialog::Accepted) { - QString qsFormula = dlg.GetFormula(); + QString const qsFormula = dlg.GetFormula(); if (sender() == uiTabGrainline->pushButtonLen) { @@ -2547,7 +2547,7 @@ void DialogSeamAllowance::EditDLFormula() dlg.setCheckZero(bCheckZero); if (dlg.exec() == QDialog::Accepted) { - QString qsFormula = dlg.GetFormula(); + QString const qsFormula = dlg.GetFormula(); if (sender() == uiTabLabels->pushButtonDLHeight) { SetDLHeight(qsFormula); @@ -2607,7 +2607,7 @@ void DialogSeamAllowance::EditPLFormula() dlg.setCheckZero(bCheckZero); if (dlg.exec() == QDialog::Accepted) { - QString qsFormula = dlg.GetFormula(); + QString const qsFormula = dlg.GetFormula(); if (sender() == uiTabLabels->pushButtonPLHeight) { SetPLHeight(qsFormula); @@ -2938,7 +2938,7 @@ void DialogSeamAllowance::EvalFoldCenter() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::FXWidth() { - QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); + QScopedPointer const dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Edit seam allowance width")); dialog->SetFormula(GetFormulaSAWidth()); dialog->setCheckLessThanZero(true); @@ -2952,7 +2952,7 @@ void DialogSeamAllowance::FXWidth() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::FXWidthBefore() { - QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); + QScopedPointer const dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Edit seam allowance width before")); dialog->SetFormula(GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidthBefore)); dialog->setCheckLessThanZero(true); @@ -2966,7 +2966,7 @@ void DialogSeamAllowance::FXWidthBefore() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::FXWidthAfter() { - QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); + QScopedPointer const dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Edit seam allowance width after")); dialog->SetFormula(GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidthAfter)); dialog->setCheckLessThanZero(true); @@ -2980,7 +2980,7 @@ void DialogSeamAllowance::FXWidthAfter() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::FXPassmarkLength() { - QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); + QScopedPointer const dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Edit passmark length")); dialog->SetFormula(GetFormulaFromUser(uiTabPassmarks->plainTextEditPassmarkLength)); dialog->setCheckLessThanZero(true); @@ -2995,7 +2995,7 @@ void DialogSeamAllowance::FXPassmarkLength() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::FXPassmarkWidth() { - QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); + QScopedPointer const dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Edit passmark width")); dialog->SetFormula(GetFormulaFromUser(uiTabPassmarks->plainTextEditPassmarkWidth)); dialog->setCheckZero(true); @@ -3009,7 +3009,7 @@ void DialogSeamAllowance::FXPassmarkWidth() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::FXPassmarkAngle() { - QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); + QScopedPointer const dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Edit passmark angle")); dialog->SetFormula(GetFormulaFromUser(uiTabPassmarks->plainTextEditPassmarkAngle)); dialog->setPostfix(degreeSymbol); @@ -4471,7 +4471,7 @@ void DialogSeamAllowance::InitLabelFontSize(QComboBox *box) //--------------------------------------------------------------------------------------------------------------------- auto DialogSeamAllowance::GetFormulaSAWidth() const -> QString { - QString width = uiTabPaths->plainTextEditFormulaWidth->toPlainText(); + QString const width = uiTabPaths->plainTextEditFormulaWidth->toPlainText(); return VTranslateVars::TryFormulaFromUser(width, VAbstractApplication::VApp()->Settings()->GetOsSeparator()); } @@ -4812,7 +4812,7 @@ auto DialogSeamAllowance::CurrentRect() const -> QRectF QRectF rect; if (QListWidgetItem *item = uiTabPlaceLabels->listWidgetPlaceLabels->currentItem()) { - VPlaceLabelItem label = CurrentPlaceLabel(qvariant_cast(item->data(Qt::UserRole))); + VPlaceLabelItem const label = CurrentPlaceLabel(qvariant_cast(item->data(Qt::UserRole))); rect = QRectF(QPointF(label.x() - label.GetWidth() / 2.0, label.y() - label.GetHeight() / 2.0), QPointF(label.x() + label.GetWidth() / 2.0, label.y() + label.GetHeight() / 2.0)); } @@ -4861,7 +4861,7 @@ auto DialogSeamAllowance::CurrentPlaceLabel(quint32 id) const -> VPlaceLabelItem //--------------------------------------------------------------------------------------------------------------------- auto DialogSeamAllowance::GetDefaultPieceName() const -> QString { - QList pieces = data->DataPieces()->values(); + QList const pieces = data->DataPieces()->values(); QSet names; for (auto &piece : pieces) @@ -4967,7 +4967,7 @@ void DialogSeamAllowance::SavePatternMaterialData() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::InitGradationPlaceholdersMenu() { - QChar per('%'); + QChar const per('%'); auto i = m_gradationPlaceholders.constBegin(); while (i != m_gradationPlaceholders.constEnd()) { @@ -4983,19 +4983,19 @@ void DialogSeamAllowance::InitGradationPlaceholdersMenu() void DialogSeamAllowance::InitGradationPlaceholders() { // Pattern tags - QString heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight()); + QString const heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight()); m_gradationPlaceholders.insert(pl_height, qMakePair(tr("Height", "dimension"), heightValue)); m_gradationPlaceholders.insert(pl_dimensionX, qMakePair(tr("Dimension X", "dimension"), heightValue)); - QString sizeValue = QString::number(VAbstractValApplication::VApp()->GetDimensionSize()); + QString const sizeValue = QString::number(VAbstractValApplication::VApp()->GetDimensionSize()); m_gradationPlaceholders.insert(pl_size, qMakePair(tr("Size", "dimension"), sizeValue)); m_gradationPlaceholders.insert(pl_dimensionY, qMakePair(tr("Dimension Y", "dimension"), sizeValue)); - QString hipValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHip()); + QString const hipValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHip()); m_gradationPlaceholders.insert(pl_hip, qMakePair(tr("Hip", "dimension"), hipValue)); m_gradationPlaceholders.insert(pl_dimensionZ, qMakePair(tr("Dimension Z", "dimension"), hipValue)); - QString waistValue = QString::number(VAbstractValApplication::VApp()->GetDimensionWaist()); + QString const waistValue = QString::number(VAbstractValApplication::VApp()->GetDimensionWaist()); m_gradationPlaceholders.insert(pl_waist, qMakePair(tr("Waist", "dimension"), waistValue)); m_gradationPlaceholders.insert(pl_dimensionW, qMakePair(tr("Dimension W", "dimension"), waistValue)); @@ -5030,7 +5030,7 @@ void DialogSeamAllowance::InitGradationPlaceholders() auto i = measurements.constBegin(); while (i != measurements.constEnd()) { - QString description = i.value()->GetGuiText().isEmpty() ? i.key() : i.value()->GetGuiText(); + QString const description = i.value()->GetGuiText().isEmpty() ? i.key() : i.value()->GetGuiText(); m_gradationPlaceholders.insert( pl_measurement + i.key(), qMakePair(tr("Measurement: %1").arg(description), QString::number(*i.value()->GetValue()))); @@ -5065,7 +5065,7 @@ void DialogSeamAllowance::InitPassmarkLengthFormula(const VPieceNode &node) if (passmarkLength.isEmpty()) { - qreal length = UnitConvertor(1, Unit::Cm, VAbstractValApplication::VApp()->patternUnits()); + qreal const length = UnitConvertor(1, Unit::Cm, VAbstractValApplication::VApp()->patternUnits()); uiTabPassmarks->plainTextEditPassmarkLength->setPlainText( VAbstractApplication::VApp()->LocaleToString(length)); } @@ -5076,7 +5076,7 @@ void DialogSeamAllowance::InitPassmarkLengthFormula(const VPieceNode &node) } else { - qreal length = UnitConvertor(1, Unit::Cm, VAbstractValApplication::VApp()->patternUnits()); + qreal const length = UnitConvertor(1, Unit::Cm, VAbstractValApplication::VApp()->patternUnits()); uiTabPassmarks->plainTextEditPassmarkLength->setPlainText(VAbstractApplication::VApp()->LocaleToString(length)); } @@ -5112,7 +5112,7 @@ void DialogSeamAllowance::InitPassmarkWidthFormula(const VPieceNode &node) if (passmarkWidth.isEmpty()) { - qreal width = UnitConvertor(0.85, Unit::Cm, VAbstractValApplication::VApp()->patternUnits()); + qreal const width = UnitConvertor(0.85, Unit::Cm, VAbstractValApplication::VApp()->patternUnits()); uiTabPassmarks->plainTextEditPassmarkWidth->setPlainText( VAbstractApplication::VApp()->LocaleToString(width)); } @@ -5123,7 +5123,7 @@ void DialogSeamAllowance::InitPassmarkWidthFormula(const VPieceNode &node) } else { - qreal length = UnitConvertor(0.85, Unit::Cm, VAbstractValApplication::VApp()->patternUnits()); + qreal const length = UnitConvertor(0.85, Unit::Cm, VAbstractValApplication::VApp()->patternUnits()); uiTabPassmarks->plainTextEditPassmarkWidth->setPlainText( VAbstractApplication::VApp()->LocaleToString(length)); } @@ -5132,7 +5132,7 @@ void DialogSeamAllowance::InitPassmarkWidthFormula(const VPieceNode &node) } else { - qreal length = UnitConvertor(0.85, Unit::Cm, VAbstractValApplication::VApp()->patternUnits()); + qreal const length = UnitConvertor(0.85, Unit::Cm, VAbstractValApplication::VApp()->patternUnits()); uiTabPassmarks->plainTextEditPassmarkWidth->setPlainText(VAbstractApplication::VApp()->LocaleToString(length)); } ChangeColor(uiTabPassmarks->labelEditPassmarkWidth, OkColor(this)); @@ -5428,7 +5428,7 @@ void DialogSeamAllowance::EditPatternLabel() { if (m_patternLabelDataChanged && m_askSavePatternLabelData) { - QMessageBox::StandardButton answer = QMessageBox::question( + QMessageBox::StandardButton const answer = QMessageBox::question( this, tr("Save label data."), tr("Label data were changed. Do you want to save them before editing label template?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); diff --git a/src/libs/vtools/tools/backgroundimage/vbackgroundimagecontrols.cpp b/src/libs/vtools/tools/backgroundimage/vbackgroundimagecontrols.cpp index 14f48737f..849060efb 100644 --- a/src/libs/vtools/tools/backgroundimage/vbackgroundimagecontrols.cpp +++ b/src/libs/vtools/tools/backgroundimage/vbackgroundimagecontrols.cpp @@ -187,7 +187,7 @@ auto VBackgroundImageControls::boundingRect() const -> QRectF auto HandlerBoundingRect = [this, &boundingRect](BIHandleCorner corner, BIHandleCornerType type, QPointF pos) { - QPixmap handler = HandlerPixmap(m_handleCornerHover == corner, type); + QPixmap const handler = HandlerPixmap(m_handleCornerHover == corner, type); boundingRect = boundingRect.united(QRectF(pos, handler.size() / handler.devicePixelRatio())); }; @@ -485,7 +485,7 @@ void VBackgroundImageControls::InitPixmaps() const QString resource = QStringLiteral("icon"); const QString fileName = QStringLiteral("32x32/%1.png").arg(imageName); - QPixmap handlePixmap = VTheme::GetPixmapResource(resource, fileName); + QPixmap const handlePixmap = VTheme::GetPixmapResource(resource, fileName); if (QGuiApplication::primaryScreen()->devicePixelRatio() >= 2) { @@ -532,27 +532,27 @@ auto VBackgroundImageControls::TopLeftHandlerPosition() const -> QPointF //--------------------------------------------------------------------------------------------------------------------- auto VBackgroundImageControls::TopHandlerPosition() const -> QPointF { - QRectF rect = ControllersRect(); - QPixmap handler = m_handlePixmaps.value(BIHandleCornerType::ScaleTopBottom); - QSize size = handler.size() / handler.devicePixelRatio(); + QRectF const rect = ControllersRect(); + QPixmap const handler = m_handlePixmaps.value(BIHandleCornerType::ScaleTopBottom); + QSize const size = handler.size() / handler.devicePixelRatio(); return {rect.topLeft().x() + (rect.width() / 2. - size.width() / 2.), rect.topLeft().y()}; } //--------------------------------------------------------------------------------------------------------------------- auto VBackgroundImageControls::TopRightHandlerPosition() const -> QPointF { - QRectF rect = ControllersRect(); - QPixmap handler = m_handlePixmaps.value(BIHandleCornerType::ScaleTopRightBottomLeft); - QSize size = handler.size() / handler.devicePixelRatio(); + QRectF const rect = ControllersRect(); + QPixmap const handler = m_handlePixmaps.value(BIHandleCornerType::ScaleTopRightBottomLeft); + QSize const size = handler.size() / handler.devicePixelRatio(); return {rect.topLeft().x() + (rect.width() - size.width()), rect.topLeft().y()}; } //--------------------------------------------------------------------------------------------------------------------- auto VBackgroundImageControls::RightHandlerPosition() const -> QPointF { - QRectF rect = ControllersRect(); - QPixmap handler = m_handlePixmaps.value(BIHandleCornerType::ScaleRightLeft); - QSize size = handler.size() / handler.devicePixelRatio(); + QRectF const rect = ControllersRect(); + QPixmap const handler = m_handlePixmaps.value(BIHandleCornerType::ScaleRightLeft); + QSize const size = handler.size() / handler.devicePixelRatio(); return {rect.topLeft().x() + (rect.width() - size.width()), rect.topLeft().y() + (rect.height() / 2. - size.height() / 2.)}; } @@ -560,18 +560,18 @@ auto VBackgroundImageControls::RightHandlerPosition() const -> QPointF //--------------------------------------------------------------------------------------------------------------------- auto VBackgroundImageControls::BottomRightHandlerPosition() const -> QPointF { - QRectF rect = ControllersRect(); - QPixmap handler = m_handlePixmaps.value(BIHandleCornerType::ScaleTopLeftBottomRight); - QSize size = handler.size() / handler.devicePixelRatio(); + QRectF const rect = ControllersRect(); + QPixmap const handler = m_handlePixmaps.value(BIHandleCornerType::ScaleTopLeftBottomRight); + QSize const size = handler.size() / handler.devicePixelRatio(); return {rect.topLeft().x() + (rect.width() - size.width()), rect.topLeft().y() + (rect.height() - size.height())}; } //--------------------------------------------------------------------------------------------------------------------- auto VBackgroundImageControls::BottomHandlerPosition() const -> QPointF { - QRectF rect = ControllersRect(); - QPixmap handler = m_handlePixmaps.value(BIHandleCornerType::ScaleTopBottom); - QSize size = handler.size() / handler.devicePixelRatio(); + QRectF const rect = ControllersRect(); + QPixmap const handler = m_handlePixmaps.value(BIHandleCornerType::ScaleTopBottom); + QSize const size = handler.size() / handler.devicePixelRatio(); return {rect.topLeft().x() + (rect.width() / 2. - size.width() / 2.), rect.topLeft().y() + (rect.height() - size.height())}; } @@ -579,18 +579,18 @@ auto VBackgroundImageControls::BottomHandlerPosition() const -> QPointF //--------------------------------------------------------------------------------------------------------------------- auto VBackgroundImageControls::BottomLeftHandlerPosition() const -> QPointF { - QRectF rect = ControllersRect(); - QPixmap handler = m_handlePixmaps.value(BIHandleCornerType::ScaleTopRightBottomLeft); - QSize size = handler.size() / handler.devicePixelRatio(); + QRectF const rect = ControllersRect(); + QPixmap const handler = m_handlePixmaps.value(BIHandleCornerType::ScaleTopRightBottomLeft); + QSize const size = handler.size() / handler.devicePixelRatio(); return {rect.topLeft().x(), rect.topLeft().y() + (rect.height() - size.height())}; } //--------------------------------------------------------------------------------------------------------------------- auto VBackgroundImageControls::LeftHandlerPosition() const -> QPointF { - QRectF rect = ControllersRect(); - QPixmap handler = m_handlePixmaps.value(BIHandleCornerType::ScaleRightLeft); - QSize size = handler.size() / handler.devicePixelRatio(); + QRectF const rect = ControllersRect(); + QPixmap const handler = m_handlePixmaps.value(BIHandleCornerType::ScaleRightLeft); + QSize const size = handler.size() / handler.devicePixelRatio(); return {rect.topLeft().x(), rect.topLeft().y() + (rect.height() / 2. - size.height() / 2.)}; } @@ -682,7 +682,7 @@ auto VBackgroundImageControls::RotateBottomLeftControl() const -> QPainterPath //--------------------------------------------------------------------------------------------------------------------- auto VBackgroundImageControls::ScaleByTopLeft(QGraphicsSceneMouseEvent *event) const -> QTransform { - QRectF rectOriginal = m_imageBoundingRect; + QRectF const rectOriginal = m_imageBoundingRect; QRectF rect = m_imageScreenBoundingRect; const qreal adjustmentX = -rect.topLeft().x(); @@ -777,18 +777,18 @@ auto VBackgroundImageControls::ScaleByTopLeft(QGraphicsSceneMouseEvent *event) c } } - QPointF newScalePoint = pos - m_scaleDiff; + QPointF const newScalePoint = pos - m_scaleDiff; QTransform m; - QPointF scaleCenterOriginal = + QPointF const scaleCenterOriginal = (event->modifiers() & Qt::ShiftModifier) ? rectOriginal.center() : rectOriginal.bottomRight(); m.translate(scaleCenterOriginal.x(), scaleCenterOriginal.y()); m.scale(scaleX, scaleY); - QPointF scaleCenter = (event->modifiers() & Qt::ShiftModifier) ? rect.center() : rect.bottomRight(); + QPointF const scaleCenter = (event->modifiers() & Qt::ShiftModifier) ? rect.center() : rect.bottomRight(); if (newScalePoint.x() > scaleCenter.x()) { @@ -808,7 +808,7 @@ auto VBackgroundImageControls::ScaleByTopLeft(QGraphicsSceneMouseEvent *event) c //--------------------------------------------------------------------------------------------------------------------- auto VBackgroundImageControls::ScaleByTop(QGraphicsSceneMouseEvent *event) const -> QTransform { - QRectF rectOriginal = m_imageBoundingRect; + QRectF const rectOriginal = m_imageBoundingRect; QRectF rect = m_imageScreenBoundingRect; const qreal adjustmentX = -rect.topLeft().x(); @@ -832,7 +832,7 @@ auto VBackgroundImageControls::ScaleByTop(QGraphicsSceneMouseEvent *event) const centerScalePoint.ry() = rect.center().y() - (centerScalePoint.y() - rect.center().y()); } - QPointF diff = centerScalePoint - RectTopPoint(rect); + QPointF const diff = centerScalePoint - RectTopPoint(rect); if (event->modifiers() & Qt::ControlModifier) { @@ -856,24 +856,24 @@ auto VBackgroundImageControls::ScaleByTop(QGraphicsSceneMouseEvent *event) const } qreal scaleX = nowRect.height() / rect.height(); - qreal scaleY = nowRect.height() / rect.height(); + qreal const scaleY = nowRect.height() / rect.height(); if (event->modifiers() & Qt::ControlModifier) { scaleX = 1; } - QPointF newScalePoint = pos - m_scaleDiff; + QPointF const newScalePoint = pos - m_scaleDiff; QTransform m; - QPointF scaleCenterOriginal = + QPointF const scaleCenterOriginal = (event->modifiers() & Qt::ShiftModifier) ? rectOriginal.center() : RectBottomPoint(rectOriginal); m.translate(scaleCenterOriginal.x(), scaleCenterOriginal.y()); m.scale(scaleX, scaleY); - QPointF scaleCenter = (event->modifiers() & Qt::ShiftModifier) ? rect.center() : rect.bottomRight(); + QPointF const scaleCenter = (event->modifiers() & Qt::ShiftModifier) ? rect.center() : rect.bottomRight(); if (newScalePoint.y() > scaleCenter.y()) { @@ -888,7 +888,7 @@ auto VBackgroundImageControls::ScaleByTop(QGraphicsSceneMouseEvent *event) const //--------------------------------------------------------------------------------------------------------------------- auto VBackgroundImageControls::ScaleByTopRight(QGraphicsSceneMouseEvent *event) const -> QTransform { - QRectF rectOriginal = m_imageBoundingRect; + QRectF const rectOriginal = m_imageBoundingRect; QRectF rect = m_imageScreenBoundingRect; const qreal adjustmentX = -rect.topLeft().x(); @@ -991,16 +991,16 @@ auto VBackgroundImageControls::ScaleByTopRight(QGraphicsSceneMouseEvent *event) } } - QPointF newScalePoint = pos - m_scaleDiff; + QPointF const newScalePoint = pos - m_scaleDiff; QTransform m; - QPointF scaleCenterOriginal = + QPointF const scaleCenterOriginal = (event->modifiers() & Qt::ShiftModifier) ? rectOriginal.center() : rectOriginal.bottomLeft(); m.translate(scaleCenterOriginal.x(), scaleCenterOriginal.y()); m.scale(scaleX, scaleY); - QPointF scaleCenter = (event->modifiers() & Qt::ShiftModifier) ? rect.center() : rect.bottomLeft(); + QPointF const scaleCenter = (event->modifiers() & Qt::ShiftModifier) ? rect.center() : rect.bottomLeft(); if (newScalePoint.x() < scaleCenter.x()) { @@ -1020,7 +1020,7 @@ auto VBackgroundImageControls::ScaleByTopRight(QGraphicsSceneMouseEvent *event) //--------------------------------------------------------------------------------------------------------------------- auto VBackgroundImageControls::ScaleByRight(QGraphicsSceneMouseEvent *event) const -> QTransform { - QRectF rectOriginal = m_imageBoundingRect; + QRectF const rectOriginal = m_imageBoundingRect; QRectF rect = m_imageScreenBoundingRect; const qreal adjustmentX = -rect.topLeft().x(); @@ -1045,7 +1045,7 @@ auto VBackgroundImageControls::ScaleByRight(QGraphicsSceneMouseEvent *event) con centerScalePoint.rx() = rect.center().x() + (rect.center().x() - centerScalePoint.x()); } - QPointF diff = centerScalePoint - RectRightPoint(rect); + QPointF const diff = centerScalePoint - RectRightPoint(rect); if (event->modifiers() & Qt::ControlModifier) { @@ -1068,7 +1068,7 @@ auto VBackgroundImageControls::ScaleByRight(QGraphicsSceneMouseEvent *event) con nowRect = QRectF(rect.topLeft(), QPointF(newScalePoint.x(), rect.bottomRight().y())); } - qreal scaleX = nowRect.width() / rect.width(); + qreal const scaleX = nowRect.width() / rect.width(); qreal scaleY = nowRect.width() / rect.width(); if (event->modifiers() & Qt::ControlModifier) @@ -1076,17 +1076,17 @@ auto VBackgroundImageControls::ScaleByRight(QGraphicsSceneMouseEvent *event) con scaleY = 1; } - QPointF newScalePoint = pos - m_scaleDiff; + QPointF const newScalePoint = pos - m_scaleDiff; QTransform m; - QPointF scaleCenterOriginal = + QPointF const scaleCenterOriginal = (event->modifiers() & Qt::ShiftModifier) ? rectOriginal.center() : RectLeftPoint(rectOriginal); m.translate(scaleCenterOriginal.x(), scaleCenterOriginal.y()); m.scale(scaleX, scaleY); - QPointF scaleCenter = (event->modifiers() & Qt::ShiftModifier) ? rect.center() : RectLeftPoint(rect); + QPointF const scaleCenter = (event->modifiers() & Qt::ShiftModifier) ? rect.center() : RectLeftPoint(rect); if (newScalePoint.x() < scaleCenter.x()) { @@ -1101,7 +1101,7 @@ auto VBackgroundImageControls::ScaleByRight(QGraphicsSceneMouseEvent *event) con //--------------------------------------------------------------------------------------------------------------------- auto VBackgroundImageControls::ScaleByBottomRight(QGraphicsSceneMouseEvent *event) const -> QTransform { - QRectF rectOriginal = m_imageBoundingRect; + QRectF const rectOriginal = m_imageBoundingRect; QRectF rect = m_imageScreenBoundingRect; // move to origin @@ -1199,18 +1199,18 @@ auto VBackgroundImageControls::ScaleByBottomRight(QGraphicsSceneMouseEvent *even } // prepare transformation - QPointF newScalePoint = pos - m_scaleDiff; + QPointF const newScalePoint = pos - m_scaleDiff; QTransform m; - QPointF scaleCenterOriginal = + QPointF const scaleCenterOriginal = (event->modifiers() & Qt::ShiftModifier) ? rectOriginal.center() : rectOriginal.topLeft(); m.translate(scaleCenterOriginal.x(), scaleCenterOriginal.y()); m.scale(scaleX, scaleY); - QPointF scaleCenter = (event->modifiers() & Qt::ShiftModifier) ? rect.center() : rect.topLeft(); + QPointF const scaleCenter = (event->modifiers() & Qt::ShiftModifier) ? rect.center() : rect.topLeft(); if (newScalePoint.x() < scaleCenter.x()) { @@ -1230,7 +1230,7 @@ auto VBackgroundImageControls::ScaleByBottomRight(QGraphicsSceneMouseEvent *even //--------------------------------------------------------------------------------------------------------------------- auto VBackgroundImageControls::ScaleByBottom(QGraphicsSceneMouseEvent *event) const -> QTransform { - QRectF rectOriginal = m_imageBoundingRect; + QRectF const rectOriginal = m_imageBoundingRect; QRectF rect = m_imageScreenBoundingRect; const qreal adjustmentX = -rect.topLeft().x(); @@ -1254,7 +1254,7 @@ auto VBackgroundImageControls::ScaleByBottom(QGraphicsSceneMouseEvent *event) co centerScalePoint.ry() = rect.center().y() + (rect.center().y() - centerScalePoint.y()); } - QPointF diff = centerScalePoint - RectBottomPoint(rect); + QPointF const diff = centerScalePoint - RectBottomPoint(rect); if (event->modifiers() & Qt::ControlModifier) { @@ -1278,24 +1278,24 @@ auto VBackgroundImageControls::ScaleByBottom(QGraphicsSceneMouseEvent *event) co } qreal scaleX = nowRect.height() / rect.height(); - qreal scaleY = nowRect.height() / rect.height(); + qreal const scaleY = nowRect.height() / rect.height(); if (event->modifiers() & Qt::ControlModifier) { scaleX = 1; } - QPointF newScalePoint = pos - m_scaleDiff; + QPointF const newScalePoint = pos - m_scaleDiff; QTransform m; - QPointF scaleCenterOriginal = + QPointF const scaleCenterOriginal = (event->modifiers() & Qt::ShiftModifier) ? rectOriginal.center() : RectTopPoint(rectOriginal); m.translate(scaleCenterOriginal.x(), scaleCenterOriginal.y()); m.scale(scaleX, scaleY); - QPointF scaleCenter = (event->modifiers() & Qt::ShiftModifier) ? rect.center() : RectTopPoint(rect); + QPointF const scaleCenter = (event->modifiers() & Qt::ShiftModifier) ? rect.center() : RectTopPoint(rect); if (newScalePoint.y() < scaleCenter.y()) { @@ -1310,7 +1310,7 @@ auto VBackgroundImageControls::ScaleByBottom(QGraphicsSceneMouseEvent *event) co //--------------------------------------------------------------------------------------------------------------------- auto VBackgroundImageControls::ScaleByBottomLeft(QGraphicsSceneMouseEvent *event) const -> QTransform { - QRectF rectOriginal = m_imageBoundingRect; + QRectF const rectOriginal = m_imageBoundingRect; QRectF rect = m_imageScreenBoundingRect; const qreal adjustmentX = -rect.topLeft().x(); @@ -1414,16 +1414,16 @@ auto VBackgroundImageControls::ScaleByBottomLeft(QGraphicsSceneMouseEvent *event } } - QPointF newScalePoint = pos - m_scaleDiff; + QPointF const newScalePoint = pos - m_scaleDiff; QTransform m; - QPointF scaleCenterOriginal = + QPointF const scaleCenterOriginal = (event->modifiers() & Qt::ShiftModifier) ? rectOriginal.center() : rectOriginal.topRight(); m.translate(scaleCenterOriginal.x(), scaleCenterOriginal.y()); m.scale(scaleX, scaleY); - QPointF scaleCenter = (event->modifiers() & Qt::ShiftModifier) ? rect.center() : rect.topRight(); + QPointF const scaleCenter = (event->modifiers() & Qt::ShiftModifier) ? rect.center() : rect.topRight(); if (newScalePoint.x() > scaleCenter.x()) { @@ -1443,7 +1443,7 @@ auto VBackgroundImageControls::ScaleByBottomLeft(QGraphicsSceneMouseEvent *event //--------------------------------------------------------------------------------------------------------------------- auto VBackgroundImageControls::ScaleByLeft(QGraphicsSceneMouseEvent *event) const -> QTransform { - QRectF rectOriginal = m_imageBoundingRect; + QRectF const rectOriginal = m_imageBoundingRect; QRectF rect = m_imageScreenBoundingRect; const qreal adjustmentX = -rect.topLeft().x(); @@ -1467,7 +1467,7 @@ auto VBackgroundImageControls::ScaleByLeft(QGraphicsSceneMouseEvent *event) cons centerScalePoint.rx() = rect.center().x() - (centerScalePoint.x() - rect.center().x()); } - QPointF diff = centerScalePoint - RectLeftPoint(rect); + QPointF const diff = centerScalePoint - RectLeftPoint(rect); if (event->modifiers() & Qt::ControlModifier) { @@ -1490,7 +1490,7 @@ auto VBackgroundImageControls::ScaleByLeft(QGraphicsSceneMouseEvent *event) cons nowRect = QRectF(QPointF(newScalePoint.x(), rect.topLeft().y()), rect.bottomRight()); } - qreal scaleX = nowRect.width() / rect.width(); + qreal const scaleX = nowRect.width() / rect.width(); qreal scaleY = nowRect.width() / rect.width(); if (event->modifiers() & Qt::ControlModifier) @@ -1498,17 +1498,17 @@ auto VBackgroundImageControls::ScaleByLeft(QGraphicsSceneMouseEvent *event) cons scaleY = 1; } - QPointF newScalePoint = pos - m_scaleDiff; + QPointF const newScalePoint = pos - m_scaleDiff; QTransform m; - QPointF scaleCenterOriginal = + QPointF const scaleCenterOriginal = (event->modifiers() & Qt::ShiftModifier) ? rectOriginal.center() : RectRightPoint(rectOriginal); m.translate(scaleCenterOriginal.x(), scaleCenterOriginal.y()); m.scale(scaleX, scaleY); - QPointF scaleCenter = (event->modifiers() & Qt::ShiftModifier) ? rect.center() : RectRightPoint(rect); + QPointF const scaleCenter = (event->modifiers() & Qt::ShiftModifier) ? rect.center() : RectRightPoint(rect); if (newScalePoint.x() > scaleCenter.x()) { @@ -1551,7 +1551,7 @@ auto VBackgroundImageControls::Handles() const -> QPainterPath auto VBackgroundImageControls::ControllersRect() const -> QRectF { const qreal scale = SceneScale(scene()); - QPixmap handler = m_handlePixmaps.value(BIHandleCornerType::ScaleTopLeftBottomRight); + QPixmap const handler = m_handlePixmaps.value(BIHandleCornerType::ScaleTopLeftBottomRight); QRectF imageRect = m_image.BoundingRect(); imageRect = QRectF(imageRect.topLeft() * scale, QSizeF(imageRect.width() * scale, imageRect.height() * scale)); @@ -1559,13 +1559,13 @@ auto VBackgroundImageControls::ControllersRect() const -> QRectF if (imageRect.width() < handler.width()) { - qreal diff = handler.width() - imageRect.width(); + qreal const diff = handler.width() - imageRect.width(); rect.adjust(0, 0, diff, 0); } if (imageRect.height() < handler.height()) { - qreal diff = handler.height() - imageRect.height(); + qreal const diff = handler.height() - imageRect.height(); rect.adjust(0, 0, 0, diff); } @@ -1648,7 +1648,7 @@ auto VBackgroundImageControls::OriginCircle1() const -> QPainterPath const qreal radius1 = 4; QPainterPath path; const qreal sceneScale = SceneScale(scene()); - QPointF screeOrigin = m_originPos * sceneScale; + QPointF const screeOrigin = m_originPos * sceneScale; path.addEllipse({screeOrigin.x() - radius1, screeOrigin.y() - radius1, radius1 * 2., radius1 * 2.}); return path; } @@ -1659,7 +1659,7 @@ auto VBackgroundImageControls::OriginCircle2() const -> QPainterPath const qreal radius2 = 8; QPainterPath path; const qreal sceneScale = SceneScale(scene()); - QPointF screeOrigin = m_originPos * sceneScale; + QPointF const screeOrigin = m_originPos * sceneScale; path.addEllipse({screeOrigin.x() - radius2, screeOrigin.y() - radius2, radius2 * 2., radius2 * 2.}); return path; } @@ -1756,12 +1756,12 @@ void VBackgroundImageControls::RotateImage(QGraphicsSceneMouseEvent *event) if (m_handleCornerHover != BIHandleCorner::Invalid) { - QPointF rotationNewPoint = event->pos(); + QPointF const rotationNewPoint = event->pos(); const qreal sceneScale = SceneScale(scene()); - QPointF screenOriginPos = m_originPos * sceneScale; + QPointF const screenOriginPos = m_originPos * sceneScale; - QLineF initPosition(screenOriginPos, m_rotationStartPoint); - QLineF initRotationPosition(screenOriginPos, rotationNewPoint); + QLineF const initPosition(screenOriginPos, m_rotationStartPoint); + QLineF const initRotationPosition(screenOriginPos, rotationNewPoint); qreal rotateOn = initPosition.angleTo(initRotationPosition); diff --git a/src/libs/vtools/tools/backgroundimage/vbackgroundimageitem.cpp b/src/libs/vtools/tools/backgroundimage/vbackgroundimageitem.cpp index 7b91a9dce..596c7a87d 100644 --- a/src/libs/vtools/tools/backgroundimage/vbackgroundimageitem.cpp +++ b/src/libs/vtools/tools/backgroundimage/vbackgroundimageitem.cpp @@ -154,7 +154,7 @@ void VBackgroundImageItem::paint(QPainter *painter, const QStyleOptionGraphicsIt { painter->save(); - QBrush brush(QColor(177, 216, 250, 25)); + QBrush const brush(QColor(177, 216, 250, 25)); painter->setBrush(brush); painter->drawRect(boundingRect()); @@ -171,9 +171,9 @@ void VBackgroundImageItem::PositionChanged(QUuid id) return; } - QTransform oldMatrix = m_image.Matrix(); + QTransform const oldMatrix = m_image.Matrix(); m_image = m_doc->GetBackgroundImage(id); - QTransform newMatrix = m_image.Matrix(); + QTransform const newMatrix = m_image.Matrix(); if (not VFuzzyComparePossibleNulls(oldMatrix.m31(), newMatrix.m31()) || not VFuzzyComparePossibleNulls(oldMatrix.m32(), newMatrix.m32())) @@ -665,7 +665,7 @@ void VBackgroundImageItem::RotateImageByAngle(qreal angle) { QTransform imageMatrix = m_image.Matrix(); - QPointF originPos = m_image.BoundingRect().center(); + QPointF const originPos = m_image.BoundingRect().center(); QTransform m; m.translate(originPos.x(), originPos.y()); @@ -684,11 +684,11 @@ void VBackgroundImageItem::RotateImageByAngle(qreal angle) //--------------------------------------------------------------------------------------------------------------------- void VBackgroundImageItem::ScaleImageByAdjustSize(qreal value) { - QRectF rect = m_image.BoundingRect(); + QRectF const rect = m_image.BoundingRect(); QRectF adjusted = rect; adjusted.adjust(-value, -value, value, value); - qreal factor = adjusted.width() / rect.width(); + qreal const factor = adjusted.width() / rect.width(); ScaleImageByFactor(factor); } @@ -696,7 +696,7 @@ void VBackgroundImageItem::ScaleImageByAdjustSize(qreal value) void VBackgroundImageItem::ScaleImageByFactor(qreal factor) { QTransform imageMatrix = m_image.Matrix(); - QPointF originPos = m_image.BoundingRect().center(); + QPointF const originPos = m_image.BoundingRect().center(); QTransform m; m.translate(originPos.x(), originPos.y()); diff --git a/src/libs/vtools/tools/backgroundimage/vbackgroundpixmapitem.cpp b/src/libs/vtools/tools/backgroundimage/vbackgroundpixmapitem.cpp index 1718c789e..e77e77897 100644 --- a/src/libs/vtools/tools/backgroundimage/vbackgroundpixmapitem.cpp +++ b/src/libs/vtools/tools/backgroundimage/vbackgroundpixmapitem.cpp @@ -60,7 +60,7 @@ void VBackgroundPixmapItem::SetTransformationMode(Qt::TransformationMode mode) //--------------------------------------------------------------------------------------------------------------------- auto VBackgroundPixmapItem::boundingRect() const -> QRectF { - QPixmap pixmap = Pixmap(); + QPixmap const pixmap = Pixmap(); if (pixmap.isNull()) { return {}; @@ -169,13 +169,13 @@ void VBackgroundPixmapItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) //--------------------------------------------------------------------------------------------------------------------- void VBackgroundPixmapItem::UpdateShape() const { - QPixmap pixmap = Pixmap(); + QPixmap const pixmap = Pixmap(); m_shape = QPainterPath(); switch (m_shapeMode) { case ShapeMode::MaskShape: { - QBitmap mask = pixmap.mask(); + QBitmap const mask = pixmap.mask(); if (!mask.isNull()) { m_shape = qt_regionToPath(QRegion(mask)); @@ -205,7 +205,7 @@ auto VBackgroundPixmapItem::Pixmap() const -> QPixmap { m_pixmap = QPixmap(); - VBackgroundPatternImage image = Image(); + VBackgroundPatternImage const image = Image(); if (not image.IsValid()) { m_pixmap = InvalidImage(); @@ -227,7 +227,7 @@ auto VBackgroundPixmapItem::Pixmap() const -> QPixmap if (not image.FilePath().isEmpty()) { QImageReader imageReader(image.FilePath()); - QImage image = imageReader.read(); + QImage const image = imageReader.read(); if (not image.isNull()) { m_pixmap = QPixmap::fromImage(ScaleImage(image)); @@ -251,7 +251,7 @@ auto VBackgroundPixmapItem::Pixmap() const -> QPixmap buffer.open(QIODevice::ReadOnly); QImageReader imageReader(&buffer); - QImage image = imageReader.read(); + QImage const image = imageReader.read(); if (not image.isNull()) { m_pixmap = QPixmap::fromImage(ScaleImage(image)); diff --git a/src/libs/vtools/tools/backgroundimage/vbackgroundsvgitem.cpp b/src/libs/vtools/tools/backgroundimage/vbackgroundsvgitem.cpp index d7d3bf034..9aa97366b 100644 --- a/src/libs/vtools/tools/backgroundimage/vbackgroundsvgitem.cpp +++ b/src/libs/vtools/tools/backgroundimage/vbackgroundsvgitem.cpp @@ -92,7 +92,7 @@ auto VBackgroundSVGItem::Renderer() const -> QSvgRenderer * { if (Stale()) { - VBackgroundPatternImage image = Image(); + VBackgroundPatternImage const image = Image(); if (not image.IsValid()) { MakeFresh(); diff --git a/src/libs/vtools/tools/drawTools/operation/vabstractoperation.cpp b/src/libs/vtools/tools/drawTools/operation/vabstractoperation.cpp index e04127a72..1056c2498 100644 --- a/src/libs/vtools/tools/drawTools/operation/vabstractoperation.cpp +++ b/src/libs/vtools/tools/drawTools/operation/vabstractoperation.cpp @@ -147,7 +147,7 @@ void VAbstractOperation::ChangeLabelPosition(quint32 id, const QPointF &pos) { auto *item = qobject_cast(obj); SCASSERT(item != nullptr) - QSharedPointer point = VAbstractTool::data.GeometricObject(id); + QSharedPointer const point = VAbstractTool::data.GeometricObject(id); point->setMx(pos.x()); point->setMy(pos.y()); item->RefreshPointGeometry(*(point.data())); @@ -618,9 +618,9 @@ void VAbstractOperation::ChangeLabelVisibility(quint32 id, bool visible) void VAbstractOperation::ApplyToolOptions(const QList &oldDependencies, const QList &newDependencies, const QDomElement &oldDomElement, const QDomElement &newDomElement) { - bool updateToolOptions = + bool const updateToolOptions = newDependencies != oldDependencies || not VDomDocument::Compare(newDomElement, oldDomElement); - bool updateVisibilityOptions = NeedUpdateVisibilityGroup(); + bool const updateVisibilityOptions = NeedUpdateVisibilityGroup(); if (updateToolOptions && updateVisibilityOptions) { @@ -637,7 +637,7 @@ void VAbstractOperation::ApplyToolOptions(const QList &oldDependencies, if (updateVisibilityOptions) { - vidtype group = doc->GroupLinkedToTool(m_id); + vidtype const group = doc->GroupLinkedToTool(m_id); if (hasLinkedGroup) { @@ -678,8 +678,8 @@ void VAbstractOperation::ApplyToolOptions(const QList &oldDependencies, //--------------------------------------------------------------------------------------------------------------------- void VAbstractOperation::PerformDelete() { - vidtype group = doc->GroupLinkedToTool(m_id); - bool deleteGroup = group != null_id; + vidtype const group = doc->GroupLinkedToTool(m_id); + bool const deleteGroup = group != null_id; qCDebug(vTool, "Begin deleting."); if (deleteGroup) @@ -852,7 +852,7 @@ void VAbstractOperation::AllowCurveSelecting(bool enabled, GOType type) //--------------------------------------------------------------------------------------------------------------------- auto VAbstractOperation::NeedUpdateVisibilityGroup() const -> bool { - vidtype group = doc->GroupLinkedToTool(m_id); + vidtype const group = doc->GroupLinkedToTool(m_id); if (hasLinkedGroup) { @@ -963,7 +963,7 @@ auto VAbstractOperation::ComplexCurveToolTip(quint32 itemId) const -> QString //--------------------------------------------------------------------------------------------------------------------- auto VAbstractOperation::VisibilityGroupToolTip() const -> QString { - vidtype group = doc->GroupLinkedToTool(m_id); + vidtype const group = doc->GroupLinkedToTool(m_id); if (group != null_id) { return QStringLiteral("
") @@ -982,7 +982,7 @@ void VAbstractOperation::CreateVisibilityGroup(const VAbstractOperationInitData } const QMap groupData = VisibilityGroupDataFromSource(initData.data, initData.source); - vidtype groupId = initData.data->getNextId(); + vidtype const groupId = initData.data->getNextId(); const QDomElement group = initData.doc->CreateGroup(groupId, initData.visibilityGroupName, initData.visibilityGroupTags, groupData, initData.id); if (not group.isNull()) diff --git a/src/libs/vtools/tools/drawTools/operation/vabstractoperation.h b/src/libs/vtools/tools/drawTools/operation/vabstractoperation.h index 23188c162..b33886df5 100644 --- a/src/libs/vtools/tools/drawTools/operation/vabstractoperation.h +++ b/src/libs/vtools/tools/drawTools/operation/vabstractoperation.h @@ -192,7 +192,7 @@ template void VAbstractOperation::SetDialogVisibilityGroupData(QPoi { SCASSERT(not dialogTool.isNull()) - vidtype group = doc->GroupLinkedToTool(m_id); + vidtype const group = doc->GroupLinkedToTool(m_id); dialogTool->SetGroupCategories(doc->GetGroupCategories()); if (group != null_id) { diff --git a/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp b/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp index 64ee8bf5f..1a7c571d8 100644 --- a/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp +++ b/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp @@ -104,7 +104,7 @@ auto GetOriginPoint(const QVector &objects, const VContainer *data, } } - QPointF rotationOrigin = originObjects.boundingRect().center(); + QPointF const rotationOrigin = originObjects.boundingRect().center(); QLineF move(rotationOrigin, QPointF(rotationOrigin.x() + calcLength, rotationOrigin.y())); move.setAngle(calcAngle); return move.p2(); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp index 3f5e14fcf..3011f1198 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp @@ -100,7 +100,7 @@ void VAbstractSpline::paint(QPainter *painter, const QStyleOptionGraphicsItem *o SceneScale(scene())); const QSharedPointer curve = VAbstractTool::data.GeometricObject(m_id); - QColor penColor = + QColor const penColor = VSceneStylesheet::CorrectToolColor(this, VSceneStylesheet::CorrectToolColorForDarkTheme(curve->GetColor())); setPen(QPen(penColor, width, LineStyleToPenStyle(curve->GetPenStyle()), Qt::RoundCap)); @@ -421,7 +421,7 @@ auto VAbstractSpline::GetLineColor() const -> QString //--------------------------------------------------------------------------------------------------------------------- void VAbstractSpline::SetLineColor(const QString &value) { - QSharedPointer curve = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const curve = VAbstractTool::data.GeometricObject(m_id); curve->SetColor(value); QSharedPointer obj = qSharedPointerCast(curve); SaveOption(obj); @@ -437,7 +437,7 @@ auto VAbstractSpline::GetPenStyle() const -> QString //--------------------------------------------------------------------------------------------------------------------- void VAbstractSpline::SetPenStyle(const QString &value) { - QSharedPointer curve = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const curve = VAbstractTool::data.GeometricObject(m_id); curve->SetPenStyle(value); QSharedPointer obj = qSharedPointerCast(curve); SaveOption(obj); @@ -470,13 +470,13 @@ auto VAbstractSpline::GetAliasSuffix() const -> QString //--------------------------------------------------------------------------------------------------------------------- void VAbstractSpline::SetAliasSuffix(QString alias) { - QSharedPointer curve = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const curve = VAbstractTool::data.GeometricObject(m_id); const QString oldAliasSuffix = curve->GetAliasSuffix(); alias = alias.simplified().replace(QChar(QChar::Space), '_'_L1); curve->SetAliasSuffix(alias); - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); if (alias.isEmpty() || (rx.match(curve->GetAlias()).hasMatch() && VAbstractTool::data.IsUnique(curve->GetAlias()))) { @@ -507,7 +507,7 @@ VToolAbstractArc::VToolAbstractArc(VAbstractPattern *doc, VContainer *data, quin //--------------------------------------------------------------------------------------------------------------------- auto VToolAbstractArc::CenterPointName() const -> QString { - QSharedPointer arc = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const arc = VAbstractTool::data.GeometricObject(m_id); SCASSERT(arc.isNull() == false) return VAbstractTool::data.GetGObject(arc->GetCenter().id())->name(); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp index 172da27f8..049df5ab8 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp @@ -192,7 +192,7 @@ auto VToolArc::getTagName() const -> QString //--------------------------------------------------------------------------------------------------------------------- auto VToolArc::GetFormulaRadius() const -> VFormula { - QSharedPointer arc = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const arc = VAbstractTool::data.GeometricObject(m_id); SCASSERT(arc.isNull() == false) VFormula radius(arc->GetFormulaRadius(), getData()); @@ -209,7 +209,7 @@ void VToolArc::SetFormulaRadius(const VFormula &value) if (!value.error()) { QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); - QSharedPointer arc = qSharedPointerDynamicCast(obj); + QSharedPointer const arc = qSharedPointerDynamicCast(obj); arc->SetFormulaRadius(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); SaveOption(obj); } @@ -218,7 +218,7 @@ void VToolArc::SetFormulaRadius(const VFormula &value) //--------------------------------------------------------------------------------------------------------------------- auto VToolArc::GetFormulaF1() const -> VFormula { - QSharedPointer arc = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const arc = VAbstractTool::data.GeometricObject(m_id); SCASSERT(arc.isNull() == false) VFormula f1(arc->GetFormulaF1(), getData()); @@ -234,7 +234,7 @@ void VToolArc::SetFormulaF1(const VFormula &value) if (!value.error()) { QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); - QSharedPointer arc = qSharedPointerDynamicCast(obj); + QSharedPointer const arc = qSharedPointerDynamicCast(obj); arc->SetFormulaF1(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); SaveOption(obj); @@ -244,7 +244,7 @@ void VToolArc::SetFormulaF1(const VFormula &value) //--------------------------------------------------------------------------------------------------------------------- auto VToolArc::GetFormulaF2() const -> VFormula { - QSharedPointer arc = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const arc = VAbstractTool::data.GeometricObject(m_id); SCASSERT(arc.isNull() == false) VFormula f2(arc->GetFormulaF2(), getData()); @@ -260,7 +260,7 @@ void VToolArc::SetFormulaF2(const VFormula &value) if (!value.error()) { QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); - QSharedPointer arc = qSharedPointerDynamicCast(obj); + QSharedPointer const arc = qSharedPointerDynamicCast(obj); arc->SetFormulaF2(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); SaveOption(obj); } @@ -269,7 +269,7 @@ void VToolArc::SetFormulaF2(const VFormula &value) //--------------------------------------------------------------------------------------------------------------------- auto VToolArc::GetApproximationScale() const -> qreal { - QSharedPointer arc = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const arc = VAbstractTool::data.GeometricObject(m_id); SCASSERT(arc.isNull() == false) return arc->GetApproximationScale(); @@ -279,7 +279,7 @@ auto VToolArc::GetApproximationScale() const -> qreal void VToolArc::SetApproximationScale(qreal value) { QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); - QSharedPointer arc = qSharedPointerDynamicCast(obj); + QSharedPointer const arc = qSharedPointerDynamicCast(obj); arc->SetApproximationScale(value); SaveOption(obj); } @@ -322,10 +322,10 @@ void VToolArc::RemoveReferens() void VToolArc::SaveDialog(QDomElement &domElement, QList &oldDependencies, QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QPointer dialogTool = qobject_cast(m_dialog); + QPointer const dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) - QSharedPointer arc = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const arc = VAbstractTool::data.GeometricObject(m_id); SCASSERT(arc.isNull() == false) AddDependence(oldDependencies, arc->GetCenter().id()); AddDependence(newDependencies, dialogTool->GetCenter()); @@ -348,7 +348,7 @@ void VToolArc::SaveOptions(QDomElement &tag, QSharedPointer &obj) { VAbstractSpline::SaveOptions(tag, obj); - QSharedPointer arc = qSharedPointerDynamicCast(obj); + QSharedPointer const arc = qSharedPointerDynamicCast(obj); SCASSERT(arc.isNull() == false) doc->SetAttribute(tag, AttrType, ToolType); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp index dd9f5277e..a92896a75 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp @@ -174,7 +174,7 @@ auto VToolArcWithLength::getTagName() const -> QString //--------------------------------------------------------------------------------------------------------------------- auto VToolArcWithLength::GetFormulaRadius() const -> VFormula { - QSharedPointer arc = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const arc = VAbstractTool::data.GeometricObject(m_id); SCASSERT(arc.isNull() == false) VFormula radius(arc->GetFormulaRadius(), getData()); @@ -190,7 +190,7 @@ void VToolArcWithLength::SetFormulaRadius(const VFormula &value) if (value.error() == false) { QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); - QSharedPointer arc = qSharedPointerDynamicCast(obj); + QSharedPointer const arc = qSharedPointerDynamicCast(obj); arc->SetFormulaRadius(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); SaveOption(obj); } @@ -199,7 +199,7 @@ void VToolArcWithLength::SetFormulaRadius(const VFormula &value) //--------------------------------------------------------------------------------------------------------------------- auto VToolArcWithLength::GetFormulaF1() const -> VFormula { - QSharedPointer arc = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const arc = VAbstractTool::data.GeometricObject(m_id); SCASSERT(arc.isNull() == false) VFormula f1(arc->GetFormulaF1(), getData()); @@ -215,7 +215,7 @@ void VToolArcWithLength::SetFormulaF1(const VFormula &value) if (value.error() == false) { QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); - QSharedPointer arc = qSharedPointerDynamicCast(obj); + QSharedPointer const arc = qSharedPointerDynamicCast(obj); if (not VFuzzyComparePossibleNulls(value.getDoubleValue(), arc->GetEndAngle())) // Angles can't be equal { @@ -228,7 +228,7 @@ void VToolArcWithLength::SetFormulaF1(const VFormula &value) //--------------------------------------------------------------------------------------------------------------------- auto VToolArcWithLength::GetFormulaLength() const -> VFormula { - QSharedPointer arc = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const arc = VAbstractTool::data.GeometricObject(m_id); SCASSERT(arc.isNull() == false) VFormula radius(arc->GetFormulaLength(), getData()); @@ -245,7 +245,7 @@ void VToolArcWithLength::SetFormulaLength(const VFormula &value) if (value.error() == false) { QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); - QSharedPointer arc = qSharedPointerDynamicCast(obj); + QSharedPointer const arc = qSharedPointerDynamicCast(obj); arc->SetFormulaLength(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); SaveOption(obj); } @@ -254,7 +254,7 @@ void VToolArcWithLength::SetFormulaLength(const VFormula &value) //--------------------------------------------------------------------------------------------------------------------- auto VToolArcWithLength::GetApproximationScale() const -> qreal { - QSharedPointer arc = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const arc = VAbstractTool::data.GeometricObject(m_id); SCASSERT(arc.isNull() == false) return arc->GetApproximationScale(); @@ -264,7 +264,7 @@ auto VToolArcWithLength::GetApproximationScale() const -> qreal void VToolArcWithLength::SetApproximationScale(qreal value) { QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); - QSharedPointer arc = qSharedPointerDynamicCast(obj); + QSharedPointer const arc = qSharedPointerDynamicCast(obj); arc->SetApproximationScale(value); SaveOption(obj); } @@ -305,7 +305,7 @@ void VToolArcWithLength::SaveDialog(QDomElement &domElement, QList &old const QPointer dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) - QSharedPointer arc = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const arc = VAbstractTool::data.GeometricObject(m_id); SCASSERT(arc.isNull() == false) AddDependence(oldDependencies, arc->GetCenter().id()); AddDependence(newDependencies, dialogTool->GetCenter()); @@ -328,7 +328,7 @@ void VToolArcWithLength::SaveOptions(QDomElement &tag, QSharedPointer { VAbstractSpline::SaveOptions(tag, obj); - QSharedPointer arc = qSharedPointerDynamicCast(obj); + QSharedPointer const arc = qSharedPointerDynamicCast(obj); SCASSERT(arc.isNull() == false) doc->SetAttribute(tag, AttrType, ToolType); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp index dcc54c3b6..5bab6634e 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp @@ -172,7 +172,7 @@ auto VToolCubicBezier::getSpline() const -> VCubicBezier void VToolCubicBezier::setSpline(const VCubicBezier &spl) { QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); - QSharedPointer spline = qSharedPointerDynamicCast(obj); + QSharedPointer const spline = qSharedPointerDynamicCast(obj); *spline.data() = spl; SaveOption(obj); } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp index 158f2b89f..e46c7b266 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp @@ -150,7 +150,7 @@ void VToolCubicBezierPath::UpdatePathPoints(VAbstractPattern *doc, QDomElement & //--------------------------------------------------------------------------------------------------------------------- auto VToolCubicBezierPath::getSplinePath() const -> VCubicBezierPath { - QSharedPointer splPath = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const splPath = VAbstractTool::data.GeometricObject(m_id); return *splPath.data(); } @@ -158,7 +158,7 @@ auto VToolCubicBezierPath::getSplinePath() const -> VCubicBezierPath void VToolCubicBezierPath::setSplinePath(const VCubicBezierPath &splPath) { QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); - QSharedPointer splinePath = qSharedPointerDynamicCast(obj); + QSharedPointer const splinePath = qSharedPointerDynamicCast(obj); *splinePath.data() = splPath; SaveOption(obj); } @@ -225,7 +225,7 @@ void VToolCubicBezierPath::SaveOptions(QDomElement &tag, QSharedPointer splPath = qSharedPointerDynamicCast(obj); + QSharedPointer const splPath = qSharedPointerDynamicCast(obj); SCASSERT(splPath.isNull() == false) SetSplinePathAttributes(tag, *splPath); @@ -239,7 +239,7 @@ void VToolCubicBezierPath::SetVisualization() auto *visual = qobject_cast(vis); SCASSERT(visual != nullptr) - QSharedPointer splPath = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const splPath = VAbstractTool::data.GeometricObject(m_id); visual->SetPath(*splPath.data()); visual->SetLineStyle(LineStyleToPenStyle(splPath->GetPenStyle())); visual->SetMode(Mode::Show); @@ -250,7 +250,7 @@ void VToolCubicBezierPath::SetVisualization() //--------------------------------------------------------------------------------------------------------------------- void VToolCubicBezierPath::RefreshGeometry() { - QSharedPointer splPath = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const splPath = VAbstractTool::data.GeometricObject(m_id); setPath(splPath->GetPath()); SetVisualization(); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp index 935b2196e..aa6e45ee8 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp @@ -202,7 +202,7 @@ auto VToolEllipticalArc::getTagName() const -> QString //--------------------------------------------------------------------------------------------------------------------- auto VToolEllipticalArc::GetFormulaRadius1() const -> VFormula { - QSharedPointer elArc = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const elArc = VAbstractTool::data.GeometricObject(m_id); SCASSERT(elArc.isNull() == false) VFormula radius1(elArc->GetFormulaRadius1(), getData()); @@ -218,7 +218,7 @@ void VToolEllipticalArc::SetFormulaRadius1(const VFormula &value) if (!value.error()) { QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); - QSharedPointer elArc = qSharedPointerDynamicCast(obj); + QSharedPointer const elArc = qSharedPointerDynamicCast(obj); elArc->SetFormulaRadius1(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); SaveOption(obj); } @@ -227,7 +227,7 @@ void VToolEllipticalArc::SetFormulaRadius1(const VFormula &value) //--------------------------------------------------------------------------------------------------------------------- auto VToolEllipticalArc::GetFormulaRadius2() const -> VFormula { - QSharedPointer elArc = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const elArc = VAbstractTool::data.GeometricObject(m_id); SCASSERT(elArc.isNull() == false) VFormula radius2(elArc->GetFormulaRadius2(), getData()); @@ -243,7 +243,7 @@ void VToolEllipticalArc::SetFormulaRadius2(const VFormula &value) if (!value.error()) { QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); - QSharedPointer elArc = qSharedPointerDynamicCast(obj); + QSharedPointer const elArc = qSharedPointerDynamicCast(obj); elArc->SetFormulaRadius2(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); SaveOption(obj); } @@ -252,7 +252,7 @@ void VToolEllipticalArc::SetFormulaRadius2(const VFormula &value) //--------------------------------------------------------------------------------------------------------------------- auto VToolEllipticalArc::GetFormulaF1() const -> VFormula { - QSharedPointer elArc = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const elArc = VAbstractTool::data.GeometricObject(m_id); SCASSERT(elArc.isNull() == false) VFormula f1(elArc->GetFormulaF1(), getData()); @@ -268,7 +268,7 @@ void VToolEllipticalArc::SetFormulaF1(const VFormula &value) if (!value.error()) { QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); - QSharedPointer elArc = qSharedPointerDynamicCast(obj); + QSharedPointer const elArc = qSharedPointerDynamicCast(obj); elArc->SetFormulaF1(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); SaveOption(obj); } @@ -277,7 +277,7 @@ void VToolEllipticalArc::SetFormulaF1(const VFormula &value) //--------------------------------------------------------------------------------------------------------------------- auto VToolEllipticalArc::GetFormulaF2() const -> VFormula { - QSharedPointer elArc = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const elArc = VAbstractTool::data.GeometricObject(m_id); SCASSERT(elArc.isNull() == false) VFormula f2(elArc->GetFormulaF2(), getData()); @@ -293,7 +293,7 @@ void VToolEllipticalArc::SetFormulaF2(const VFormula &value) if (!value.error()) { QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); - QSharedPointer elArc = qSharedPointerDynamicCast(obj); + QSharedPointer const elArc = qSharedPointerDynamicCast(obj); elArc->SetFormulaF2(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); SaveOption(obj); } @@ -302,7 +302,7 @@ void VToolEllipticalArc::SetFormulaF2(const VFormula &value) //--------------------------------------------------------------------------------------------------------------------- auto VToolEllipticalArc::GetFormulaRotationAngle() const -> VFormula { - QSharedPointer elArc = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const elArc = VAbstractTool::data.GeometricObject(m_id); SCASSERT(elArc.isNull() == false) VFormula rotationAngle(elArc->GetFormulaRotationAngle(), getData()); @@ -318,7 +318,7 @@ void VToolEllipticalArc::SetFormulaRotationAngle(const VFormula &value) if (!value.error()) { QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); - QSharedPointer elArc = qSharedPointerDynamicCast(obj); + QSharedPointer const elArc = qSharedPointerDynamicCast(obj); elArc->SetFormulaRotationAngle(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); SaveOption(obj); } @@ -327,7 +327,7 @@ void VToolEllipticalArc::SetFormulaRotationAngle(const VFormula &value) //--------------------------------------------------------------------------------------------------------------------- auto VToolEllipticalArc::GetApproximationScale() const -> qreal { - QSharedPointer arc = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const arc = VAbstractTool::data.GeometricObject(m_id); SCASSERT(arc.isNull() == false) return arc->GetApproximationScale(); @@ -337,7 +337,7 @@ auto VToolEllipticalArc::GetApproximationScale() const -> qreal void VToolEllipticalArc::SetApproximationScale(qreal value) { QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); - QSharedPointer arc = qSharedPointerDynamicCast(obj); + QSharedPointer const arc = qSharedPointerDynamicCast(obj); arc->SetApproximationScale(value); SaveOption(obj); } @@ -409,7 +409,7 @@ void VToolEllipticalArc::SaveOptions(QDomElement &tag, QSharedPointer { VAbstractSpline::SaveOptions(tag, obj); - QSharedPointer elArc = qSharedPointerDynamicCast(obj); + QSharedPointer const elArc = qSharedPointerDynamicCast(obj); SCASSERT(elArc.isNull() == false) doc->SetAttribute(tag, AttrType, ToolType); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp index a5edbcfdc..749f178eb 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp @@ -239,7 +239,7 @@ auto VToolSpline::getSpline() const -> VSpline void VToolSpline::setSpline(const VSpline &spl) { QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); - QSharedPointer spline = qSharedPointerDynamicCast(obj); + QSharedPointer const spline = qSharedPointerDynamicCast(obj); *spline.data() = spl; SaveOption(obj); } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp index 076fafc68..50b602cc4 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp @@ -328,7 +328,7 @@ void VToolSplinePath::UpdateControlPoints(const VSpline &spl, QSharedPointer 1) { - VSpline prevSpline = splPath->GetSpline(indexSpline - 1); + VSpline const prevSpline = splPath->GetSpline(indexSpline - 1); if (qmu::QmuTokenParser::IsSingle(prevSpline.GetEndAngleFormula())) { p.SetAngle2(spl.GetStartAngle(), spl.GetStartAngleFormula()); @@ -346,7 +346,7 @@ void VToolSplinePath::UpdateControlPoints(const VSpline &spl, QSharedPointerCountSubSpl()) { - VSpline nextSpline = splPath->GetSpline(indexSpline + 1); + VSpline const nextSpline = splPath->GetSpline(indexSpline + 1); if (qmu::QmuTokenParser::IsSingle(nextSpline.GetStartAngleFormula())) { p.SetAngle1(spl.GetEndAngle(), spl.GetEndAngleFormula()); @@ -470,7 +470,7 @@ void VToolSplinePath::UpdatePathPoints(VAbstractPattern *doc, QDomElement &eleme //--------------------------------------------------------------------------------------------------------------------- auto VToolSplinePath::getSplinePath() const -> VSplinePath { - QSharedPointer splPath = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const splPath = VAbstractTool::data.GeometricObject(m_id); return *splPath.data(); } @@ -478,7 +478,7 @@ auto VToolSplinePath::getSplinePath() const -> VSplinePath void VToolSplinePath::setSplinePath(const VSplinePath &splPath) { QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); - QSharedPointer splinePath = qSharedPointerDynamicCast(obj); + QSharedPointer const splinePath = qSharedPointerDynamicCast(obj); *splinePath.data() = splPath; SaveOption(obj); } @@ -585,7 +585,7 @@ void VToolSplinePath::SaveOptions(QDomElement &tag, QSharedPointer &ob { VAbstractSpline::SaveOptions(tag, obj); - QSharedPointer splPath = qSharedPointerDynamicCast(obj); + QSharedPointer const splPath = qSharedPointerDynamicCast(obj); SCASSERT(splPath.isNull() == false) SetSplinePathAttributes(tag, *splPath); @@ -646,7 +646,7 @@ void VToolSplinePath::mouseMoveEvent(QGraphicsSceneMouseEvent *event) newMoveSplinePath = QSharedPointer::create(*oldSplPath); - VSpline spline = newMoveSplinePath->GetSpline(splIndex); + VSpline const spline = newMoveSplinePath->GetSpline(splIndex); const qreal t = spline.ParamT(oldPosition); if (qFloor(t) == -1) @@ -779,7 +779,7 @@ void VToolSplinePath::SetVisualization() auto *visual = qobject_cast(vis); SCASSERT(visual != nullptr) - QSharedPointer splPath = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const splPath = VAbstractTool::data.GeometricObject(m_id); visual->SetPath(*splPath.data()); visual->SetLineStyle(LineStyleToPenStyle(splPath->GetPenStyle())); visual->SetMode(Mode::Show); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp index 88c8d6067..090e7f155 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp @@ -245,7 +245,7 @@ void VToolDoublePoint::ChangeLabelPosition(quint32 id, const QPointF &pos) { if (id == p1id) { - QSharedPointer point = VAbstractTool::data.GeometricObject(p1id); + QSharedPointer const point = VAbstractTool::data.GeometricObject(p1id); point->setMx(pos.x()); point->setMy(pos.y()); firstPoint->RefreshPointGeometry(*(point.data())); @@ -257,7 +257,7 @@ void VToolDoublePoint::ChangeLabelPosition(quint32 id, const QPointF &pos) } else if (id == p2id) { - QSharedPointer point = VAbstractTool::data.GeometricObject(p2id); + QSharedPointer const point = VAbstractTool::data.GeometricObject(p2id); point->setMx(pos.x()); point->setMy(pos.y()); secondPoint->RefreshPointGeometry(*(point.data())); @@ -400,14 +400,14 @@ void VToolDoublePoint::SaveOptions(QDomElement &tag, QSharedPointer &o if (obj->id() == p1id) { - QSharedPointer point = qSharedPointerDynamicCast(obj); + QSharedPointer const point = qSharedPointerDynamicCast(obj); SCASSERT(point.isNull() == false) SavePoint1(tag, point); } else if (obj->id() == p2id) { - QSharedPointer point = qSharedPointerDynamicCast(obj); + QSharedPointer const point = qSharedPointerDynamicCast(obj); SCASSERT(point.isNull() == false) SavePoint2(tag, point); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp index 9e0bffa12..2a80f9138 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp @@ -116,13 +116,13 @@ auto VToolCut::GetAliasSuffix1() const -> QString //--------------------------------------------------------------------------------------------------------------------- void VToolCut::SetAliasSuffix1(QString alias) { - QSharedPointer curve = VAbstractTool::data.GeometricObject(baseCurveId); + QSharedPointer const curve = VAbstractTool::data.GeometricObject(baseCurveId); const QString oldAliasSuffix = curve->GetAliasSuffix(); alias = alias.simplified().replace(QChar(QChar::Space), '_'_L1); curve->SetAliasSuffix(alias); - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); if (alias.isEmpty() || (rx.match(curve->GetAlias()).hasMatch() && VAbstractTool::data.IsUnique(curve->GetAlias()))) { @@ -145,13 +145,13 @@ auto VToolCut::GetAliasSuffix2() const -> QString //--------------------------------------------------------------------------------------------------------------------- void VToolCut::SetAliasSuffix2(QString alias) { - QSharedPointer curve = VAbstractTool::data.GeometricObject(baseCurveId); + QSharedPointer const curve = VAbstractTool::data.GeometricObject(baseCurveId); const QString oldAliasSuffix = curve->GetAliasSuffix(); alias = alias.simplified().replace(QChar(QChar::Space), '_'_L1); curve->SetAliasSuffix(alias); - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); if (alias.isEmpty() || (rx.match(curve->GetAlias()).hasMatch() && VAbstractTool::data.IsUnique(curve->GetAlias()))) { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp index 5c5141d40..493af4dae 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp @@ -145,7 +145,7 @@ auto VToolCutArc::Create(VToolCutInitData &initData) -> VToolCutArc * VArc arc1; VArc arc2; - QPointF point = arc->CutArc(VAbstractValApplication::VApp()->toPixel(result), arc1, arc2, initData.name); + QPointF const point = arc->CutArc(VAbstractValApplication::VApp()->toPixel(result), arc1, arc2, initData.name); arc1.SetAliasSuffix(initData.aliasSuffix1); arc2.SetAliasSuffix(initData.aliasSuffix2); 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 439dfa283..b95b75946 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp @@ -82,7 +82,7 @@ VToolCutSpline::VToolCutSpline(const VToolCutInitData &initData, QGraphicsItem * void VToolCutSpline::SetDialog() { SCASSERT(not m_dialog.isNull()) - QPointer dialogTool = qobject_cast(m_dialog); + QPointer const dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer point = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetFormula(formula); @@ -147,7 +147,7 @@ auto VToolCutSpline::Create(VToolCutInitData &initData) -> VToolCutSpline * const qreal result = CheckFormula(initData.id, initData.formula, initData.data); QPointF spl1p2, spl1p3, spl2p2, spl2p3; - QPointF point = + QPointF const point = spl->CutSpline(VAbstractValApplication::VApp()->toPixel(result), spl1p2, spl1p3, spl2p2, spl2p3, initData.name); auto *p = new VPointF(point, initData.name, initData.mx, initData.my); @@ -296,7 +296,7 @@ auto VToolCutSpline::MakeToolTip() const -> QString const QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); QPointF spl1p2, spl1p3, spl2p2, spl2p3; - QPointF point = + QPointF const point = spl->CutSpline(VAbstractValApplication::VApp()->toPixel(length), spl1p2, spl1p3, spl2p2, spl2p3, p->name()); VSpline spline1 = VSpline(spl->GetP1(), spl1p2, spl1p3, VPointF(point)); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp index a011d3cb2..57a17bdd7 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp @@ -71,8 +71,8 @@ VToolBisector::VToolBisector(const VToolBisectorInitData &initData, QGraphicsIte auto VToolBisector::BisectorAngle(const QPointF &firstPoint, const QPointF &secondPoint, const QPointF &thirdPoint) -> qreal { - QLineF line1(secondPoint, firstPoint); - QLineF line2(secondPoint, thirdPoint); + QLineF const line1(secondPoint, firstPoint); + QLineF const line2(secondPoint, thirdPoint); qreal angle = line1.angleTo(line2); if (angle>180) { @@ -171,9 +171,9 @@ auto VToolBisector::Create(VToolBisectorInitData &initData) -> VToolBisector * const qreal result = CheckFormula(initData.id, initData.formula, initData.data); - QPointF fPoint = VToolBisector::FindPoint(static_cast(*firstPoint), static_cast(*secondPoint), - static_cast(*thirdPoint), - VAbstractValApplication::VApp()->toPixel(result)); + QPointF const fPoint = + VToolBisector::FindPoint(static_cast(*firstPoint), static_cast(*secondPoint), + static_cast(*thirdPoint), VAbstractValApplication::VApp()->toPixel(result)); VPointF *p = new VPointF(fPoint, initData.name, initData.mx, initData.my); p->SetShowLabel(initData.showLabel); @@ -242,7 +242,7 @@ void VToolBisector::SaveDialog(QDomElement &domElement, QList &oldDepen QList &newDependencies) { SCASSERT(not m_dialog.isNull()) - QPointer dialogTool = qobject_cast(m_dialog); + QPointer const dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) AddDependence(oldDependencies, firstPointId); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp index 0fad80ca4..853ca9804 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp @@ -75,7 +75,7 @@ void VToolEndLine::SetDialog() { SCASSERT(not m_dialog.isNull()) m_dialog->setModal(true); - QPointer dialogTool = qobject_cast(m_dialog); + QPointer const dialogTool = qobject_cast(m_dialog); SCASSERT(not dialogTool.isNull()) const QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetTypeLine(m_lineType); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp index 49184534e..25763caf7 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp @@ -138,8 +138,8 @@ auto VToolHeight::Create(VToolHeightInitData initData) -> VToolHeight * const QSharedPointer p1Line = initData.data->GeometricObject(initData.p1LineId); const QSharedPointer p2Line = initData.data->GeometricObject(initData.p2LineId); - QPointF pHeight = FindPoint(QLineF(static_cast(*p1Line), static_cast(*p2Line)), - static_cast(*basePoint)); + QPointF const pHeight = FindPoint(QLineF(static_cast(*p1Line), static_cast(*p2Line)), + static_cast(*basePoint)); VPointF *p = new VPointF(pHeight, initData.name, initData.mx, initData.my); p->SetShowLabel(initData.showLabel); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp index 495b73879..3e8f052f1 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp @@ -125,7 +125,7 @@ auto VToolLineIntersectAxis::Create(VToolLineIntersectAxisInitData &initData) -> const QSharedPointer firstPoint = initData.data->GeometricObject(initData.firstPointId); const QSharedPointer secondPoint = initData.data->GeometricObject(initData.secondPointId); - QLineF line(static_cast(*firstPoint), static_cast(*secondPoint)); + QLineF const line(static_cast(*firstPoint), static_cast(*secondPoint)); QPointF fPoint; const bool success = FindPoint(axis, line, &fPoint); @@ -184,7 +184,7 @@ auto VToolLineIntersectAxis::FindPoint(const QLineF &axis, const QLineF &line, Q SCASSERT(intersectionPoint != nullptr) QPointF fPoint; - QLineF::IntersectType intersect = axis.intersects(line, &fPoint); + QLineF::IntersectType const intersect = axis.intersects(line, &fPoint); if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection) { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp index a8ea99dd9..cb68df19f 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp @@ -81,9 +81,9 @@ VToolLinePoint::VToolLinePoint(VAbstractPattern *doc, VContainer *data, const qu { this->m_lineType = typeLine; Q_ASSERT_X(basePointId != 0, Q_FUNC_INFO, "basePointId == 0"); //-V654 //-V712 - QPointF point1 = static_cast(*data->GeometricObject(basePointId)); - QPointF point2 = static_cast(*data->GeometricObject(id)); - QLineF line(point1 - point2, QPointF()); + QPointF const point1 = static_cast(*data->GeometricObject(basePointId)); + QPointF const point2 = static_cast(*data->GeometricObject(id)); + QLineF const line(point1 - point2, QPointF()); mainLine = new VScaledLine(line, VColorRole::CustomColor, this); mainLine->SetBoldLine(false); mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true); @@ -115,9 +115,9 @@ void VToolLinePoint::paint(QPainter *painter, const QStyleOptionGraphicsItem *op void VToolLinePoint::RefreshGeometry() { VToolSinglePoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject(m_id)); - QPointF point = static_cast(*VDrawTool::data.GeometricObject(m_id)); - QPointF basePoint = static_cast(*VDrawTool::data.GeometricObject(basePointId)); - QLineF line(basePoint - point, QPointF()); + QPointF const point = static_cast(*VDrawTool::data.GeometricObject(m_id)); + QPointF const basePoint = static_cast(*VDrawTool::data.GeometricObject(basePointId)); + QLineF const line(basePoint - point, QPointF()); mainLine->setLine(line); mainLine->setVisible(not line.isNull()); } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp index 337537351..64e25b113 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp @@ -138,8 +138,8 @@ auto VToolNormal::Create(VToolNormalInitData initData) -> VToolNormal * const qreal result = CheckFormula(initData.id, initData.formula, initData.data); - QPointF fPoint = VToolNormal::FindPoint(static_cast(*firstPoint), static_cast(*secondPoint), - VAbstractValApplication::VApp()->toPixel(result), initData.angle); + QPointF const fPoint = VToolNormal::FindPoint(static_cast(*firstPoint), static_cast(*secondPoint), + VAbstractValApplication::VApp()->toPixel(result), initData.angle); VPointF *p = new VPointF(fPoint, initData.name, initData.mx, initData.my); p->SetShowLabel(initData.showLabel); @@ -184,7 +184,7 @@ auto VToolNormal::Create(VToolNormalInitData initData) -> VToolNormal * */ auto VToolNormal::FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, qreal length, qreal angle) -> QPointF { - QLineF line(firstPoint, secondPoint); + QLineF const line(firstPoint, secondPoint); QLineF normal = line.normalVector(); normal.setAngle(normal.angle()+angle); normal.setLength(length); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp index 1420cc3e5..33288d579 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp @@ -194,7 +194,7 @@ auto VToolShoulderPoint::Create(VToolShoulderPointInitData &initData) -> VToolSh const qreal result = CheckFormula(initData.id, initData.formula, initData.data); - QPointF fPoint = VToolShoulderPoint::FindPoint( + QPointF const fPoint = VToolShoulderPoint::FindPoint( static_cast(*firstPoint), static_cast(*secondPoint), static_cast(*shoulderPoint), VAbstractValApplication::VApp()->toPixel(result)); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp index 4a4b6e5bb..dd66695d6 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp @@ -189,7 +189,7 @@ auto VToolBasePoint::itemChange(QGraphicsItem::GraphicsItemChange change, const { changeFinished = false; // value - this is new position. - QPointF newPos = value.toPointF(); + QPointF const newPos = value.toPointF(); MoveSPoint *moveSP = new MoveSPoint(doc, newPos.x(), newPos.y(), m_id, this->scene()); connect(moveSP, &MoveSPoint::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); @@ -219,7 +219,7 @@ auto VToolBasePoint::GetBasePointPos() const -> QPointF //--------------------------------------------------------------------------------------------------------------------- void VToolBasePoint::SetBasePointPos(const QPointF &pos) { - QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); + QSharedPointer const p = VAbstractTool::data.GeometricObject(m_id); p->setX(VAbstractValApplication::VApp()->toPixel(pos.x())); p->setY(VAbstractValApplication::VApp()->toPixel(pos.y())); @@ -254,7 +254,7 @@ void VToolBasePoint::DeleteToolWithConfirm(bool ask) VAbstractApplication::VApp()->getUndoStack()->push(deletePP); // Throw exception, this will help prevent case when we forget to immediately quit function. - VExceptionToolWasDeleted e("Tool was used after deleting."); + VExceptionToolWasDeleted const e("Tool was used after deleting."); throw e; } @@ -324,7 +324,7 @@ void VToolBasePoint::SaveOptions(QDomElement &tag, QSharedPointer &obj { VToolSinglePoint::SaveOptions(tag, obj); - QSharedPointer point = qSharedPointerDynamicCast(obj); + QSharedPointer const point = qSharedPointerDynamicCast(obj); SCASSERT(point.isNull() == false) doc->SetAttribute(tag, AttrType, ToolType); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp index d20a18708..b7603dcf8 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp @@ -140,8 +140,8 @@ auto VToolLineIntersect::Create(VToolLineIntersectInitData initData) -> VToolLin const QSharedPointer p1Line2 = initData.data->GeometricObject(initData.p1Line2Id); const QSharedPointer p2Line2 = initData.data->GeometricObject(initData.p2Line2Id); - QLineF line1(static_cast(*p1Line1), static_cast(*p2Line1)); - QLineF line2(static_cast(*p1Line2), static_cast(*p2Line2)); + QLineF const line1(static_cast(*p1Line1), static_cast(*p2Line1)); + QLineF const line2(static_cast(*p1Line2), static_cast(*p2Line2)); QPointF fPoint; const QLineF::IntersectType intersect = line1.intersects(line2, &fPoint); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp index de8be75d8..de0efe2c6 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp @@ -114,7 +114,7 @@ auto VToolPointOfContact::FindPoint(qreal radius, const QPointF ¢er, const Q SCASSERT(intersectionPoint != nullptr) QPointF p1, p2; - qint32 res = VGObject::LineIntersectCircle(center, qAbs(radius), QLineF(firstPoint, secondPoint), p1, p2); + qint32 const res = VGObject::LineIntersectCircle(center, qAbs(radius), QLineF(firstPoint, secondPoint), p1, p2); switch (res) { case 0: diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp index 42b553c2e..3370e4f04 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp @@ -127,7 +127,7 @@ auto VToolPointOfIntersection::Create(VToolPointOfIntersectionInitData initData) const QSharedPointer firstPoint = initData.data->GeometricObject(initData.firstPointId); const QSharedPointer secondPoint = initData.data->GeometricObject(initData.secondPointId); - QPointF point(firstPoint->x(), secondPoint->y()); + QPointF const point(firstPoint->x(), secondPoint->y()); VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my); p->SetShowLabel(initData.showLabel); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp index 4119ec7fc..7f7d8f748 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp @@ -320,7 +320,7 @@ void VToolSinglePoint::SaveOptions(QDomElement &tag, QSharedPointer &o { VDrawTool::SaveOptions(tag, obj); - QSharedPointer point = qSharedPointerDynamicCast(obj); + QSharedPointer const point = qSharedPointerDynamicCast(obj); SCASSERT(point.isNull() == false) doc->SetAttribute(tag, AttrName, point->name()); @@ -343,7 +343,7 @@ void VToolSinglePoint::ChangeLabelPosition(quint32 id, const QPointF &pos) { if (id == m_id) { - QSharedPointer point = VAbstractTool::data.GeometricObject(id); + QSharedPointer const point = VAbstractTool::data.GeometricObject(id); point->setMx(pos.x()); point->setMy(pos.y()); m_namePoint->SetRealPos(pos); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp index 85d65133a..408ab9806 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp @@ -197,11 +197,11 @@ auto VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, cons { SCASSERT(intersectionPoint != nullptr) - QLineF axis(axisP1, axisP2); - QLineF hypotenuse(firstPoint, secondPoint); + QLineF const axis(axisP1, axisP2); + QLineF const hypotenuse(firstPoint, secondPoint); QPointF startPoint; - QLineF::IntersectType intersect = axis.intersects(hypotenuse, &startPoint); + QLineF::IntersectType const intersect = axis.intersects(hypotenuse, &startPoint); if (intersect != QLineF::UnboundedIntersection && intersect != QLineF::BoundedIntersection) { @@ -213,19 +213,19 @@ auto VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, cons return false; } - qreal step = 1; + qreal const step = 1; QLineF line; line.setP1(startPoint); line.setAngle(axis.angle()); line.setLength(step); - qint64 c = qFloor(hypotenuse.length()); + qint64 const c = qFloor(hypotenuse.length()); while (true) { line.setLength(line.length() + step); - qint64 a = qFloor(QLineF(line.p2(), firstPoint).length()); - qint64 b = qFloor(QLineF(line.p2(), secondPoint).length()); + qint64 const a = qFloor(QLineF(line.p2(), firstPoint).length()); + qint64 const b = qFloor(QLineF(line.p2(), secondPoint).length()); if (c * c <= (a * a + b * b)) { *intersectionPoint = line.p2(); diff --git a/src/libs/vtools/tools/drawTools/vdrawtool.cpp b/src/libs/vtools/tools/drawTools/vdrawtool.cpp index 5410424bc..cdf47d5ae 100644 --- a/src/libs/vtools/tools/drawTools/vdrawtool.cpp +++ b/src/libs/vtools/tools/drawTools/vdrawtool.cpp @@ -106,7 +106,7 @@ void VDrawTool::SaveDialogChange(const QString &undoText) { Q_UNUSED(undoText) qCDebug(vTool, "Saving tool options after using dialog"); - QDomElement oldDomElement = doc->elementById(m_id, getTagName()); + QDomElement const oldDomElement = doc->elementById(m_id, getTagName()); if (oldDomElement.isElement()) { QDomElement newDomElement = oldDomElement.cloneNode().toElement(); @@ -150,7 +150,7 @@ void VDrawTool::AddToFile() void VDrawTool::SaveOption(QSharedPointer &obj) { qCDebug(vTool, "Saving tool options"); - QDomElement oldDomElement = doc->elementById(m_id, getTagName()); + QDomElement const oldDomElement = doc->elementById(m_id, getTagName()); if (oldDomElement.isElement()) { QDomElement newDomElement = oldDomElement.cloneNode().toElement(); diff --git a/src/libs/vtools/tools/drawTools/vdrawtool.h b/src/libs/vtools/tools/drawTools/vdrawtool.h index 51d241e71..89e3593c7 100644 --- a/src/libs/vtools/tools/drawTools/vdrawtool.h +++ b/src/libs/vtools/tools/drawTools/vdrawtool.h @@ -315,8 +315,8 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI } else if (selectedAction->actionGroup() == actionsAddToGroup) { - quint32 groupId = selectedAction->data().toUInt(); - QDomElement item = doc->AddItemToGroup(this->getId(), itemId, groupId); + quint32 const groupId = selectedAction->data().toUInt(); + QDomElement const item = doc->AddItemToGroup(this->getId(), itemId, groupId); auto *scene = qobject_cast(VAbstractValApplication::VApp()->getCurrentScene()); SCASSERT(scene != nullptr) @@ -333,8 +333,8 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI } else if (selectedAction->actionGroup() == actionsRemoveFromGroup) { - quint32 groupId = selectedAction->data().toUInt(); - QDomElement item = doc->RemoveItemFromGroup(this->getId(), itemId, groupId); + quint32 const groupId = selectedAction->data().toUInt(); + QDomElement const item = doc->RemoveItemFromGroup(this->getId(), itemId, groupId); auto *window = qobject_cast(VAbstractValApplication::VApp()->getMainWindow()); SCASSERT(window != nullptr) diff --git a/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp b/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp index b0b18ee47..b913aedca 100644 --- a/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp +++ b/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp @@ -181,7 +181,7 @@ void VNodePoint::ChangeLabelPosition(quint32 id, const QPointF &pos) { if (id == m_id) { - QSharedPointer point = VAbstractTool::data.GeometricObject(id); + QSharedPointer const point = VAbstractTool::data.GeometricObject(id); point->setMx(pos.x()); point->setMy(pos.y()); m_namePoint->SetRealPos(pos); @@ -540,7 +540,7 @@ void VNodePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) } QMenu menu; - QHash contextMenu = InitContextMenu(&menu, piece->getId(), piece->referens()); + QHash const contextMenu = InitContextMenu(&menu, piece->getId(), piece->referens()); PieceNodeAngle angleCurType = PieceNodeAngle::ByLength; PassmarkAngleType passmarkAngleCurType = PassmarkAngleType::Straightforward; @@ -584,7 +584,7 @@ void VNodePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) }; QAction *selectedAction = menu.exec(event->screenPos()); - ContextMenuOption selectedOption = static_cast( + ContextMenuOption const selectedOption = static_cast( contextMenu.key(selectedAction, static_cast(ContextMenuOption::NoSelection))); Q_STATIC_ASSERT_X(static_cast(ContextMenuOption::LAST_ONE_DO_NOT_USE) == 35, "Not all options were handled."); diff --git a/src/libs/vtools/tools/nodeDetails/vtoolpiecepath.cpp b/src/libs/vtools/tools/nodeDetails/vtoolpiecepath.cpp index b0535f3c2..933d03346 100644 --- a/src/libs/vtools/tools/nodeDetails/vtoolpiecepath.cpp +++ b/src/libs/vtools/tools/nodeDetails/vtoolpiecepath.cpp @@ -313,7 +313,7 @@ void VToolPiecePath::RefreshGeometry() QLineF mirrorLine; if (pieceId > NULL_ID) { - VPiece piece = VAbstractTool::data.GetPiece(pieceId); + VPiece const piece = VAbstractTool::data.GetPiece(pieceId); // We cannot use current VContainer because it doesn't have current seam allowance value const VContainer pData = VAbstractPattern::getTool(pieceId)->getData(); cuttingPath = piece.CuttingPathPoints(&pData); diff --git a/src/libs/vtools/tools/nodeDetails/vtoolplacelabel.cpp b/src/libs/vtools/tools/nodeDetails/vtoolplacelabel.cpp index 1e648d40f..7d276b522 100644 --- a/src/libs/vtools/tools/nodeDetails/vtoolplacelabel.cpp +++ b/src/libs/vtools/tools/nodeDetails/vtoolplacelabel.cpp @@ -70,7 +70,7 @@ auto VToolPlaceLabel::Create(VToolPlaceLabelInitData &initData) -> VToolPlaceLab const qreal a = CheckFormula(initData.id, initData.angle, initData.data); const qreal v = CheckFormula(initData.id, initData.visibilityTrigger, initData.data); - QSharedPointer node(new VPlaceLabelItem()); + QSharedPointer const node(new VPlaceLabelItem()); node->SetWidth(w, initData.width); node->SetHeight(h, initData.height); node->SetAngle(a, initData.angle); @@ -113,7 +113,7 @@ auto VToolPlaceLabel::Create(VToolPlaceLabelInitData &initData) -> VToolPlaceLab if (initData.idTool != NULL_ID) { - QSharedPointer label = qSharedPointerDynamicCast(point); + QSharedPointer const label = qSharedPointerDynamicCast(point); SCASSERT(label.isNull() == false) node->SetCorrectionAngle(label->GetCorrectionAngle()); diff --git a/src/libs/vtools/tools/toolsdef.cpp b/src/libs/vtools/tools/toolsdef.cpp index a8211127e..398b65725 100644 --- a/src/libs/vtools/tools/toolsdef.cpp +++ b/src/libs/vtools/tools/toolsdef.cpp @@ -65,7 +65,7 @@ auto SourceAliasValid(const SourceItem &item, const QSharedPointer &ob { SCASSERT(data != nullptr) - QRegularExpression rx(NameRegExp()); + QRegularExpression const rx(NameRegExp()); QString alias; @@ -133,7 +133,7 @@ auto ConfirmDeletion() -> int msgBox.setDefaultButton(QDialogButtonBox::No); msgBox.setIconPixmap(QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion).pixmap(32, 32)); - int dialogResult = msgBox.exec(); + int const dialogResult = msgBox.exec(); if (dialogResult == QDialog::Accepted) { diff --git a/src/libs/vtools/tools/vabstracttool.cpp b/src/libs/vtools/tools/vabstracttool.cpp index c08255b86..852e85531 100644 --- a/src/libs/vtools/tools/vabstracttool.cpp +++ b/src/libs/vtools/tools/vabstracttool.cpp @@ -134,7 +134,7 @@ auto VAbstractTool::CheckFormula(const quint32 &toolId, QString &formula, VConta qreal result = 0; try { - QScopedPointer cal(new Calculator()); + QScopedPointer const cal(new Calculator()); result = cal->EvalFormula(data->DataVariables(), formula); if (qIsInf(result) || qIsNaN(result)) @@ -153,7 +153,8 @@ auto VAbstractTool::CheckFormula(const quint32 &toolId, QString &formula, VConta if (VAbstractApplication::VApp()->IsAppInGUIMode()) { - QScopedPointer dialogUndo(new DialogUndo(VAbstractValApplication::VApp()->getMainWindow())); + QScopedPointer const dialogUndo( + new DialogUndo(VAbstractValApplication::VApp()->getMainWindow())); forever { if (dialogUndo->exec() == QDialog::Accepted) @@ -171,7 +172,7 @@ auto VAbstractTool::CheckFormula(const quint32 &toolId, QString &formula, VConta /* Need delete dialog here because parser in dialog don't allow use correct separator for * parsing here. */ delete dialog; - QScopedPointer cal1(new Calculator()); + QScopedPointer const cal1(new Calculator()); result = cal1->EvalFormula(data->DataVariables(), formula); if (qIsInf(result) || qIsNaN(result)) @@ -227,7 +228,7 @@ void VAbstractTool::DeleteToolWithConfirm(bool ask) PerformDelete(); // Throw exception, this will help prevent case when we forget to immediately quit function. - VExceptionToolWasDeleted e("Tool was used after deleting."); + VExceptionToolWasDeleted const e("Tool was used after deleting."); throw e; } else @@ -335,7 +336,7 @@ auto VAbstractTool::PointsList() const -> QMap { if (i.key() != m_id) { - QSharedPointer obj = i.value(); + QSharedPointer const obj = i.value(); if (obj->getType() == GOType::Point) { const QSharedPointer point = data.GeometricObject(i.key()); @@ -422,7 +423,7 @@ void VAbstractTool::AddRecord(const VToolRecord &record, VAbstractPattern *doc) return; } - quint32 cursor = doc->getCursor(); + quint32 const cursor = doc->getCursor(); if (cursor == NULL_ID) { history->append(record); @@ -432,7 +433,7 @@ void VAbstractTool::AddRecord(const VToolRecord &record, VAbstractPattern *doc) qint32 index = 0; for (qint32 i = 0; i < history->size(); ++i) { - VToolRecord rec = history->at(i); + VToolRecord const rec = history->at(i); if (rec.getId() == cursor) { index = i; @@ -708,7 +709,7 @@ auto VAbstractTool::CreateNodeSplinePath(VContainer *data, quint32 id) -> quint3 auto VAbstractTool::CreateNodePoint(VContainer *data, quint32 id, const QSharedPointer &point) -> quint32 { const quint32 pointId = CreateNode(data, id); - QSharedPointer p = data->GeometricObject(pointId); + QSharedPointer const p = data->GeometricObject(pointId); p->SetShowLabel(point->IsShowLabel()); p->setMx(point->mx()); p->setMy(point->my()); diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 0ebe70a82..edc5432fa 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -141,7 +141,7 @@ auto DuplicatePins(const QVector &pins, const VToolSeamAllowanceInitDat QMap newPins; for (auto p : pins) { - QSharedPointer pin = initData.data->GeometricObject(p); + QSharedPointer const pin = initData.data->GeometricObject(p); auto *tool = qobject_cast(VAbstractPattern::getTool(p)); SCASSERT(tool != nullptr) @@ -194,13 +194,13 @@ auto RenderSeamPath(const VPiece &detail, bool combineTogether, const VContainer const QVector passmarks = VLayoutPiece::ConvertPassmarks(detail, data); const QVector points = detail.FullMainPathPoints(data); - bool seamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn(); - bool builtInSeamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn(); + bool const seamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn(); + bool const builtInSeamAllowance = detail.IsSeamAllowance() && detail.IsSeamAllowanceBuiltIn(); VBoundary boundary(points, seamAllowance, builtInSeamAllowance); boundary.SetPieceName(detail.GetName()); - QLineF mirrorLine = detail.SeamMirrorLine(data); + QLineF const mirrorLine = detail.SeamMirrorLine(data); if (!mirrorLine.isNull() && detail.IsShowFullPiece()) { boundary.SetMirrorLine(mirrorLine); @@ -1122,7 +1122,7 @@ void VToolSeamAllowance::UpdateGrainline() */ void VToolSeamAllowance::SaveMoveDetail(const QPointF &ptPos) { - VPiece oldDet = VAbstractTool::data.GetPiece(m_id); + VPiece const oldDet = VAbstractTool::data.GetPiece(m_id); VPiece newDet = oldDet; newDet.GetPieceLabelData().SetPos(ptPos); @@ -1137,7 +1137,7 @@ void VToolSeamAllowance::SaveMoveDetail(const QPointF &ptPos) */ void VToolSeamAllowance::SaveResizeDetail(qreal dLabelW) { - VPiece oldDet = VAbstractTool::data.GetPiece(m_id); + VPiece const oldDet = VAbstractTool::data.GetPiece(m_id); VPiece newDet = oldDet; dLabelW = FromPixel(dLabelW, *VDataTool::data.GetPatternUnit()); @@ -1176,7 +1176,7 @@ void VToolSeamAllowance::SaveRotationDetail(qreal dRot) */ void VToolSeamAllowance::SaveMovePattern(const QPointF &ptPos) { - VPiece oldDet = VAbstractTool::data.GetPiece(m_id); + VPiece const oldDet = VAbstractTool::data.GetPiece(m_id); VPiece newDet = oldDet; newDet.GetPatternLabelData().SetPos(ptPos); @@ -1191,12 +1191,12 @@ void VToolSeamAllowance::SaveMovePattern(const QPointF &ptPos) */ void VToolSeamAllowance::SaveResizePattern(qreal dLabelW) { - VPiece oldDet = VAbstractTool::data.GetPiece(m_id); + VPiece const oldDet = VAbstractTool::data.GetPiece(m_id); VPiece newDet = oldDet; dLabelW = FromPixel(dLabelW, *VDataTool::data.GetPatternUnit()); newDet.GetPatternLabelData().SetLabelWidth(QString().setNum(dLabelW)); - qreal height = FromPixel(m_patternInfo->boundingRect().height(), *VDataTool::data.GetPatternUnit()); + qreal const height = FromPixel(m_patternInfo->boundingRect().height(), *VDataTool::data.GetPatternUnit()); newDet.GetPatternLabelData().SetLabelHeight(QString().setNum(height)); auto *resizeCommand = new SavePieceOptions(oldDet, newDet, doc, m_id); @@ -1207,7 +1207,7 @@ void VToolSeamAllowance::SaveResizePattern(qreal dLabelW) //--------------------------------------------------------------------------------------------------------------------- void VToolSeamAllowance::SaveRotationPattern(qreal dRot) { - VPiece oldDet = VAbstractTool::data.GetPiece(m_id); + VPiece const oldDet = VAbstractTool::data.GetPiece(m_id); VPiece newDet = oldDet; newDet.GetPatternLabelData().SetPos(m_patternInfo->pos()); @@ -1226,7 +1226,7 @@ void VToolSeamAllowance::SaveRotationPattern(qreal dRot) //--------------------------------------------------------------------------------------------------------------------- void VToolSeamAllowance::SaveMoveGrainline(const QPointF &ptPos) { - VPiece oldDet = VAbstractTool::data.GetPiece(m_id); + VPiece const oldDet = VAbstractTool::data.GetPiece(m_id); VPiece newDet = oldDet; newDet.GetGrainlineGeometry().SetPos(ptPos); qDebug() << "******* new grainline pos" << ptPos; @@ -1239,7 +1239,7 @@ void VToolSeamAllowance::SaveMoveGrainline(const QPointF &ptPos) //--------------------------------------------------------------------------------------------------------------------- void VToolSeamAllowance::SaveResizeGrainline(qreal dLength) { - VPiece oldDet = VAbstractTool::data.GetPiece(m_id); + VPiece const oldDet = VAbstractTool::data.GetPiece(m_id); VPiece newDet = oldDet; dLength = FromPixel(dLength, *VDataTool::data.GetPatternUnit()); @@ -1254,7 +1254,7 @@ void VToolSeamAllowance::SaveResizeGrainline(qreal dLength) //--------------------------------------------------------------------------------------------------------------------- void VToolSeamAllowance::SaveRotateGrainline(qreal dRot, const QPointF &ptPos) { - VPiece oldDet = VAbstractTool::data.GetPiece(m_id); + VPiece const oldDet = VAbstractTool::data.GetPiece(m_id); VPiece newDet = oldDet; newDet.GetGrainlineGeometry().SetRotation(QString().setNum(qRadiansToDegrees(dRot))); @@ -1687,7 +1687,7 @@ VToolSeamAllowance::VToolSeamAllowance(const VToolSeamAllowanceInitData &initDat m_foldLineLabel(new QGraphicsPathItem(this)), m_foldLineLabelText(new QGraphicsSimpleTextItem(this)) { - VPiece detail = initData.data->GetPiece(initData.id); + VPiece const detail = initData.data->GetPiece(initData.id); ReinitInternals(detail, m_sceneDetails); VToolSeamAllowance::AllowSelecting(true); EnableToolMove(true); @@ -1925,7 +1925,7 @@ void VToolSeamAllowance::SaveDialogChange(const QString &undoText) //--------------------------------------------------------------------------------------------------------------------- void VToolSeamAllowance::ShowOptions() { - QPointer dialog = + QPointer const dialog = new DialogSeamAllowance(getData(), doc, m_id, VAbstractValApplication::VApp()->getMainWindow()); dialog->EnableApply(true); m_dialog = dialog; @@ -2693,7 +2693,7 @@ auto VToolSeamAllowance::DuplicatePlaceLabels(const QVector &placeLabel newPlaceLabels.reserve(placeLabels.size()); for (auto placeLabel : placeLabels) { - QSharedPointer label = initData.data->GeometricObject(placeLabel); + QSharedPointer const label = initData.data->GeometricObject(placeLabel); auto *tool = qobject_cast(VAbstractPattern::getTool(placeLabel)); SCASSERT(tool != nullptr) diff --git a/src/libs/vtools/tools/vtooluniondetails.cpp b/src/libs/vtools/tools/vtooluniondetails.cpp index e12f69f52..149c06072 100644 --- a/src/libs/vtools/tools/vtooluniondetails.cpp +++ b/src/libs/vtools/tools/vtooluniondetails.cpp @@ -510,8 +510,8 @@ auto AddNodeArc(const VPieceNode &node, const VToolUnionDetailsInitData &initDat BiasRotatePoint(center.get(), dx, dy, p, angle); } - QLineF l1(static_cast(*center), static_cast(p1)); - QLineF l2(static_cast(*center), static_cast(p2)); + QLineF const l1(static_cast(*center), static_cast(p1)); + QLineF const l2(static_cast(*center), static_cast(p2)); center->setMode(Draw::Modeling); VPointF *tmpCenter = center.release(); const quint32 idCenter = initData.data->AddGObject(tmpCenter); @@ -561,11 +561,11 @@ auto AddNodeElArc(const VPieceNode &node, const VToolUnionDetailsInitData &initD BiasRotatePoint(center.get(), dx, dy, p, angle); } - QLineF l1(static_cast(*center), static_cast(p1)); - QLineF l2(static_cast(*center), static_cast(p2)); + QLineF const l1(static_cast(*center), static_cast(p1)); + QLineF const l2(static_cast(*center), static_cast(p2)); center->setMode(Draw::Modeling); VPointF *tmpCenter = center.release(); - quint32 idCenter = initData.data->AddGObject(tmpCenter); + quint32 const idCenter = initData.data->AddGObject(tmpCenter); Q_UNUSED(idCenter) std::unique_ptr arc1(new VEllipticalArc( *tmpCenter, arc->GetRadius1(), arc->GetRadius2(), arc->GetFormulaRadius1(), arc->GetFormulaRadius2(), @@ -602,10 +602,10 @@ auto AddNodeSpline(const VPieceNode &node, const VToolUnionDetailsInitData &init const QSharedPointer spline = initData.data->GeometricObject(node.GetId()); - QScopedPointer p1(new VPointF(spline->GetP1())); + QScopedPointer const p1(new VPointF(spline->GetP1())); VPointF p2 = spline->GetP2(); VPointF p3 = spline->GetP3(); - QScopedPointer p4(new VPointF(spline->GetP4())); + QScopedPointer const p4(new VPointF(spline->GetP4())); if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) { @@ -652,10 +652,10 @@ auto AddNodeSplinePath(const VPieceNode &node, const VToolUnionDetailsInitData & { const VSpline spline = splinePath->GetSpline(i); - QScopedPointer p1(new VPointF(spline.GetP1())); + QScopedPointer const p1(new VPointF(spline.GetP1())); VPointF p2 = spline.GetP2(); VPointF p3 = spline.GetP3(); - QScopedPointer p4(new VPointF(spline.GetP4())); + QScopedPointer const p4(new VPointF(spline.GetP4())); if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) { const QPointF p = static_cast(*initData.data->GeometricObject(pRotate)); @@ -666,7 +666,7 @@ auto AddNodeSplinePath(const VPieceNode &node, const VToolUnionDetailsInitData & BiasRotatePoint(p4.data(), dx, dy, p, angle); } - VSpline spl = VSpline(*p1, static_cast(p2), static_cast(p3), *p4); + VSpline const spl = VSpline(*p1, static_cast(p2), static_cast(p3), *p4); if (i == 1) { const qreal angle1 = spl.GetStartAngle() + 180; @@ -939,7 +939,7 @@ void UpdateNodeArc(VContainer *data, const VPieceNode &node, QVector &c const QSharedPointer arc = data->GeometricObject(node.GetId()); VPointF p1 = VPointF(arc->GetP1()); VPointF p2 = VPointF(arc->GetP2()); - QScopedPointer center(new VPointF(arc->GetCenter())); + QScopedPointer const center(new VPointF(arc->GetCenter())); if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) { @@ -950,8 +950,8 @@ void UpdateNodeArc(VContainer *data, const VPieceNode &node, QVector &c BiasRotatePoint(center.data(), dx, dy, p, angle); } - QLineF l1(static_cast(*center), static_cast(p1)); - QLineF l2(static_cast(*center), static_cast(p2)); + QLineF const l1(static_cast(*center), static_cast(p1)); + QLineF const l2(static_cast(*center), static_cast(p2)); std::unique_ptr arc1(new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(), QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle()))); @@ -966,7 +966,7 @@ void UpdateNodeElArc(VContainer *data, const VPieceNode &node, QVector const QSharedPointer arc = data->GeometricObject(node.GetId()); VPointF p1 = VPointF(arc->GetP1()); VPointF p2 = VPointF(arc->GetP2()); - QScopedPointer center(new VPointF(arc->GetCenter())); + QScopedPointer const center(new VPointF(arc->GetCenter())); if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) { @@ -977,8 +977,8 @@ void UpdateNodeElArc(VContainer *data, const VPieceNode &node, QVector BiasRotatePoint(center.data(), dx, dy, p, angle); } - QLineF l1(static_cast(*center), static_cast(p1)); - QLineF l2(static_cast(*center), static_cast(p2)); + QLineF const l1(static_cast(*center), static_cast(p1)); + QLineF const l2(static_cast(*center), static_cast(p2)); std::unique_ptr arc1(new VEllipticalArc( *center, arc->GetRadius1(), arc->GetRadius2(), arc->GetFormulaRadius1(), arc->GetFormulaRadius2(), l1.angle(), @@ -993,10 +993,10 @@ void UpdateNodeSpline(VContainer *data, const VPieceNode &node, QVector { const QSharedPointer spline = data->GeometricObject(node.GetId()); - QScopedPointer p1(new VPointF(spline->GetP1())); + QScopedPointer const p1(new VPointF(spline->GetP1())); VPointF p2 = spline->GetP2(); VPointF p3 = spline->GetP3(); - QScopedPointer p4(new VPointF(spline->GetP4())); + QScopedPointer const p4(new VPointF(spline->GetP4())); if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) { @@ -1026,10 +1026,10 @@ void UpdateNodeSplinePath(VContainer *data, const VPieceNode &node, QVectorGetSpline(i); - QScopedPointer p1(new VPointF(spline.GetP1())); + QScopedPointer const p1(new VPointF(spline.GetP1())); VPointF p2 = spline.GetP2(); VPointF p3 = spline.GetP3(); - QScopedPointer p4(new VPointF(spline.GetP4())); + QScopedPointer const p4(new VPointF(spline.GetP4())); 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); + VSpline const spl = VSpline(*p1, static_cast(p2), static_cast(p3), *p4); if (i == 1) { const qreal angle1 = spl.GetStartAngle() + 180; @@ -1247,7 +1247,7 @@ void CreateUnitedInternalPaths(VPiece &newDetail, const VPiece &d1, const VPiece void CreateUnitedDetailPins(VPiece &newDetail, const VPiece &d, QVector &children, const QString &drawName, const VToolUnionDetailsInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle) { - QVector nodeChildren; + QVector const nodeChildren; const QVector pins = d.GetPins(); for (auto pin : pins) { @@ -1262,7 +1262,7 @@ void CreateUnitedDetailPlaceLabels(VPiece &newDetail, const VPiece &d, QVector nodeChildren; + QVector const nodeChildren; const QVector placeLabels = d.GetPlaceLabels(); for (auto placeLabel : placeLabels) { @@ -1501,7 +1501,7 @@ void UpdateUnitedDetailPlaceLabels(const VToolUnionDetailsInitData &initData, qr for (auto record : records) { - QSharedPointer parentLabel = initData.data->GeometricObject(record); + QSharedPointer const parentLabel = initData.data->GeometricObject(record); if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) { BiasRotatePoint(parentLabel.data(), dx, dy, @@ -1537,7 +1537,7 @@ void CreateUnitedDetail(const VToolUnionDetailsInitData &initData, qreal dx, qre CreateUnitedPlaceLabels(newDetail, d1, d2, drawName, initData, dx, dy, pRotate, angle); newDetail.SetName(QObject::tr("United detail")); - QString formulaSAWidth = d1.GetFormulaSAWidth(); + QString const formulaSAWidth = d1.GetFormulaSAWidth(); newDetail.SetFormulaSAWidth(formulaSAWidth, d1.GetSAWidth()); newDetail.SetMx(d1.GetMx()); newDetail.SetMy(d1.GetMy()); diff --git a/src/libs/vtools/undocommands/addpatternpiece.cpp b/src/libs/vtools/undocommands/addpatternpiece.cpp index ecea6430e..eebe624b6 100644 --- a/src/libs/vtools/undocommands/addpatternpiece.cpp +++ b/src/libs/vtools/undocommands/addpatternpiece.cpp @@ -55,7 +55,7 @@ void AddPatternPiece::undo() else { QDomElement rootElement = doc->documentElement(); - QDomElement patternPiece = doc->GetPPElement(namePP); + QDomElement const patternPiece = doc->GetPPElement(namePP); rootElement.removeChild(patternPiece); emit NeedFullParsing(); } diff --git a/src/libs/vtools/undocommands/addpiece.cpp b/src/libs/vtools/undocommands/addpiece.cpp index 3e9a4ba2f..7c21d7d78 100644 --- a/src/libs/vtools/undocommands/addpiece.cpp +++ b/src/libs/vtools/undocommands/addpiece.cpp @@ -62,7 +62,7 @@ void AddPiece::undo() QDomElement details = GetDetailsSection(); if (not details.isNull()) { - QDomElement domElement = doc->elementById(nodeId, VAbstractPattern::TagDetail); + QDomElement const domElement = doc->elementById(nodeId, VAbstractPattern::TagDetail); if (domElement.isElement()) { if (details.removeChild(domElement).isNull()) diff --git a/src/libs/vtools/undocommands/addtocalc.cpp b/src/libs/vtools/undocommands/addtocalc.cpp index 528188893..2b6c9c32c 100644 --- a/src/libs/vtools/undocommands/addtocalc.cpp +++ b/src/libs/vtools/undocommands/addtocalc.cpp @@ -56,7 +56,7 @@ void AddToCalc::undo() QDomElement calcElement; if (doc->GetActivNodeElement(VAbstractPattern::TagCalculation, calcElement)) { - QDomElement domElement = doc->elementById(nodeId); + QDomElement const domElement = doc->elementById(nodeId); if (domElement.isElement()) { if (calcElement.removeChild(domElement).isNull()) @@ -102,7 +102,7 @@ void AddToCalc::redo() } else { - QDomElement refElement = doc->elementById(cursor); + QDomElement const refElement = doc->elementById(cursor); if (refElement.isElement()) { calcElement.insertAfter(xml, refElement); diff --git a/src/libs/vtools/undocommands/deletepiece.cpp b/src/libs/vtools/undocommands/deletepiece.cpp index 1d2f7a64c..3f9237c32 100644 --- a/src/libs/vtools/undocommands/deletepiece.cpp +++ b/src/libs/vtools/undocommands/deletepiece.cpp @@ -55,12 +55,12 @@ DeletePiece::DeletePiece(VAbstractPattern *doc, quint32 id, const VContainer &da { setText(tr("delete tool")); nodeId = id; - QDomElement domElement = doc->elementById(id, VAbstractPattern::TagDetail); + QDomElement const domElement = doc->elementById(id, VAbstractPattern::TagDetail); if (domElement.isElement()) { xml = domElement.cloneNode().toElement(); m_parentNode = domElement.parentNode(); - QDomNode previousDetail = domElement.previousSibling(); + QDomNode const previousDetail = domElement.previousSibling(); if (previousDetail.isNull()) { m_siblingId = NULL_ID; @@ -112,7 +112,7 @@ void DeletePiece::redo() { qCDebug(vUndo, "Redo."); - QDomElement domElement = doc->elementById(nodeId, VAbstractPattern::TagDetail); + QDomElement const domElement = doc->elementById(nodeId, VAbstractPattern::TagDetail); if (domElement.isElement()) { m_parentNode.removeChild(domElement); diff --git a/src/libs/vtools/undocommands/deltool.cpp b/src/libs/vtools/undocommands/deltool.cpp index 8b8267b88..303e8cc1f 100644 --- a/src/libs/vtools/undocommands/deltool.cpp +++ b/src/libs/vtools/undocommands/deltool.cpp @@ -62,7 +62,7 @@ DelTool::DelTool(VAbstractPattern *doc, quint32 id, QUndoCommand *parent) xml = doc->CloneNodeById(nodeId); QVector> cleanItems; - QMap groups = doc->GetGroups(nameActivDraw); + QMap const groups = doc->GetGroups(nameActivDraw); auto i = groups.constBegin(); while (i != groups.constEnd()) { @@ -122,7 +122,7 @@ void DelTool::redo() { // Keep first! emit doc->SetCurrentPP(nameActivDraw); // Without this user will not see this change } - QDomElement domElement = doc->NodeById(nodeId); + QDomElement const domElement = doc->NodeById(nodeId); parentNode.removeChild(domElement); if (not m_groupsAfter.isEmpty()) diff --git a/src/libs/vtools/undocommands/image/deletebackgroundimage.cpp b/src/libs/vtools/undocommands/image/deletebackgroundimage.cpp index 14517493a..badd45c1d 100644 --- a/src/libs/vtools/undocommands/image/deletebackgroundimage.cpp +++ b/src/libs/vtools/undocommands/image/deletebackgroundimage.cpp @@ -35,7 +35,7 @@ DeleteBackgroundImage::DeleteBackgroundImage(const VBackgroundPatternImage &imag { setText(tr("delete background image")); - QVector allImages = doc->GetBackgroundImages(); + QVector const allImages = doc->GetBackgroundImages(); for (int i = 0; i < allImages.size(); ++i) { diff --git a/src/libs/vtools/undocommands/image/hideallbackgroundimages.cpp b/src/libs/vtools/undocommands/image/hideallbackgroundimages.cpp index a18443de1..456077589 100644 --- a/src/libs/vtools/undocommands/image/hideallbackgroundimages.cpp +++ b/src/libs/vtools/undocommands/image/hideallbackgroundimages.cpp @@ -42,7 +42,7 @@ HideAllBackgroundImages::HideAllBackgroundImages(bool hide, VAbstractPattern *do setText(tr("show all background images")); } - QVector images = doc->GetBackgroundImages(); + QVector const images = doc->GetBackgroundImages(); for (const auto& image : images) { diff --git a/src/libs/vtools/undocommands/image/hidebackgroundimage.cpp b/src/libs/vtools/undocommands/image/hidebackgroundimage.cpp index 70c8dff05..2e41a9343 100644 --- a/src/libs/vtools/undocommands/image/hidebackgroundimage.cpp +++ b/src/libs/vtools/undocommands/image/hidebackgroundimage.cpp @@ -43,7 +43,7 @@ HideBackgroundImage::HideBackgroundImage(QUuid id, bool hide, VAbstractPattern * setText(tr("show a background image")); } - VBackgroundPatternImage image = doc->GetBackgroundImage(m_id); + VBackgroundPatternImage const image = doc->GetBackgroundImage(m_id); m_oldVisibility = image.Visible(); } diff --git a/src/libs/vtools/undocommands/image/holdallbackgroundimages.cpp b/src/libs/vtools/undocommands/image/holdallbackgroundimages.cpp index 12c9d47a2..2bea8ea0e 100644 --- a/src/libs/vtools/undocommands/image/holdallbackgroundimages.cpp +++ b/src/libs/vtools/undocommands/image/holdallbackgroundimages.cpp @@ -42,7 +42,7 @@ HoldAllBackgroundImages::HoldAllBackgroundImages(bool hold, VAbstractPattern *do setText(tr("unhold background images")); } - QVector images = doc->GetBackgroundImages(); + QVector const images = doc->GetBackgroundImages(); for (const auto& image : images) { diff --git a/src/libs/vtools/undocommands/image/holdbackgroundimage.cpp b/src/libs/vtools/undocommands/image/holdbackgroundimage.cpp index 259fabe71..541be95b5 100644 --- a/src/libs/vtools/undocommands/image/holdbackgroundimage.cpp +++ b/src/libs/vtools/undocommands/image/holdbackgroundimage.cpp @@ -43,7 +43,7 @@ HoldBackgroundImage::HoldBackgroundImage(QUuid id, bool hold, VAbstractPattern * setText(tr("unhold background image")); } - VBackgroundPatternImage image = doc->GetBackgroundImage(m_id); + VBackgroundPatternImage const image = doc->GetBackgroundImage(m_id); m_oldHold = image.Hold(); } diff --git a/src/libs/vtools/undocommands/image/movebackgroundimage.cpp b/src/libs/vtools/undocommands/image/movebackgroundimage.cpp index 8e4586d10..e1d89ef4e 100644 --- a/src/libs/vtools/undocommands/image/movebackgroundimage.cpp +++ b/src/libs/vtools/undocommands/image/movebackgroundimage.cpp @@ -39,7 +39,7 @@ MoveBackgroundImage::MoveBackgroundImage(QUuid id, qreal dx, qreal dy, VAbstract { setText(tr("move background image")); - VBackgroundPatternImage image = doc->GetBackgroundImage(m_id); + VBackgroundPatternImage const image = doc->GetBackgroundImage(m_id); m_oldPos = image.Matrix(); } diff --git a/src/libs/vtools/undocommands/image/opaquebackgroundimage.cpp b/src/libs/vtools/undocommands/image/opaquebackgroundimage.cpp index ead305b1c..c9b5cc13c 100644 --- a/src/libs/vtools/undocommands/image/opaquebackgroundimage.cpp +++ b/src/libs/vtools/undocommands/image/opaquebackgroundimage.cpp @@ -36,7 +36,7 @@ OpaqueBackgroundImage::OpaqueBackgroundImage(QUuid id, qreal opacity, VAbstractP { setText(tr("change a background image opacity")); - VBackgroundPatternImage image = doc->GetBackgroundImage(m_id); + VBackgroundPatternImage const image = doc->GetBackgroundImage(m_id); m_oldOpacity = image.Opacity(); } diff --git a/src/libs/vtools/undocommands/image/renamebackgroundimage.cpp b/src/libs/vtools/undocommands/image/renamebackgroundimage.cpp index 158f6437d..88b131e8a 100644 --- a/src/libs/vtools/undocommands/image/renamebackgroundimage.cpp +++ b/src/libs/vtools/undocommands/image/renamebackgroundimage.cpp @@ -36,7 +36,7 @@ RenameBackgroundImage::RenameBackgroundImage(QUuid id, const QString &name, VAbs { setText(tr("rename background image")); - VBackgroundPatternImage image = doc->GetBackgroundImage(m_id); + VBackgroundPatternImage const image = doc->GetBackgroundImage(m_id); m_oldName = image.Name(); } diff --git a/src/libs/vtools/undocommands/image/resetbackgroundimage.cpp b/src/libs/vtools/undocommands/image/resetbackgroundimage.cpp index 54fca82dc..b965a5780 100644 --- a/src/libs/vtools/undocommands/image/resetbackgroundimage.cpp +++ b/src/libs/vtools/undocommands/image/resetbackgroundimage.cpp @@ -35,7 +35,7 @@ ResetBackgroundImage::ResetBackgroundImage(QUuid id, VAbstractPattern *doc, QUnd { setText(tr("reset background image transformation")); - VBackgroundPatternImage image = doc->GetBackgroundImage(m_id); + VBackgroundPatternImage const image = doc->GetBackgroundImage(m_id); m_oldMatrix = image.Matrix(); } diff --git a/src/libs/vtools/undocommands/image/rotatebackgroundimage.cpp b/src/libs/vtools/undocommands/image/rotatebackgroundimage.cpp index 588cac879..6de057092 100644 --- a/src/libs/vtools/undocommands/image/rotatebackgroundimage.cpp +++ b/src/libs/vtools/undocommands/image/rotatebackgroundimage.cpp @@ -38,7 +38,7 @@ RotateBackgroundImage::RotateBackgroundImage(QUuid id, const QTransform &matrix, { setText(tr("rotate background image")); - VBackgroundPatternImage image = doc->GetBackgroundImage(m_id); + VBackgroundPatternImage const image = doc->GetBackgroundImage(m_id); m_oldMatrix = image.Matrix(); } diff --git a/src/libs/vtools/undocommands/image/scalebackgroundimage.cpp b/src/libs/vtools/undocommands/image/scalebackgroundimage.cpp index 09ffb31e5..266e36b15 100644 --- a/src/libs/vtools/undocommands/image/scalebackgroundimage.cpp +++ b/src/libs/vtools/undocommands/image/scalebackgroundimage.cpp @@ -38,7 +38,7 @@ ScaleBackgroundImage::ScaleBackgroundImage(QUuid id, const QTransform &matrix, V { setText(tr("scale background image")); - VBackgroundPatternImage image = doc->GetBackgroundImage(m_id); + VBackgroundPatternImage const image = doc->GetBackgroundImage(m_id); m_oldMatrix = image.Matrix(); } diff --git a/src/libs/vtools/undocommands/image/zvaluemovebackgroundimage.cpp b/src/libs/vtools/undocommands/image/zvaluemovebackgroundimage.cpp index 821adf5cf..3a789594b 100644 --- a/src/libs/vtools/undocommands/image/zvaluemovebackgroundimage.cpp +++ b/src/libs/vtools/undocommands/image/zvaluemovebackgroundimage.cpp @@ -57,7 +57,7 @@ ZValueMoveBackgroundImage::ZValueMoveBackgroundImage(QUuid id, ZValueMoveType mo { setText(tr("z value move a background image")); - QVector images = doc->GetBackgroundImages(); + QVector const images = doc->GetBackgroundImages(); for (const auto &image: images) { @@ -147,7 +147,7 @@ void ZValueMoveBackgroundImage::redo() order.append({m_id}); } - QHash correctedZValues = CorrectedZValues(order); + QHash const correctedZValues = CorrectedZValues(order); for (auto &image: images) { image.SetZValue(correctedZValues.value(image.Id(), image.ZValue())); diff --git a/src/libs/vtools/undocommands/label/movelabel.cpp b/src/libs/vtools/undocommands/label/movelabel.cpp index db4567835..55bd6fc18 100644 --- a/src/libs/vtools/undocommands/label/movelabel.cpp +++ b/src/libs/vtools/undocommands/label/movelabel.cpp @@ -45,7 +45,7 @@ MoveLabel::MoveLabel(VAbstractPattern *doc, const QPointF &pos, const quint32 &i { setText(tr("move point label")); - QDomElement domElement = doc->elementById(nodeId, VAbstractPattern::TagPoint); + QDomElement const domElement = doc->elementById(nodeId, VAbstractPattern::TagPoint); if (domElement.isElement()) { m_oldPos.rx() = VAbstractValApplication::VApp()->toPixel(doc->GetParametrDouble(domElement, AttrMx, "0.0")); diff --git a/src/libs/vtools/undocommands/label/showlabel.cpp b/src/libs/vtools/undocommands/label/showlabel.cpp index a508b26b1..06edb7a68 100644 --- a/src/libs/vtools/undocommands/label/showlabel.cpp +++ b/src/libs/vtools/undocommands/label/showlabel.cpp @@ -46,7 +46,7 @@ ShowLabel::ShowLabel(VAbstractPattern *doc, quint32 id, bool visible, QUndoComma nodeId = id; - QDomElement domElement = doc->elementById(nodeId, VAbstractPattern::TagPoint); + QDomElement const domElement = doc->elementById(nodeId, VAbstractPattern::TagPoint); if (domElement.isElement()) { m_oldVisible = VDomDocument::GetParametrBool(domElement, AttrShowLabel, trueStr); diff --git a/src/libs/vtools/undocommands/movepiece.cpp b/src/libs/vtools/undocommands/movepiece.cpp index b1b010f37..aa9846f41 100644 --- a/src/libs/vtools/undocommands/movepiece.cpp +++ b/src/libs/vtools/undocommands/movepiece.cpp @@ -52,7 +52,7 @@ MovePiece::MovePiece(VAbstractPattern *doc, const double &x, const double &y, co nodeId = id; SCASSERT(scene != nullptr) - QDomElement domElement = doc->elementById(id, VAbstractPattern::TagDetail); + QDomElement const domElement = doc->elementById(id, VAbstractPattern::TagDetail); if (domElement.isElement()) { m_oldX = VAbstractValApplication::VApp()->toPixel(doc->GetParametrDouble(domElement, AttrMx, "0.0")); diff --git a/src/libs/vtools/undocommands/movespoint.cpp b/src/libs/vtools/undocommands/movespoint.cpp index bbf3663be..62da93ff4 100644 --- a/src/libs/vtools/undocommands/movespoint.cpp +++ b/src/libs/vtools/undocommands/movespoint.cpp @@ -49,7 +49,7 @@ MoveSPoint::MoveSPoint(VAbstractPattern *doc, const double &x, const double &y, qCDebug(vUndo, "SPoint newY %f", newY); SCASSERT(scene != nullptr) - QDomElement domElement = doc->elementById(id, VAbstractPattern::TagPoint); + QDomElement const domElement = doc->elementById(id, VAbstractPattern::TagPoint); if (domElement.isElement()) { oldX = VAbstractValApplication::VApp()->toPixel(doc->GetParametrDouble(domElement, AttrX, "0.0")); diff --git a/src/libs/vtools/undocommands/savetooloptions.cpp b/src/libs/vtools/undocommands/savetooloptions.cpp index ef23215ea..2b89fa843 100644 --- a/src/libs/vtools/undocommands/savetooloptions.cpp +++ b/src/libs/vtools/undocommands/savetooloptions.cpp @@ -53,7 +53,7 @@ void SaveToolOptions::undo() { qCDebug(vUndo, "Undo."); - QDomElement domElement = doc->elementById(nodeId); + QDomElement const domElement = doc->elementById(nodeId); if (domElement.isElement()) { domElement.parentNode().replaceChild(oldXml, domElement); @@ -74,7 +74,7 @@ void SaveToolOptions::redo() { qCDebug(vUndo, "Redo."); - QDomElement domElement = doc->elementById(nodeId); + QDomElement const domElement = doc->elementById(nodeId); if (domElement.isElement()) { domElement.parentNode().replaceChild(newXml, domElement); diff --git a/src/libs/vtools/undocommands/undogroup.cpp b/src/libs/vtools/undocommands/undogroup.cpp index c0e29fc89..357c4cd3d 100644 --- a/src/libs/vtools/undocommands/undogroup.cpp +++ b/src/libs/vtools/undocommands/undogroup.cpp @@ -224,8 +224,8 @@ void AddItemToGroup::performUndoRedo(bool isUndo) // set the item visible. Because if the undo is done when unvisible and it's not in any group after the // undo, it stays unvisible until the entire drawing is completly rerendered. - quint32 objectId = doc->GetParametrUInt(xml, QStringLiteral("object"), NULL_ID_STR); - quint32 toolId = doc->GetParametrUInt(xml, QStringLiteral("tool"), NULL_ID_STR); + quint32 const objectId = doc->GetParametrUInt(xml, QStringLiteral("object"), NULL_ID_STR); + quint32 const toolId = doc->GetParametrUInt(xml, QStringLiteral("tool"), NULL_ID_STR); VDataTool* tool = VAbstractPattern::getTool(toolId); tool->GroupVisibility(objectId,true); } @@ -242,7 +242,7 @@ void AddItemToGroup::performUndoRedo(bool isUndo) doc->SetModified(true); emit VAbstractValApplication::VApp()->getCurrentDocument()->patternChanged(false); - QDomElement groups = doc->CreateGroups(); + QDomElement const groups = doc->CreateGroups(); if (not groups.isNull()) { doc->ParseGroups(groups); @@ -318,8 +318,8 @@ void RemoveItemFromGroup::performUndoRedo(bool isUndo) // set the item visible. Because if the undo is done when unvisibile and it's not in any group after the // undo, it stays unvisible until the entire drawing is completly rerendered. - quint32 objectId = doc->GetParametrUInt(xml, QStringLiteral("object"), NULL_ID_STR); - quint32 toolId = doc->GetParametrUInt(xml, QStringLiteral("tool"), NULL_ID_STR); + quint32 const objectId = doc->GetParametrUInt(xml, QStringLiteral("object"), NULL_ID_STR); + quint32 const toolId = doc->GetParametrUInt(xml, QStringLiteral("tool"), NULL_ID_STR); VDataTool* tool = VAbstractPattern::getTool(toolId); tool->GroupVisibility(objectId,true); } @@ -327,7 +327,7 @@ void RemoveItemFromGroup::performUndoRedo(bool isUndo) doc->SetModified(true); emit VAbstractValApplication::VApp()->getCurrentDocument()->patternChanged(false); - QDomElement groups = doc->CreateGroups(); + QDomElement const groups = doc->CreateGroups(); if (not groups.isNull()) { doc->ParseGroups(groups); @@ -363,7 +363,7 @@ ChangeGroupVisibility::ChangeGroupVisibility(VAbstractPattern *doc, vidtype id, { setText(tr("change group visibility")); nodeId = id; - QDomElement group = doc->elementById(nodeId, VAbstractPattern::TagGroup); + QDomElement const group = doc->elementById(nodeId, VAbstractPattern::TagGroup); if (group.isElement()) { m_oldVisibility = doc->GetParametrBool(group, VAbstractPattern::AttrVisible, trueStr); @@ -400,7 +400,7 @@ void ChangeGroupVisibility::Do(bool visible) { doc->SetAttribute(group, VAbstractPattern::AttrVisible, visible); - QDomElement groups = doc->CreateGroups(); + QDomElement const groups = doc->CreateGroups(); if (not groups.isNull()) { doc->ParseGroups(groups); @@ -430,7 +430,7 @@ ChangeMultipleGroupsVisibility::ChangeMultipleGroupsVisibility(VAbstractPattern for(auto & groupId : m_groups) { - QDomElement group = doc->elementById(groupId, VAbstractPattern::TagGroup); + QDomElement const group = doc->elementById(groupId, VAbstractPattern::TagGroup); if (group.isElement()) { m_oldVisibility.insert(groupId, doc->GetParametrBool(group, VAbstractPattern::AttrVisible, trueStr)); @@ -470,7 +470,7 @@ void ChangeMultipleGroupsVisibility::undo() if (not groupsState.isEmpty()) { - QDomElement groups = doc->CreateGroups(); + QDomElement const groups = doc->CreateGroups(); if (not groups.isNull()) { doc->ParseGroups(groups); @@ -508,7 +508,7 @@ void ChangeMultipleGroupsVisibility::redo() if (not groupsState.isEmpty()) { - QDomElement groups = doc->CreateGroups(); + QDomElement const groups = doc->CreateGroups(); if (not groups.isNull()) { doc->ParseGroups(groups); diff --git a/src/libs/vtools/visualization/line/operation/vistoolmove.cpp b/src/libs/vtools/visualization/line/operation/vistoolmove.cpp index 43158af72..4f6fe5777 100644 --- a/src/libs/vtools/visualization/line/operation/vistoolmove.cpp +++ b/src/libs/vtools/visualization/line/operation/vistoolmove.cpp @@ -130,10 +130,10 @@ void VisToolMove::RefreshGeometry() rLine.setAngle(CorrectAngle(rLine.angle())); } - qreal cursorLength = rLine.length(); + qreal const cursorLength = rLine.length(); rLine.setP2(Ray(origin, rLine.angle())); // Radius of point circle, but little bigger. Need handle with hover sizes. - qreal minL = ScaledRadius(SceneScale(VAbstractValApplication::VApp()->getCurrentScene())) * 1.5; + qreal const minL = ScaledRadius(SceneScale(VAbstractValApplication::VApp()->getCurrentScene())) * 1.5; if (cursorLength > minL) { tempRoationAngle = rLine.angle(); @@ -152,8 +152,9 @@ void VisToolMove::RefreshGeometry() DrawLine(m_rotationLine, rLine, Qt::DashLine); DrawLine(m_xAxis, QLineF(origin, Ray(origin, 0)), Qt::DashLine); - VArc arc(VPointF(origin), ScaledRadius(SceneScale(VAbstractValApplication::VApp()->getCurrentScene())) * 2, 0, - tempRoationAngle); + VArc const arc(VPointF(origin), + ScaledRadius(SceneScale(VAbstractValApplication::VApp()->getCurrentScene())) * 2, 0, + tempRoationAngle); DrawPath(m_angleArc, arc.GetPath(), Qt::SolidLine, Qt::RoundCap); } DrawLine(this, line, Qt::DashLine); diff --git a/src/libs/vtools/visualization/line/operation/vistoolrotation.cpp b/src/libs/vtools/visualization/line/operation/vistoolrotation.cpp index 58bac8a04..6f91b4aad 100644 --- a/src/libs/vtools/visualization/line/operation/vistoolrotation.cpp +++ b/src/libs/vtools/visualization/line/operation/vistoolrotation.cpp @@ -103,8 +103,8 @@ void VisToolRotation::RefreshGeometry() DrawLine(this, rLine, Qt::DashLine); DrawLine(m_xAxis, QLineF(static_cast(*origin), Ray(static_cast(*origin), 0)), Qt::DashLine); - VArc arc(*origin, ScaledRadius(SceneScale(VAbstractValApplication::VApp()->getCurrentScene())) * 2, 0, - tempAngle); + VArc const arc(*origin, ScaledRadius(SceneScale(VAbstractValApplication::VApp()->getCurrentScene())) * 2, 0, + tempAngle); DrawPath(m_angleArc, arc.GetPath(), Qt::SolidLine, Qt::RoundCap); SetToolTip(tr("Rotating angle = %1°, %2 - sticking angle, " diff --git a/src/libs/vtools/visualization/line/visline.cpp b/src/libs/vtools/visualization/line/visline.cpp index 04d817f42..fc2dc31db 100644 --- a/src/libs/vtools/visualization/line/visline.cpp +++ b/src/libs/vtools/visualization/line/visline.cpp @@ -110,7 +110,7 @@ auto VisLine::Ray(const QPointF &firstPoint, const qreal &angle) const -> QPoint //--------------------------------------------------------------------------------------------------------------------- auto VisLine::Ray(const QPointF &firstPoint) const -> QPointF { - QLineF line = QLineF(firstPoint, ScenePos()); + QLineF const line = QLineF(firstPoint, ScenePos()); return Ray(firstPoint, line.angle()); } @@ -123,7 +123,7 @@ auto VisLine::Axis(const QPointF &p, const qreal &angle) const -> QLineF //--------------------------------------------------------------------------------------------------------------------- auto VisLine::Axis(const QPointF &p1, const QPointF &p2) const -> QLineF { - QLineF line(p1, p2); + QLineF const line(p1, p2); return Axis(p1, line.angle()); } diff --git a/src/libs/vtools/visualization/line/vistoolalongline.cpp b/src/libs/vtools/visualization/line/vistoolalongline.cpp index 002f1580a..de24e3497 100644 --- a/src/libs/vtools/visualization/line/vistoolalongline.cpp +++ b/src/libs/vtools/visualization/line/vistoolalongline.cpp @@ -84,28 +84,29 @@ void VisToolAlongLine::RefreshGeometry() const QSharedPointer second = GetData()->GeometricObject(m_point2Id); DrawPoint(m_lineP2, static_cast(*second)); - QLineF baseLine(static_cast(*first), static_cast(*second)); + QLineF const baseLine(static_cast(*first), static_cast(*second)); DrawLine(m_line, baseLine); if (not qFuzzyIsNull(m_length)) { - QLineF mainLine = VGObject::BuildLine(static_cast(*first), m_length, m_line->line().angle()); + QLineF const mainLine = + VGObject::BuildLine(static_cast(*first), m_length, m_line->line().angle()); DrawLine(this, mainLine, LineStyle()); DrawPoint(m_point, mainLine.p2()); } else if (GetMode() == Mode::Creation) { - QLineF cursorLine(static_cast(*first), ScenePos()); + QLineF const cursorLine(static_cast(*first), ScenePos()); qreal len = cursorLine.length(); - qreal angleTo = baseLine.angleTo(cursorLine); + qreal const angleTo = baseLine.angleTo(cursorLine); if (angleTo > 90 && angleTo < 270) { len *= -1; } - QLineF mainLine = VGObject::BuildLine(static_cast(*first), len, m_line->line().angle()); + QLineF const mainLine = VGObject::BuildLine(static_cast(*first), len, m_line->line().angle()); DrawLine(this, mainLine, LineStyle()); DrawPoint(m_point, mainLine.p2()); diff --git a/src/libs/vtools/visualization/line/vistoolbisector.cpp b/src/libs/vtools/visualization/line/vistoolbisector.cpp index fb8198601..2941203cc 100644 --- a/src/libs/vtools/visualization/line/vistoolbisector.cpp +++ b/src/libs/vtools/visualization/line/vistoolbisector.cpp @@ -94,31 +94,31 @@ void VisToolBisector::RefreshGeometry() if (not qFuzzyIsNull(m_length)) { - qreal angle = VToolBisector::BisectorAngle( + qreal const angle = VToolBisector::BisectorAngle( static_cast(*first), static_cast(*second), static_cast(*third)); - QLineF mainLine = VGObject::BuildLine(static_cast(*second), m_length, angle); + QLineF const mainLine = VGObject::BuildLine(static_cast(*second), m_length, angle); DrawLine(this, mainLine, LineStyle()); DrawPoint(m_point, mainLine.p2()); } else if (GetMode() == Mode::Creation) { - QLineF cursorLine(static_cast(*second), ScenePos()); + QLineF const cursorLine(static_cast(*second), ScenePos()); QLineF baseLine(static_cast(*second), static_cast(*third)); - qreal angle = VToolBisector::BisectorAngle( + qreal const angle = VToolBisector::BisectorAngle( static_cast(*first), static_cast(*second), static_cast(*third)); baseLine.setAngle(angle); qreal len = cursorLine.length(); - qreal angleTo = baseLine.angleTo(cursorLine); + qreal const angleTo = baseLine.angleTo(cursorLine); if (angleTo > 90 && angleTo < 270) { len *= -1; } - QLineF mainLine = VGObject::BuildLine(static_cast(*second), len, angle); + QLineF const mainLine = VGObject::BuildLine(static_cast(*second), len, angle); DrawLine(this, mainLine, LineStyle()); @@ -132,10 +132,10 @@ void VisToolBisector::RefreshGeometry() } else { - qreal angle = VToolBisector::BisectorAngle( + qreal const angle = VToolBisector::BisectorAngle( static_cast(*first), static_cast(*second), static_cast(*third)); - QPointF endRay = Ray(static_cast(*second), angle); - QLineF mainLine = VGObject::BuildLine( + QPointF const endRay = Ray(static_cast(*second), angle); + QLineF const mainLine = VGObject::BuildLine( static_cast(*second), QLineF(static_cast(*second), endRay).length(), angle); DrawLine(this, mainLine, LineStyle()); } diff --git a/src/libs/vtools/visualization/line/vistoolcurveintersectaxis.cpp b/src/libs/vtools/visualization/line/vistoolcurveintersectaxis.cpp index c8b4a71bf..f0259e643 100644 --- a/src/libs/vtools/visualization/line/vistoolcurveintersectaxis.cpp +++ b/src/libs/vtools/visualization/line/vistoolcurveintersectaxis.cpp @@ -81,7 +81,7 @@ void VisToolCurveIntersectAxis::RefreshGeometry() QPointF p; VToolCurveIntersectAxis::FindPoint(static_cast(*first), axis.angle(), curve->GetPoints(), &p); - QLineF axis_line(static_cast(*first), p); + QLineF const axis_line(static_cast(*first), p); DrawLine(this, axis_line, LineStyle()); DrawPoint(m_point, p); diff --git a/src/libs/vtools/visualization/line/vistoolheight.cpp b/src/libs/vtools/visualization/line/vistoolheight.cpp index 9053fb76e..e1c13760b 100644 --- a/src/libs/vtools/visualization/line/vistoolheight.cpp +++ b/src/libs/vtools/visualization/line/vistoolheight.cpp @@ -87,10 +87,10 @@ void VisToolHeight::RefreshGeometry() DrawLine(m_line, base_line); - QPointF height = VToolHeight::FindPoint(base_line, static_cast(*first)); + QPointF const height = VToolHeight::FindPoint(base_line, static_cast(*first)); DrawPoint(m_point, height); - QLineF height_line(static_cast(*first), height); + QLineF const height_line(static_cast(*first), height); DrawLine(this, height_line, LineStyle()); ShowIntersection(height_line, base_line); @@ -109,7 +109,7 @@ void VisToolHeight::VisualMode(quint32 id) void VisToolHeight::ShowIntersection(const QLineF &height_line, const QLineF &base_line) { QPointF p; - QLineF::IntersectType intersect = height_line.intersects(base_line, &p); + QLineF::IntersectType const intersect = height_line.intersects(base_line, &p); if (intersect == QLineF::UnboundedIntersection) { diff --git a/src/libs/vtools/visualization/line/vistoollineintersect.cpp b/src/libs/vtools/visualization/line/vistoollineintersect.cpp index 9998234b9..7c694f51d 100644 --- a/src/libs/vtools/visualization/line/vistoollineintersect.cpp +++ b/src/libs/vtools/visualization/line/vistoollineintersect.cpp @@ -85,10 +85,10 @@ void VisToolLineIntersect::RefreshGeometry() { DrawLine(this, QLineF(static_cast(*third), ScenePos())); - QLineF l1(static_cast(*first), static_cast(*second)); - QLineF l2(static_cast(*third), ScenePos()); + QLineF const l1(static_cast(*first), static_cast(*second)); + QLineF const l2(static_cast(*third), ScenePos()); QPointF fPoint; - QLineF::IntersectType intersect = l1.intersects(l2, &fPoint); + QLineF::IntersectType const intersect = l1.intersects(l2, &fPoint); if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection) { @@ -102,10 +102,10 @@ void VisToolLineIntersect::RefreshGeometry() DrawLine(this, QLineF(static_cast(*third), static_cast(*forth))); - QLineF l1(static_cast(*first), static_cast(*second)); - QLineF l2(static_cast(*third), static_cast(*forth)); + QLineF const l1(static_cast(*first), static_cast(*second)); + QLineF const l2(static_cast(*third), static_cast(*forth)); QPointF fPoint; - QLineF::IntersectType intersect = l1.intersects(l2, &fPoint); + QLineF::IntersectType const intersect = l1.intersects(l2, &fPoint); if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection) { diff --git a/src/libs/vtools/visualization/line/vistoollineintersectaxis.cpp b/src/libs/vtools/visualization/line/vistoollineintersectaxis.cpp index d4c8c88e2..721694302 100644 --- a/src/libs/vtools/visualization/line/vistoollineintersectaxis.cpp +++ b/src/libs/vtools/visualization/line/vistoollineintersectaxis.cpp @@ -99,7 +99,7 @@ void VisToolLineIntersectAxis::RefreshGeometry() QPointF p; VToolLineIntersectAxis::FindPoint(axis, base_line, &p); - QLineF axis_line(static_cast(*third), p); + QLineF const axis_line(static_cast(*third), p); if (not axis_line.isNull()) { DrawLine(this, axis_line, LineStyle()); @@ -143,7 +143,7 @@ void VisToolLineIntersectAxis::SetAngle(const QString &expression) void VisToolLineIntersectAxis::ShowIntersection(const QLineF &axis_line, const QLineF &base_line) { QPointF p; - QLineF::IntersectType intersect = axis_line.intersects(base_line, &p); + QLineF::IntersectType const intersect = axis_line.intersects(base_line, &p); if (intersect == QLineF::UnboundedIntersection) { diff --git a/src/libs/vtools/visualization/line/vistoolnormal.cpp b/src/libs/vtools/visualization/line/vistoolnormal.cpp index b85b96b86..bc20a6df8 100644 --- a/src/libs/vtools/visualization/line/vistoolnormal.cpp +++ b/src/libs/vtools/visualization/line/vistoolnormal.cpp @@ -63,11 +63,11 @@ void VisToolNormal::RefreshGeometry() if (m_object2Id <= NULL_ID) { - QLineF line_mouse(static_cast(*first), ScenePos()); + QLineF const line_mouse(static_cast(*first), ScenePos()); DrawLine(m_line, line_mouse); - QLineF normal = line_mouse.normalVector(); - QPointF endRay = Ray(normal.p1(), normal.angle()); + QLineF const normal = line_mouse.normalVector(); + QPointF const endRay = Ray(normal.p1(), normal.angle()); DrawLine(this, QLineF(normal.p1(), endRay)); } else @@ -75,33 +75,33 @@ void VisToolNormal::RefreshGeometry() const QSharedPointer second = GetData()->GeometricObject(m_object2Id); DrawPoint(m_lineP2, static_cast(*second)); - QLineF line_mouse(static_cast(*first), static_cast(*second)); + QLineF const line_mouse(static_cast(*first), static_cast(*second)); DrawLine(m_line, line_mouse); if (not qFuzzyIsNull(m_length)) { - QPointF fPoint = VToolNormal::FindPoint(static_cast(*first), static_cast(*second), - m_length, m_angle); - QLineF mainLine = QLineF(static_cast(*first), fPoint); + QPointF const fPoint = VToolNormal::FindPoint(static_cast(*first), + static_cast(*second), m_length, m_angle); + QLineF const mainLine = QLineF(static_cast(*first), fPoint); DrawLine(this, mainLine, LineStyle()); DrawPoint(m_point, mainLine.p2()); } else if (GetMode() == Mode::Creation) { - QLineF cursorLine(static_cast(*first), ScenePos()); - QLineF normal = line_mouse.normalVector(); + QLineF const cursorLine(static_cast(*first), ScenePos()); + QLineF const normal = line_mouse.normalVector(); qreal len = cursorLine.length(); - qreal angleTo = normal.angleTo(cursorLine); + qreal const angleTo = normal.angleTo(cursorLine); if (angleTo > 90 && angleTo < 270) { len *= -1; } - QPointF fPoint = + QPointF const fPoint = VToolNormal::FindPoint(static_cast(*first), static_cast(*second), len, m_angle); - QLineF mainLine = QLineF(static_cast(*first), fPoint); + QLineF const mainLine = QLineF(static_cast(*first), fPoint); DrawLine(this, mainLine, LineStyle()); DrawPoint(m_point, mainLine.p2()); @@ -114,8 +114,8 @@ void VisToolNormal::RefreshGeometry() } else { - QLineF normal = line_mouse.normalVector(); - QPointF endRay = Ray(normal.p1(), normal.angle()); + QLineF const normal = line_mouse.normalVector(); + QPointF const endRay = Ray(normal.p1(), normal.angle()); DrawLine(this, QLineF(normal.p1(), endRay)); } } diff --git a/src/libs/vtools/visualization/line/vistoolpointfromcircleandtangent.cpp b/src/libs/vtools/visualization/line/vistoolpointfromcircleandtangent.cpp index 19cf8a2a0..414e30892 100644 --- a/src/libs/vtools/visualization/line/vistoolpointfromcircleandtangent.cpp +++ b/src/libs/vtools/visualization/line/vistoolpointfromcircleandtangent.cpp @@ -83,8 +83,8 @@ void VisToolPointFromCircleAndTangent::RefreshGeometry() } else if (GetMode() == Mode::Creation) { - QLineF cursorLine(static_cast(*center), ScenePos()); - qreal len = cursorLine.length(); + QLineF const cursorLine(static_cast(*center), ScenePos()); + qreal const len = cursorLine.length(); m_cPath->setRect(PointRect(len)); DrawPoint(m_cPath, static_cast(*center), Qt::DashLine); diff --git a/src/libs/vtools/visualization/line/vistoolpointofcontact.cpp b/src/libs/vtools/visualization/line/vistoolpointofcontact.cpp index aca05e87c..c68939dbb 100644 --- a/src/libs/vtools/visualization/line/vistoolpointofcontact.cpp +++ b/src/libs/vtools/visualization/line/vistoolpointofcontact.cpp @@ -92,8 +92,8 @@ void VisToolPointOfContact::RefreshGeometry() } else if (GetMode() == Mode::Creation) { - QLineF cursorLine(static_cast(*third), ScenePos()); - qreal radius = cursorLine.length(); + QLineF const cursorLine(static_cast(*third), ScenePos()); + qreal const radius = cursorLine.length(); QPointF fPoint; VToolPointOfContact::FindPoint(radius, static_cast(*third), static_cast(*first), diff --git a/src/libs/vtools/visualization/line/vistoolpointofintersection.cpp b/src/libs/vtools/visualization/line/vistoolpointofintersection.cpp index 5130d39f1..ca4c08e69 100644 --- a/src/libs/vtools/visualization/line/vistoolpointofintersection.cpp +++ b/src/libs/vtools/visualization/line/vistoolpointofintersection.cpp @@ -99,7 +99,7 @@ void VisToolPointOfIntersection::VisualMode(quint32 id) void VisToolPointOfIntersection::ShowIntersection(const QLineF &axis1, const QLineF &axis2) { QPointF p; - QLineF::IntersectType intersect = axis1.intersects(axis2, &p); + QLineF::IntersectType const intersect = axis1.intersects(axis2, &p); if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection) { diff --git a/src/libs/vtools/visualization/line/vistoolpointofintersectioncircles.cpp b/src/libs/vtools/visualization/line/vistoolpointofintersectioncircles.cpp index d76beee68..a36c54d7d 100644 --- a/src/libs/vtools/visualization/line/vistoolpointofintersectioncircles.cpp +++ b/src/libs/vtools/visualization/line/vistoolpointofintersectioncircles.cpp @@ -92,7 +92,7 @@ void VisToolPointOfIntersectionCircles::RefreshGeometry() } else if (GetMode() == Mode::Creation) { - QLineF radiusLine(static_cast(*second), ScenePos()); + QLineF const radiusLine(static_cast(*second), ScenePos()); const qreal length = radiusLine.length(); m_c2Path->setRect(PointRect(length)); @@ -114,7 +114,7 @@ void VisToolPointOfIntersectionCircles::RefreshGeometry() } else if (GetMode() == Mode::Creation && VAbstractValApplication::VApp()->Settings()->IsInteractiveTools()) { - QLineF radiusLine(static_cast(*first), ScenePos()); + QLineF const radiusLine(static_cast(*first), ScenePos()); const qreal length = radiusLine.length(); m_c1Path->setRect(PointRect(length)); diff --git a/src/libs/vtools/visualization/line/vistoolshoulderpoint.cpp b/src/libs/vtools/visualization/line/vistoolshoulderpoint.cpp index 682be1c37..e0b6a29f6 100644 --- a/src/libs/vtools/visualization/line/vistoolshoulderpoint.cpp +++ b/src/libs/vtools/visualization/line/vistoolshoulderpoint.cpp @@ -89,10 +89,10 @@ void VisToolShoulderPoint::RefreshGeometry() if (not qFuzzyIsNull(m_length)) { - QPointF fPoint = + QPointF const fPoint = VToolShoulderPoint::FindPoint(static_cast(*second), static_cast(*third), static_cast(*first), m_length); - QLineF mainLine = QLineF(static_cast(*second), fPoint); + QLineF const mainLine = QLineF(static_cast(*second), fPoint); DrawLine(this, mainLine, LineStyle()); DrawPoint(m_point, mainLine.p2()); @@ -100,12 +100,12 @@ void VisToolShoulderPoint::RefreshGeometry() } else if (GetMode() == Mode::Creation) { - QLineF cursorLine(static_cast(*first), ScenePos()); + QLineF const cursorLine(static_cast(*first), ScenePos()); - qreal len = cursorLine.length(); - QPointF fPoint = VToolShoulderPoint::FindPoint( + qreal const len = cursorLine.length(); + QPointF const fPoint = VToolShoulderPoint::FindPoint( static_cast(*second), static_cast(*third), static_cast(*first), len); - QLineF mainLine = QLineF(static_cast(*second), fPoint); + QLineF const mainLine = QLineF(static_cast(*second), fPoint); DrawLine(this, mainLine, LineStyle()); DrawPoint(m_point, mainLine.p2()); @@ -119,9 +119,9 @@ void VisToolShoulderPoint::RefreshGeometry() } else { - qreal angle = QLineF(static_cast(*second), static_cast(*third)).angle(); - QPointF endRay = Ray(static_cast(*second), angle); - QLineF mainLine = VGObject::BuildLine( + qreal const angle = QLineF(static_cast(*second), static_cast(*third)).angle(); + QPointF const endRay = Ray(static_cast(*second), angle); + QLineF const mainLine = VGObject::BuildLine( static_cast(*second), QLineF(static_cast(*second), endRay).length(), angle); DrawLine(this, mainLine, LineStyle()); } diff --git a/src/libs/vtools/visualization/line/vistooltriangle.cpp b/src/libs/vtools/visualization/line/vistooltriangle.cpp index 1f86ecfc3..98cb0d76e 100644 --- a/src/libs/vtools/visualization/line/vistooltriangle.cpp +++ b/src/libs/vtools/visualization/line/vistooltriangle.cpp @@ -137,8 +137,8 @@ void VisToolTriangle::DrawAimedAxis(VCurvePathItem *item, const QLineF &line, Qt path.moveTo(line.p1()); path.lineTo(line.p2()); - qreal arrow_step = 60; - qreal arrow_size = 10; + qreal const arrow_step = 60; + qreal const arrow_size = 10; if (line.length() < arrow_step) { @@ -150,7 +150,7 @@ void VisToolTriangle::DrawAimedAxis(VCurvePathItem *item, const QLineF &line, Qt axis.setAngle(line.angle()); axis.setLength(arrow_step); - int steps = qFloor(line.length() / arrow_step); + int const steps = qFloor(line.length() / arrow_step); for (int i = 0; i < steps; ++i) { DrawArrow(axis, path, arrow_size); diff --git a/src/libs/vtools/visualization/path/vistoolarc.cpp b/src/libs/vtools/visualization/path/vistoolarc.cpp index f0023f8ec..92dd18d00 100644 --- a/src/libs/vtools/visualization/path/vistoolarc.cpp +++ b/src/libs/vtools/visualization/path/vistoolarc.cpp @@ -65,7 +65,7 @@ void VisToolArc::RefreshGeometry() if (GetMode() == Mode::Creation) { - QLineF r = QLineF(static_cast(*first), ScenePos()); + QLineF const r = QLineF(static_cast(*first), ScenePos()); auto Angle = [r]() { @@ -94,7 +94,7 @@ void VisToolArc::RefreshGeometry() } else if (m_f1 < 0) { - qreal f1Angle = Angle(); + qreal const f1Angle = Angle(); VArc arc = VArc(*first, m_radius, f1Angle, f1Angle); arc.SetApproximationScale(ApproximationScale()); DrawPath(this, arc.GetPath(), QVector(), Qt::DashLine, Qt::RoundCap); @@ -114,7 +114,7 @@ void VisToolArc::RefreshGeometry() } else if (m_f1 >= 0) { - qreal f2Angle = StickyEnd(Angle()); + qreal const f2Angle = StickyEnd(Angle()); VArc arc = VArc(*first, m_radius, m_f1, f2Angle); 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 6deaeadf8..65aaedbc6 100644 --- a/src/libs/vtools/visualization/path/vistoolarcwithlength.cpp +++ b/src/libs/vtools/visualization/path/vistoolarcwithlength.cpp @@ -63,7 +63,7 @@ void VisToolArcWithLength::RefreshGeometry() if (GetMode() == Mode::Creation) { - QLineF r = QLineF(static_cast(*first), ScenePos()); + QLineF const r = QLineF(static_cast(*first), ScenePos()); auto Angle = [r]() { @@ -92,7 +92,7 @@ void VisToolArcWithLength::RefreshGeometry() } else if (m_f1 < 0) { - qreal f1Angle = Angle(); + qreal const f1Angle = Angle(); VArc arc = VArc(*first, m_radius, f1Angle, f1Angle); arc.SetApproximationScale(ApproximationScale()); DrawPath(this, arc.GetPath(), QVector(), Qt::DashLine, Qt::RoundCap); diff --git a/src/libs/vtools/visualization/path/vistoolcubicbezierpath.cpp b/src/libs/vtools/visualization/path/vistoolcubicbezierpath.cpp index a9a6961fd..883e03c2e 100644 --- a/src/libs/vtools/visualization/path/vistoolcubicbezierpath.cpp +++ b/src/libs/vtools/visualization/path/vistoolcubicbezierpath.cpp @@ -189,12 +189,12 @@ void VisToolCubicBezierPath::Creating(const QVector &pathPoints, vsizet if (pathPoints.size() >= 4) { QLineF p1p2(static_cast(p1), ScenePos()); - QLineF prP3p1(static_cast(pathPoints.at(size - 2)), static_cast(p1)); + QLineF const prP3p1(static_cast(pathPoints.at(size - 2)), static_cast(p1)); p1p2.setAngle(prP3p1.angle()); const QPointF p2 = p1p2.p2(); - VSpline spline(p1, p2, ScenePos(), VPointF(ScenePos())); + VSpline const spline(p1, p2, ScenePos(), VPointF(ScenePos())); DrawPath(newCurveSegment, spline.GetPath(), Qt::SolidLine, Qt::RoundCap); DrawLine(helpLine1, p1p2, Qt::DashLine); @@ -218,15 +218,15 @@ void VisToolCubicBezierPath::Creating(const QVector &pathPoints, vsizet if (subSplCount >= 1) { QLineF p1p2(static_cast(p1), p2); - QLineF prP3p1(static_cast(pathPoints.at(subSplPoints + pointsLeft - 2)), - static_cast(p1)); + QLineF const prP3p1(static_cast(pathPoints.at(subSplPoints + pointsLeft - 2)), + static_cast(p1)); p1p2.setAngle(prP3p1.angle()); p2 = p1p2.p2(); } DrawLine(helpLine1, QLineF(static_cast(p1), p2), Qt::DashLine); - VSpline spline(p1, p2, ScenePos(), VPointF(ScenePos())); + VSpline const spline(p1, p2, ScenePos(), VPointF(ScenePos())); DrawPath(newCurveSegment, spline.GetPath(), Qt::SolidLine, Qt::RoundCap); const vsizetype preLastPoint = subSplCount * 2; @@ -244,8 +244,8 @@ void VisToolCubicBezierPath::Creating(const QVector &pathPoints, vsizet if (subSplCount >= 1) { QLineF p1p2(static_cast(p1), p2); - QLineF prP3p1(static_cast(pathPoints.at(subSplPoints + pointsLeft - 3)), - static_cast(p1)); + QLineF const prP3p1(static_cast(pathPoints.at(subSplPoints + pointsLeft - 3)), + static_cast(p1)); p1p2.setAngle(prP3p1.angle()); p2 = p1p2.p2(); } @@ -253,7 +253,7 @@ void VisToolCubicBezierPath::Creating(const QVector &pathPoints, vsizet DrawLine(helpLine1, QLineF(static_cast(p1), p2), Qt::DashLine); DrawLine(helpLine2, QLineF(p3, ScenePos()), Qt::DashLine); - VSpline spline(p1, p2, p3, VPointF(ScenePos())); + VSpline const spline(p1, p2, p3, VPointF(ScenePos())); DrawPath(newCurveSegment, spline.GetPath(), Qt::SolidLine, Qt::RoundCap); const vsizetype preLastPoint = subSplCount * 2; diff --git a/src/libs/vtools/visualization/path/vistoolcutarc.cpp b/src/libs/vtools/visualization/path/vistoolcutarc.cpp index b42efa2e5..29892d336 100644 --- a/src/libs/vtools/visualization/path/vistoolcutarc.cpp +++ b/src/libs/vtools/visualization/path/vistoolcutarc.cpp @@ -72,7 +72,7 @@ void VisToolCutArc::RefreshGeometry() { VArc ar1; VArc ar2; - QPointF p = arc->CutArc(m_length, ar1, ar2, QString()); + QPointF const p = arc->CutArc(m_length, ar1, ar2, QString()); DrawPoint(m_point, p); DrawPath(m_arc1, ar1.GetPath(), ar1.DirectionArrows(), LineStyle(), Qt::RoundCap); @@ -80,7 +80,7 @@ void VisToolCutArc::RefreshGeometry() } else if (GetMode() == Mode::Creation) { - QPointF p = arc->ClosestPoint(ScenePos()); + QPointF const p = arc->ClosestPoint(ScenePos()); qreal length = arc->GetLengthByPoint(p); length = !arc->IsFlipped() ? qBound(0.0, length, arc->GetLength()) : qBound(arc->GetLength(), -length, 0.0); diff --git a/src/libs/vtools/visualization/path/vistoolcutspline.cpp b/src/libs/vtools/visualization/path/vistoolcutspline.cpp index 159e81e9c..6f05f6f52 100644 --- a/src/libs/vtools/visualization/path/vistoolcutspline.cpp +++ b/src/libs/vtools/visualization/path/vistoolcutspline.cpp @@ -89,8 +89,8 @@ void VisToolCutSpline::RefreshGeometry() } else if (GetMode() == Mode::Creation) { - QPointF p = spl->ClosestPoint(ScenePos()); - qreal length = spl->GetLengthByPoint(p); + QPointF const p = spl->ClosestPoint(ScenePos()); + qreal const length = spl->GetLengthByPoint(p); DrawPoint(m_point, p); diff --git a/src/libs/vtools/visualization/path/vistoolcutsplinepath.cpp b/src/libs/vtools/visualization/path/vistoolcutsplinepath.cpp index 5b94b10f8..3b4c2b95c 100644 --- a/src/libs/vtools/visualization/path/vistoolcutsplinepath.cpp +++ b/src/libs/vtools/visualization/path/vistoolcutsplinepath.cpp @@ -88,8 +88,8 @@ void VisToolCutSplinePath::RefreshGeometry() } else if (GetMode() == Mode::Creation) { - QPointF p = splPath->ClosestPoint(ScenePos()); - qreal length = splPath->GetLengthByPoint(p); + QPointF const p = splPath->ClosestPoint(ScenePos()); + qreal const length = splPath->GetLengthByPoint(p); DrawPoint(m_point, p); diff --git a/src/libs/vtools/visualization/path/vistoolellipticalarc.cpp b/src/libs/vtools/visualization/path/vistoolellipticalarc.cpp index 007bb894e..d9129c952 100644 --- a/src/libs/vtools/visualization/path/vistoolellipticalarc.cpp +++ b/src/libs/vtools/visualization/path/vistoolellipticalarc.cpp @@ -92,8 +92,8 @@ void VisToolEllipticalArc::RefreshGeometry() { DrawRadius2Line(center, m_radius1); - QLineF radius2Line(center.x(), center.y(), center.x(), center.y() - 100); - QPointF p = VGObject::ClosestPoint(radius2Line, ScenePos()); + QLineF const radius2Line(center.x(), center.y(), center.x(), center.y() - 100); + QPointF const p = VGObject::ClosestPoint(radius2Line, ScenePos()); radius = QLineF(static_cast(*first), p); DrawRadius2Line(center, radius.length()); @@ -111,8 +111,8 @@ void VisToolEllipticalArc::RefreshGeometry() DrawRadius1Line(center, m_radius1); DrawRadius2Line(center, m_radius2); - qreal f1Angle = Angle(radius); - VEllipticalArc elArc = DrawElArc(*first, m_radius1, m_radius2, f1Angle, f1Angle); + qreal const f1Angle = Angle(radius); + VEllipticalArc const elArc = DrawElArc(*first, m_radius1, m_radius2, f1Angle, f1Angle); DrawPoint(m_f1Point, elArc.GetP1()); @@ -130,7 +130,7 @@ void VisToolEllipticalArc::RefreshGeometry() DrawRadius2Line(center, m_radius2); const qreal f2Angle = Angle(radius); - VEllipticalArc elArc = DrawElArc(*first, m_radius1, m_radius2, m_f1, f2Angle); + VEllipticalArc const elArc = DrawElArc(*first, m_radius1, m_radius2, m_f1, f2Angle); DrawPoint(m_f1Point, elArc.GetP1()); @@ -149,11 +149,11 @@ void VisToolEllipticalArc::RefreshGeometry() m_startingRotationAngle = radius.angle(); } - qreal rotationAngle = Angle(radius) - m_startingRotationAngle; + qreal const rotationAngle = Angle(radius) - m_startingRotationAngle; DrawRadius1Line(center, m_radius1, rotationAngle); DrawRadius2Line(center, m_radius2, rotationAngle); - VEllipticalArc elArc = DrawElArc(*first, m_radius1, m_radius2, m_f1, m_f2, rotationAngle); + VEllipticalArc const elArc = DrawElArc(*first, m_radius1, m_radius2, m_f1, m_f2, rotationAngle); DrawPoint(m_f1Point, elArc.GetP1()); diff --git a/src/libs/vtools/visualization/path/vistoolsplinepath.cpp b/src/libs/vtools/visualization/path/vistoolsplinepath.cpp index 2a3c86801..8cfc9df4e 100644 --- a/src/libs/vtools/visualization/path/vistoolsplinepath.cpp +++ b/src/libs/vtools/visualization/path/vistoolsplinepath.cpp @@ -94,7 +94,7 @@ void VisToolSplinePath::RefreshGeometry() const auto preLastPoint = (m_path.CountSubSpl() - 1) * 2; const auto lastPoint = preLastPoint + 1; - VSpline spl = m_path.GetSpline(i); + VSpline const spl = m_path.GetSpline(i); m_ctrlPoints.at(preLastPoint) ->RefreshCtrlPoint(i, SplinePointPosition::FirstPoint, static_cast(spl.GetP2()), @@ -233,7 +233,7 @@ void VisToolSplinePath::DragControlPoint(vsizetype lastPoint, vsizetype preLastP m_ctrlPoints.at(lastPoint)->RefreshCtrlPoint(size, SplinePointPosition::FirstPoint, m_ctrlPoint, pSpl); } - VSpline spline(VPointF(pSpl), m_ctrlPoint, ScenePos(), VPointF(ScenePos())); + VSpline const spline(VPointF(pSpl), m_ctrlPoint, ScenePos(), VPointF(ScenePos())); if (size == 1) { @@ -242,7 +242,7 @@ void VisToolSplinePath::DragControlPoint(vsizetype lastPoint, vsizetype preLastP else { const VSpline spl = m_path.GetSpline(size - 1); - VSpline preSpl(spl.GetP1(), static_cast(spl.GetP2()), ctrlLine.p2(), VPointF(pSpl)); + VSpline const preSpl(spl.GetP1(), static_cast(spl.GetP2()), ctrlLine.p2(), VPointF(pSpl)); m_path[size - 1].SetAngle2(spline.GetStartAngle(), spline.GetStartAngleFormula()); if (m_ctrlPoint != pSpl) @@ -300,7 +300,7 @@ void VisToolSplinePath::Creating(const QPointF &pSpl, vsizetype size) { m_pointSelected = true; - VSpline spline(VPointF(pSpl), m_ctrlPoint, ScenePos(), VPointF(ScenePos())); + VSpline const spline(VPointF(pSpl), m_ctrlPoint, ScenePos(), VPointF(ScenePos())); NewCurveSegment(spline, pSpl, size); DrawPath(m_newCurveSegment, spline.GetPath(), Qt::SolidLine, Qt::RoundCap); } diff --git a/src/libs/vtools/visualization/visualization.cpp b/src/libs/vtools/visualization/visualization.cpp index 29e46e4da..0961ebddc 100644 --- a/src/libs/vtools/visualization/visualization.cpp +++ b/src/libs/vtools/visualization/visualization.cpp @@ -161,7 +161,7 @@ auto Visualization::FindValFromUser(const QString &expression, formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator()); } - QScopedPointer cal(new Calculator()); + QScopedPointer const cal(new Calculator()); val = cal->EvalFormula(vars, formula); if (qIsInf(val) || qIsNaN(val)) diff --git a/src/libs/vwidgets/fancytabbar/fancytabbar.cpp b/src/libs/vwidgets/fancytabbar/fancytabbar.cpp index 49837ff9f..00d75f4b1 100644 --- a/src/libs/vwidgets/fancytabbar/fancytabbar.cpp +++ b/src/libs/vwidgets/fancytabbar/fancytabbar.cpp @@ -79,13 +79,13 @@ auto FancyTabBar::TabSizeHint(bool minimum) const -> QSize QFont boldFont(font()); boldFont.setPointSizeF(StyleHelper::sidebarFontSize()); boldFont.setBold(true); - QFontMetrics fm(boldFont); - int spacing = 8; + QFontMetrics const fm(boldFont); + int const spacing = 8; int maxLabelwidth = 0; for (int tab = 0; tab < Count(); ++tab) { - QString tabText = TabText(tab).simplified(); + QString const tabText = TabText(tab).simplified(); const QStringList words = tabText.split(' '_L1); if (words.size() > 1) @@ -112,8 +112,8 @@ auto FancyTabBar::TabSizeHint(bool minimum) const -> QSize } } } - int width = 60 + spacing + 2; - int iconHeight = minimum ? 0 : 32; + int const width = 60 + spacing + 2; + int const iconHeight = minimum ? 0 : 32; return QSize(qMax(width, maxLabelwidth + 4), iconHeight + spacing + fm.height()); } @@ -252,7 +252,7 @@ void FancyTabBar::paintEvent(QPaintEvent *event) QPainter painter(this); // paint background - QRect rectangle = AdjustRect(rect(), 0, -1, 0, 0); + QRect const rectangle = AdjustRect(rect(), 0, -1, 0, 0); QLinearGradient lg; lg.setStart(GetCorner(rectangle, OutsideBeginning)); @@ -293,7 +293,7 @@ void FancyTabBar::mouseMoveEvent(QMouseEvent *e) int newHover = -1; for (int i = 0; i < Count(); ++i) { - QRect area = TabRect(i); + QRect const area = TabRect(i); if (area.contains(e->pos())) { newHover = i; @@ -326,7 +326,7 @@ auto FancyTabBar::event(QEvent *event) -> bool { if (ValidIndex(m_hoverIndex)) { - QString tt = TabToolTip(m_hoverIndex); + QString const tt = TabToolTip(m_hoverIndex); if (!tt.isEmpty()) { QToolTip::showText(static_cast(event)->globalPos(), tt, this); @@ -378,7 +378,7 @@ void FancyTabBar::SetOrientation(const FancyTabBar::TabBarPosition p) //--------------------------------------------------------------------------------------------------------------------- auto FancyTabBar::sizeHint() const -> QSize { - QSize sh = TabSizeHint(); + QSize const sh = TabSizeHint(); // return QSize(sh.width(), sh.height() * mAttachedTabs.count()); if (m_position == Above || m_position == Below) @@ -466,9 +466,9 @@ void FancyTabBar::PaintTab(QPainter *painter, int tabIndex) const } painter->save(); - QRect rect = TabRect(tabIndex); - bool selected = (tabIndex == m_currentIndex); - bool enabled = IsTabEnabled(tabIndex); + QRect const rect = TabRect(tabIndex); + bool const selected = (tabIndex == m_currentIndex); + bool const enabled = IsTabEnabled(tabIndex); if (selected) { @@ -509,7 +509,7 @@ void FancyTabBar::PaintTab(QPainter *painter, int tabIndex) const AdjustPoint(GetCorner(rect, InsideEnd), 0, -1)); } - QString tabText(this->TabText(tabIndex)); + QString const tabText(this->TabText(tabIndex)); QRect tabTextRect(rect); const bool drawIcon = rect.height() > 36; QRect tabIconRect(tabTextRect); @@ -536,7 +536,7 @@ void FancyTabBar::PaintTab(QPainter *painter, int tabIndex) const if (!selected && enabled) { painter->save(); - int fader = int(m_attachedTabs[tabIndex]->fader()); + int const fader = int(m_attachedTabs[tabIndex]->fader()); QLinearGradient grad(GetCorner(rect, OutsideBeginning), GetCorner(rect, InsideBeginning)); grad.setColorAt(0, Qt::transparent); @@ -567,7 +567,7 @@ void FancyTabBar::PaintTab(QPainter *painter, int tabIndex) const if (drawIcon) { - int textHeight = + int const textHeight = painter->fontMetrics().boundingRect(QRect(0, 0, width(), height()), Qt::TextWordWrap, tabText).height(); tabIconRect.adjust(0, 0, 0, -textHeight); StyleHelper::drawIconWithShadow(TabIcon(tabIndex), tabIconRect, painter, diff --git a/src/libs/vwidgets/fancytabbar/stylehelper.cpp b/src/libs/vwidgets/fancytabbar/stylehelper.cpp index 24d386f58..40964285e 100644 --- a/src/libs/vwidgets/fancytabbar/stylehelper.cpp +++ b/src/libs/vwidgets/fancytabbar/stylehelper.cpp @@ -119,7 +119,8 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect, QPain int dipRadius, const QColor &color, const QPoint &dipOffset) { QPixmap cache; - QString pixmapName = QString::fromLatin1("icon %0 %1 %2").arg(icon.cacheKey()).arg(iconMode).arg(rect.height()); + QString const pixmapName = + QString::fromLatin1("icon %0 %1 %2").arg(icon.cacheKey()).arg(iconMode).arg(rect.height()); if (!QPixmapCache::find(pixmapName, &cache)) { @@ -129,9 +130,9 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect, QPain // different than 1. The shadow drawing caluculations are done in device // pixels. QPixmap px = icon.pixmap(rect.size()); - int devicePixelRatio = qCeil(px.devicePixelRatio()); - int radius = dipRadius * devicePixelRatio; - QPoint offset = dipOffset * devicePixelRatio; + int const devicePixelRatio = qCeil(px.devicePixelRatio()); + int const radius = dipRadius * devicePixelRatio; + QPoint const offset = dipOffset * devicePixelRatio; cache = QPixmap(px.size() + QSize(radius * 2, radius * 2)); cache.fill(Qt::transparent); @@ -144,8 +145,8 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect, QPain QRgb *scanLine = reinterpret_cast(im.scanLine(y)); for (int x = 0; x < im.width(); ++x) { - QRgb pixel = *scanLine; - char intensity = static_cast(qGray(pixel)); + QRgb const pixel = *scanLine; + char const intensity = static_cast(qGray(pixel)); *scanLine = qRgba(intensity, intensity, intensity, qAlpha(pixel)); ++scanLine; } diff --git a/src/libs/vwidgets/global.cpp b/src/libs/vwidgets/global.cpp index f1bfbb694..09dc1feb1 100644 --- a/src/libs/vwidgets/global.cpp +++ b/src/libs/vwidgets/global.cpp @@ -132,7 +132,7 @@ auto PixmapToPainterPath(const QPixmap &pixmap) -> QPainterPath { if (not pixmap.isNull()) { - QBitmap mask = pixmap.mask(); + QBitmap const mask = pixmap.mask(); if (not mask.isNull()) { return qt_regionToPath(QRegion(mask)); diff --git a/src/libs/vwidgets/qtcolorpicker.cpp b/src/libs/vwidgets/qtcolorpicker.cpp index e1e4d920f..441e73035 100644 --- a/src/libs/vwidgets/qtcolorpicker.cpp +++ b/src/libs/vwidgets/qtcolorpicker.cpp @@ -347,14 +347,14 @@ void QtColorPicker::paintEvent(QPaintEvent *e) { if (dirty) { - int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize); + int const iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize); QPixmap pix(iconSize, iconSize); pix.fill(palette().button().color()); QPainter p(&pix); - int w = pix.width(); // width of cell in pixels - int h = pix.height(); // height of cell in pixels + int const w = pix.width(); // width of cell in pixels + int const h = pix.height(); // height of cell in pixels p.setPen(QPen(Qt::gray)); p.setBrush(col); p.drawRect(2, 2, w - 5, h - 5); @@ -427,7 +427,7 @@ auto QtColorPicker::CustomColors() const -> QVector QVector customColor; if (popup != nullptr) { - QVector items = popup->CustomItems(); + QVector const items = popup->CustomItems(); customColor.reserve(items.size()); for (auto *item : items) @@ -1002,7 +1002,7 @@ void ColorPickerPopup::regenerateGrid() */ void ColorPickerPopup::getColorFromDialog() { - QColor col = QColorDialog::getColor(lastSel, parentWidget()); + QColor const col = QColorDialog::getColor(lastSel, parentWidget()); if (!col.isValid()) { return; @@ -1116,8 +1116,8 @@ void ColorPickerItem::mousePressEvent(QMouseEvent *) void ColorPickerItem::paintEvent(QPaintEvent *) { QPainter p(this); - int w = width(); // width of cell in pixels - int h = height(); // height of cell in pixels + int const w = width(); // width of cell in pixels + int const h = height(); // height of cell in pixels p.setPen(QPen(Qt::gray, 0, Qt::SolidLine)); @@ -1247,11 +1247,11 @@ void ColorPickerButton::paintEvent(QPaintEvent *e) QPainter p(this); p.fillRect(contentsRect(), palette().button()); - QRect r = rect(); + QRect const r = rect(); - int offset = frameShadow() == Sunken ? 1 : 0; + int const offset = frameShadow() == Sunken ? 1 : 0; - QPen pen(palette().buttonText(), 1); + QPen const pen(palette().buttonText(), 1); p.setPen(pen); p.drawRect(r.center().x() + offset - 4, r.center().y() + offset, 1, 1); diff --git a/src/libs/vwidgets/vabstractmainwindow.cpp b/src/libs/vwidgets/vabstractmainwindow.cpp index fa4e7474a..458f87a32 100644 --- a/src/libs/vwidgets/vabstractmainwindow.cpp +++ b/src/libs/vwidgets/vabstractmainwindow.cpp @@ -67,7 +67,7 @@ namespace auto SelectNumber(QStringList path, int number) -> QStringList { path = Reverse(path); - QStringList subPath = path.mid(0, number); + QStringList const subPath = path.mid(0, number); return Reverse(subPath); } @@ -98,7 +98,7 @@ auto RecentFiles(const QStringList &paths) -> QStringList continue; } - QStringList testSubPath = SelectNumber(table.at(row), count); + QStringList const testSubPath = SelectNumber(table.at(row), count); if (optimized.join(QDir::separator()) == testSubPath.join(QDir::separator())) { isUnique = false; @@ -176,7 +176,7 @@ auto VAbstractMainWindow::ContinueFormatRewrite(const QString ¤tFormatVers msgBox.setDefaultButton(QDialogButtonBox::No); msgBox.setIconPixmap(QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion).pixmap(32, 32)); - int dialogResult = msgBox.exec(); + int const dialogResult = msgBox.exec(); if (dialogResult == QDialog::Accepted) { @@ -213,7 +213,7 @@ auto VAbstractMainWindow::CSVFilePath() -> QString return fileName; } - QFileInfo f(fileName); + QFileInfo const f(fileName); if (f.suffix().isEmpty() && f.suffix() != suffix) { fileName += '.'_L1 + suffix; @@ -257,7 +257,7 @@ void VAbstractMainWindow::UpdateRecentFileActions() //--------------------------------------------------------------------------------------------------------------------- auto VAbstractMainWindow::CheckFilePermissions(const QString &path, QWidget *messageBoxParent) -> bool { - QFileInfo info(path); + QFileInfo const info(path); // #ifdef Q_OS_WIN32 // qt_ntfs_permission_lookup++; // turn checking on @@ -288,7 +288,7 @@ auto VAbstractMainWindow::CheckFilePermissions(const QString &path, QWidget *mes // #ifdef Q_OS_WIN32 // qt_ntfs_permission_lookup++; // turn checking on // #endif /*Q_OS_WIN32*/ - bool changed = QFile::setPermissions(path, QFileInfo(path).permissions() | QFileDevice::WriteUser); + bool const changed = QFile::setPermissions(path, QFileInfo(path).permissions() | QFileDevice::WriteUser); // #ifdef Q_OS_WIN32 // qt_ntfs_permission_lookup--; // turn it off again // #endif /*Q_OS_WIN32*/ @@ -387,7 +387,7 @@ void VAbstractMainWindow::WindowsLocale() //--------------------------------------------------------------------------------------------------------------------- void VAbstractMainWindow::ExportDataToCSV() { - QString fileName = CSVFilePath(); + QString const fileName = CSVFilePath(); if (fileName.isEmpty()) { diff --git a/src/libs/vwidgets/vaspectratiopixmaplabel.cpp b/src/libs/vwidgets/vaspectratiopixmaplabel.cpp index 5718c23ff..6f7a56eec 100644 --- a/src/libs/vwidgets/vaspectratiopixmaplabel.cpp +++ b/src/libs/vwidgets/vaspectratiopixmaplabel.cpp @@ -69,7 +69,7 @@ auto VAspectRatioPixmapLabel::sizeHint() const -> QSize return QLabel::sizeHint(); } - int w = m_pix.width(); + int const w = m_pix.width(); return {w, heightForWidth(w)}; } diff --git a/src/libs/vwidgets/vcontrolpointspline.cpp b/src/libs/vwidgets/vcontrolpointspline.cpp index 08cf0ada6..69ad6b1fe 100644 --- a/src/libs/vwidgets/vcontrolpointspline.cpp +++ b/src/libs/vwidgets/vcontrolpointspline.cpp @@ -96,7 +96,7 @@ void VControlPointSpline::paint(QPainter *painter, const QStyleOptionGraphicsIte QPointF p1, p2; VGObject::LineIntersectCircle(QPointF(), ScaledRadius(SceneScale(scene())), QLineF(QPointF(), controlLine->line().p1()), p1, p2); - QLineF line(controlLine->line().p1(), p1); + QLineF const line(controlLine->line().p1(), p1); controlLine->setLine(line); VScenePoint::paint(painter, option, widget); @@ -134,7 +134,7 @@ auto VControlPointSpline::itemChange(QGraphicsItem::GraphicsItemChange change, c const QPointF splPoint = controlLine->line().p1() + pos(); QLineF newLine(splPoint, value.toPointF()); // value - new position. - QLineF oldLine(splPoint, pos()); // pos() - old position. + QLineF const oldLine(splPoint, pos()); // pos() - old position. if (not freeAngle) { @@ -242,12 +242,12 @@ void VControlPointSpline::Init() //--------------------------------------------------------------------------------------------------------------------- void VControlPointSpline::SetCtrlLine(const QPointF &controlPoint, const QPointF &splinePoint) { - QLineF circleLine(QPointF(), splinePoint - controlPoint); + QLineF const circleLine(QPointF(), splinePoint - controlPoint); const qreal radius = ScaledRadius(SceneScale(scene())); QPointF p1, p2; VGObject::LineIntersectCircle(QPointF(), radius, circleLine, p1, p2); - QLineF line(splinePoint - controlPoint, p1); + QLineF const line(splinePoint - controlPoint, p1); controlLine->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false); controlLine->setLine(line); controlLine->setVisible(not line.isNull()); diff --git a/src/libs/vwidgets/velidedlabel.cpp b/src/libs/vwidgets/velidedlabel.cpp index 48d8f7618..a152699d8 100644 --- a/src/libs/vwidgets/velidedlabel.cpp +++ b/src/libs/vwidgets/velidedlabel.cpp @@ -75,7 +75,7 @@ void VElidedLabel::paintEvent(QPaintEvent *event) int y = 0; // QTextLayout works with paragraphs - QStringList paragraphs = m_content.split('\n'); + QStringList const paragraphs = m_content.split('\n'); for (int i = 0; i < paragraphs.size(); ++i) { if (not DrawParagraph(painter, paragraphs.at(i), y, didElide)) @@ -122,9 +122,9 @@ void VElidedLabel::paintEvent(QPaintEvent *event) //--------------------------------------------------------------------------------------------------------------------- auto VElidedLabel::DrawParagraph(QPainter &painter, const QString ¶graph, int &y, bool &didElide) -> bool { - QFontMetrics fontMetrics = painter.fontMetrics(); + QFontMetrics const fontMetrics = painter.fontMetrics(); - int lineSpacing = fontMetrics.lineSpacing(); + int const lineSpacing = fontMetrics.lineSpacing(); bool ok = true; QTextLayout textLayout(paragraph, painter.font()); @@ -139,7 +139,7 @@ auto VElidedLabel::DrawParagraph(QPainter &painter, const QString ¶graph, in } line.setLineWidth(width()); - int nextLineY = y + lineSpacing; + int const nextLineY = y + lineSpacing; if (height() >= nextLineY + lineSpacing) { @@ -148,8 +148,8 @@ auto VElidedLabel::DrawParagraph(QPainter &painter, const QString ¶graph, in } else { - QString lastLine = paragraph.mid(line.textStart()); - QString elidedLastLine = fontMetrics.elidedText(lastLine, Qt::ElideRight, width()); + QString const lastLine = paragraph.mid(line.textStart()); + QString const elidedLastLine = fontMetrics.elidedText(lastLine, Qt::ElideRight, width()); painter.drawText(QPoint(0, y + fontMetrics.ascent()), elidedLastLine); y = nextLineY; ok = false; diff --git a/src/libs/vwidgets/vgrainlineitem.cpp b/src/libs/vwidgets/vgrainlineitem.cpp index c8b8c5bf4..de32bc7df 100644 --- a/src/libs/vwidgets/vgrainlineitem.cpp +++ b/src/libs/vwidgets/vgrainlineitem.cpp @@ -100,7 +100,7 @@ void VGrainlineItem::paint(QPainter *pP, const QStyleOptionGraphicsItem *pOption pP->setPen(QPen(clr, width, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); pP->setRenderHints(QPainter::Antialiasing); - VPieceGrainline grainline(QPointF(), m_dLength, m_dRotation, m_eArrowType); + VPieceGrainline const grainline(QPointF(), m_dLength, m_dRotation, m_eArrowType); // main line const QLineF mainLine = grainline.GetMainLine(); pP->drawLine(mainLine.p1(), mainLine.p2()); @@ -159,8 +159,8 @@ void VGrainlineItem::paint(QPainter *pP, const QStyleOptionGraphicsItem *pOption if (m_eMode == mRotate) { - QPointF ptC = (m_polyBound.at(0) + m_polyBound.at(2)) / 2; - qreal dRad = rotateCircR; + QPointF const ptC = (m_polyBound.at(0) + m_polyBound.at(2)) / 2; + qreal const dRad = rotateCircR; pP->setBrush(clr); pP->drawEllipse(ptC, dRad, dRad); @@ -168,9 +168,10 @@ void VGrainlineItem::paint(QPainter *pP, const QStyleOptionGraphicsItem *pOption pP->save(); pP->translate(ptC); pP->rotate(qRadiansToDegrees(-m_dRotation)); - int iX = qRound(m_dLength / 2 - 0.5 * dRad); - int iY = grainline.IsFourWays() ? qRound((m_dLength / 2) - 0.8 * dRad) : qRound(rectWidth - 0.5 * dRad); - int iR = qRound(dRad * 3); + int const iX = qRound(m_dLength / 2 - 0.5 * dRad); + int const iY = + grainline.IsFourWays() ? qRound((m_dLength / 2) - 0.8 * dRad) : qRound(rectWidth - 0.5 * dRad); + int const iR = qRound(dRad * 3); pP->drawArc(iX - iR, iY - iR, iR, iR, 0 * 16, -90 * 16); pP->drawArc(-iX, iY - iR, iR, iR, 270 * 16, -90 * 16); pP->drawArc(-iX, -iY, iR, iR, 180 * 16, -90 * 16); @@ -194,7 +195,7 @@ void VGrainlineItem::UpdateGeometry(const QPointF &ptPos, qreal dRotation, qreal m_dLength = dLength; m_eArrowType = eAT; - VPieceGrainline grainline(ptPos, m_dLength, m_dRotation, m_eArrowType); + VPieceGrainline const grainline(ptPos, m_dLength, m_dRotation, m_eArrowType); qreal dX; qreal dY; QPointF pt = ptPos; @@ -310,13 +311,13 @@ void VGrainlineItem::mousePressEvent(QGraphicsSceneMouseEvent *pME) */ void VGrainlineItem::mouseMoveEvent(QGraphicsSceneMouseEvent *pME) { - QPointF ptDiff = pME->scenePos() - m_ptStartMove; + QPointF const ptDiff = pME->scenePos() - m_ptStartMove; qreal dX; qreal dY; if (m_eMode == mMove && m_moveType & IsMovable) { QPointF pt = m_ptStartPos + ptDiff; - VPieceGrainline grainline(pt, m_dLength, m_dRotation, m_eArrowType); + VPieceGrainline const grainline(pt, m_dLength, m_dRotation, m_eArrowType); if (not grainline.IsContained(parentItem()->boundingRect(), dX, dY)) { pt.setX(pt.x() + dX); @@ -328,9 +329,9 @@ void VGrainlineItem::mouseMoveEvent(QGraphicsSceneMouseEvent *pME) else if (m_eMode == mResize && m_moveType & IsResizable) { qreal dLen = qSqrt(ptDiff.x() * ptDiff.x() + ptDiff.y() * ptDiff.y()); - qreal dAng = qAtan2(-ptDiff.y(), ptDiff.x()); + qreal const dAng = qAtan2(-ptDiff.y(), ptDiff.x()); dLen = -dLen * qCos(dAng - m_dRotation); - qreal dPrevLen = m_dLength; + qreal const dPrevLen = m_dLength; // try with new length if (not(m_moveType & IsMovable)) { @@ -367,7 +368,7 @@ void VGrainlineItem::mouseMoveEvent(QGraphicsSceneMouseEvent *pME) qreal dX; qreal dY; - VPieceGrainline grainline(pos, m_dLength, m_dRotation, m_eArrowType); + VPieceGrainline const grainline(pos, m_dLength, m_dRotation, m_eArrowType); if (not grainline.IsContained(parentItem()->boundingRect(), dX, dY)) { m_dLength = dPrevLen; @@ -383,7 +384,7 @@ void VGrainlineItem::mouseMoveEvent(QGraphicsSceneMouseEvent *pME) else if (m_eMode == mRotate && m_moveType & IsRotatable) { // prevent strange angle changes due to singularities - qreal dLen = qSqrt(ptDiff.x() * ptDiff.x() + ptDiff.y() * ptDiff.y()); + qreal const dLen = qSqrt(ptDiff.x() * ptDiff.x() + ptDiff.y() * ptDiff.y()); if (dLen < 2) { return; @@ -395,9 +396,9 @@ void VGrainlineItem::mouseMoveEvent(QGraphicsSceneMouseEvent *pME) return; } - qreal dAng = GetAngle(mapToParent(pME->pos())) - m_dAngle; - QPointF ptNewPos = Rotate(m_ptStartPos, m_ptRotCenter, dAng); - VPieceGrainline grainline(ptNewPos, m_dLength, m_dStartRotation + dAng, m_eArrowType); + qreal const dAng = GetAngle(mapToParent(pME->pos())) - m_dAngle; + QPointF const ptNewPos = Rotate(m_ptStartPos, m_ptRotCenter, dAng); + VPieceGrainline const grainline(ptNewPos, m_dLength, m_dStartRotation + dAng, m_eArrowType); if (grainline.IsContained(parentItem()->boundingRect(), dX, dY)) { setPos(ptNewPos); @@ -427,9 +428,9 @@ void VGrainlineItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *pME) SetItemOverrideCursor(this, cursorArrowOpenHand, 1, 1); } - QPointF ptDiff = pME->scenePos() - m_ptStartMove; - qreal dLen = qSqrt(ptDiff.x() * ptDiff.x() + ptDiff.y() * ptDiff.y()); - bool bShort = (dLen < 2); + QPointF const ptDiff = pME->scenePos() - m_ptStartMove; + qreal const dLen = qSqrt(ptDiff.x() * ptDiff.x() + ptDiff.y() * ptDiff.y()); + bool const bShort = (dLen < 2); if (m_eMode == mMove || m_eMode == mResize) { @@ -506,7 +507,7 @@ void VGrainlineItem::Update() */ void VGrainlineItem::UpdateRectangle() { - VPieceGrainline grainline(QPointF(), m_dLength, m_dRotation, m_eArrowType); + VPieceGrainline const grainline(QPointF(), m_dLength, m_dRotation, m_eArrowType); const QLineF mainLine = grainline.GetMainLine(); m_ptStart = mapToParent(mainLine.p1()); @@ -565,7 +566,7 @@ auto VGrainlineItem::GetAngle(const QPointF &pt) const -> double */ auto VGrainlineItem::Rotate(const QPointF &pt, const QPointF &ptCenter, qreal dAng) -> QPointF { - QPointF ptRel = pt - ptCenter; + QPointF const ptRel = pt - ptCenter; QPointF ptFinal; ptFinal.setX(ptRel.x() * qCos(dAng) + ptRel.y() * qSin(dAng)); ptFinal.setY(-ptRel.x() * qSin(dAng) + ptRel.y() * qCos(dAng)); @@ -595,7 +596,7 @@ auto VGrainlineItem::GetInsideCorner(int i, qreal dDist) const -> QPointF //--------------------------------------------------------------------------------------------------------------------- auto VGrainlineItem::MainShape() const -> QPainterPath { - VPieceGrainline grainline(QPointF(), m_dLength, m_dRotation, m_eArrowType); + VPieceGrainline const grainline(QPointF(), m_dLength, m_dRotation, m_eArrowType); const QLineF mainLine = grainline.GetMainLine(); QPainterPath linePath; linePath.moveTo(mainLine.p1()); diff --git a/src/libs/vwidgets/vlineedit.cpp b/src/libs/vwidgets/vlineedit.cpp index 504b2d626..838363bc2 100644 --- a/src/libs/vwidgets/vlineedit.cpp +++ b/src/libs/vwidgets/vlineedit.cpp @@ -72,9 +72,9 @@ auto MultiSelectCompleter::pathFromIndex(const QModelIndex &index) const -> QStr { QString path = QCompleter::pathFromIndex(index); - QString text = static_cast(widget())->text(); + QString const text = static_cast(widget())->text(); - vsizetype pos = text.lastIndexOf(','); + vsizetype const pos = text.lastIndexOf(','); if (pos >= 0) { path = text.left(pos) + ", " + path; diff --git a/src/libs/vwidgets/vmaingraphicsscene.cpp b/src/libs/vwidgets/vmaingraphicsscene.cpp index d62915884..1fe73d47a 100644 --- a/src/libs/vwidgets/vmaingraphicsscene.cpp +++ b/src/libs/vwidgets/vmaingraphicsscene.cpp @@ -153,8 +153,8 @@ void VMainGraphicsScene::InitOrigins() { origins.clear(); - QPen originsPen(Qt::green, MmToPixel(1.2 / 3.0), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); - QBrush axisTextBrush(Qt::green); + QPen const originsPen(Qt::green, MmToPixel(1.2 / 3.0), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); + QBrush const axisTextBrush(Qt::green); const qreal arrowAngle = 35.0; const qreal arrowLength = 12.0; diff --git a/src/libs/vwidgets/vmaingraphicsview.cpp b/src/libs/vwidgets/vmaingraphicsview.cpp index 4924a2851..efe3b40bc 100644 --- a/src/libs/vwidgets/vmaingraphicsview.cpp +++ b/src/libs/vwidgets/vmaingraphicsview.cpp @@ -169,9 +169,9 @@ void GraphicsViewZoom::gentle_zoom(double factor) FictiveSceneRect(_view->scene(), _view); } _view->centerOn(target_scene_pos); - QPointF delta_viewport_pos = + QPointF const delta_viewport_pos = target_viewport_pos - QPointF(_view->viewport()->width() / 2.0, _view->viewport()->height() / 2.0); - QPointF viewport_center = _view->mapFromScene(target_scene_pos) - delta_viewport_pos; + QPointF const viewport_center = _view->mapFromScene(target_scene_pos) - delta_viewport_pos; _view->centerOn(_view->mapToScene(viewport_center.toPoint())); // In the end we just set correct scene size VMainGraphicsView::NewSceneRect(_view->scene(), _view); @@ -270,7 +270,7 @@ auto GraphicsViewZoom::eventFilter(QObject *object, QEvent *event) -> bool */ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) auto *mouse_event = static_cast(event); - QPointF delta = target_viewport_pos - mouse_event->pos(); + QPointF const delta = target_viewport_pos - mouse_event->pos(); if (qAbs(delta.x()) > 5 || qAbs(delta.y()) > 5) { target_viewport_pos = mouse_event->pos(); @@ -404,10 +404,10 @@ auto GraphicsViewZoom::GestureEvent(QGestureEvent *event) -> bool //--------------------------------------------------------------------------------------------------------------------- void GraphicsViewZoom::PinchTriggered(QPinchGesture *gesture) { - QPinchGesture::ChangeFlags changeFlags = gesture->changeFlags(); + QPinchGesture::ChangeFlags const changeFlags = gesture->changeFlags(); if (changeFlags & QPinchGesture::ScaleFactorChanged) { - qreal currentStepScaleFactor = gesture->lastScaleFactor(); + qreal const currentStepScaleFactor = gesture->lastScaleFactor(); gentle_zoom(currentStepScaleFactor); } } @@ -449,7 +449,7 @@ VMainGraphicsView::VMainGraphicsView(QWidget *parent) //--------------------------------------------------------------------------------------------------------------------- void VMainGraphicsView::Zoom(qreal scale) { - qreal factor = qBound(MinScale(), scale, MaxScale()); + qreal const factor = qBound(MinScale(), scale, MaxScale()); QTransform transform = this->transform(); transform.setMatrix(factor, transform.m12(), transform.m13(), transform.m21(), factor, transform.m23(), transform.m31(), transform.m32(), transform.m33()); @@ -590,7 +590,7 @@ void VMainGraphicsView::mouseMoveEvent(QMouseEvent *event) // Because no real way to catch this call we will check state for each move and compare to excpected state. if (dragMode() != QGraphicsView::ScrollHandDrag) { - QCursor cur = viewport()->cursor(); + QCursor const cur = viewport()->cursor(); // No way to restore bitmap from shape and we really don't need this for now. if (m_currentCursor != Qt::BitmapCursor && cur.shape() == Qt::BitmapCursor && cur.pixmap().cacheKey() != QPixmapFromCache(cursorArrowOpenHand).cacheKey() && @@ -653,11 +653,11 @@ void VMainGraphicsView::dragEnterEvent(QDragEnterEvent *event) auto *currentScene = qobject_cast(scene()); if (currentScene != nullptr && currentScene->AcceptDrop() && mime != nullptr && mime->hasText()) { - QUrl urlPath(mime->text().simplified()); + QUrl const urlPath(mime->text().simplified()); if (urlPath.isLocalFile()) { const QString fileName = urlPath.toLocalFile(); - QFileInfo f(fileName); + QFileInfo const f(fileName); if (f.exists() && IsMimeTypeImage(QMimeDatabase().mimeTypeForFile(fileName))) { event->acceptProposedAction(); @@ -674,11 +674,11 @@ void VMainGraphicsView::dragMoveEvent(QDragMoveEvent *event) auto *currentScene = qobject_cast(scene()); if (currentScene != nullptr && currentScene->AcceptDrop() && mime != nullptr && mime->hasText()) { - QUrl urlPath(mime->text().simplified()); + QUrl const urlPath(mime->text().simplified()); if (urlPath.isLocalFile()) { const QString fileName = urlPath.toLocalFile(); - QFileInfo f(fileName); + QFileInfo const f(fileName); if (f.exists() && IsMimeTypeImage(QMimeDatabase().mimeTypeForFile(fileName))) { event->acceptProposedAction(); @@ -694,11 +694,11 @@ void VMainGraphicsView::dropEvent(QDropEvent *event) auto *currentScene = qobject_cast(scene()); if (currentScene != nullptr && currentScene->AcceptDrop() && mime != nullptr && mime->hasText()) { - QUrl urlPath(mime->text().simplified()); + QUrl const urlPath(mime->text().simplified()); if (urlPath.isLocalFile()) { const QString fileName = urlPath.toLocalFile(); - QFileInfo f(fileName); + QFileInfo const f(fileName); if (f.exists() && IsMimeTypeImage(QMimeDatabase().mimeTypeForFile(fileName))) { emit currentScene->AddBackgroundImage(mapToScene(DropEventPos(event)), fileName); diff --git a/src/libs/vwidgets/vpiecegrainline.cpp b/src/libs/vwidgets/vpiecegrainline.cpp index ee77b4c4b..fab497c48 100644 --- a/src/libs/vwidgets/vpiecegrainline.cpp +++ b/src/libs/vwidgets/vpiecegrainline.cpp @@ -45,7 +45,7 @@ constexpr int arrowLength = 15; //--------------------------------------------------------------------------------------------------------------------- auto VPieceGrainlinePrivate::MainLine(const QPointF &p1, qreal length, qreal angle) -> QLineF { - QPointF pt2(p1.x() + length * cos(angle), p1.y() - length * sin(angle)); + QPointF const pt2(p1.x() + length * cos(angle), p1.y() - length * sin(angle)); return {p1, pt2}; } @@ -432,7 +432,7 @@ auto VPieceGrainline::IsPositionValid(const QVector &contourPoints) con //--------------------------------------------------------------------------------------------------------------------- auto VPieceGrainline::IsShapeValid() const -> bool { - GrainlineShape shape = Shape(); + GrainlineShape const shape = Shape(); return std::all_of(shape.cbegin(), shape.cend(), [](const auto &subShape) { return not subShape.isEmpty(); }); } diff --git a/src/libs/vwidgets/vpiecegrainline_p.h b/src/libs/vwidgets/vpiecegrainline_p.h index 12e41e4f7..622cd22bc 100644 --- a/src/libs/vwidgets/vpiecegrainline_p.h +++ b/src/libs/vwidgets/vpiecegrainline_p.h @@ -95,10 +95,11 @@ inline auto operator>>(QDataStream &dataStream, VPieceGrainlinePrivate &data) -> if (actualStreamHeader != VPieceGrainlinePrivate::streamHeader) { - QString message = QCoreApplication::tr("VPieceGrainlinePrivate prefix mismatch error: actualStreamHeader = " - "0x%1 and streamHeader = 0x%2") - .arg(actualStreamHeader, 8, 0x10, QLatin1Char('0')) - .arg(VPieceGrainlinePrivate::streamHeader, 8, 0x10, QLatin1Char('0')); + QString const message = + QCoreApplication::tr("VPieceGrainlinePrivate prefix mismatch error: actualStreamHeader = " + "0x%1 and streamHeader = 0x%2") + .arg(actualStreamHeader, 8, 0x10, QLatin1Char('0')) + .arg(VPieceGrainlinePrivate::streamHeader, 8, 0x10, QLatin1Char('0')); throw VException(message); } @@ -107,10 +108,11 @@ inline auto operator>>(QDataStream &dataStream, VPieceGrainlinePrivate &data) -> if (actualClassVersion > VPieceGrainlinePrivate::classVersion) { - QString message = QCoreApplication::tr("VPieceGrainlinePrivate compatibility error: actualClassVersion = %1 " - "and classVersion = %2") - .arg(actualClassVersion) - .arg(VPieceGrainlinePrivate::classVersion); + QString const message = + QCoreApplication::tr("VPieceGrainlinePrivate compatibility error: actualClassVersion = %1 " + "and classVersion = %2") + .arg(actualClassVersion) + .arg(VPieceGrainlinePrivate::classVersion); throw VException(message); } diff --git a/src/libs/vwidgets/vplaintextedit.cpp b/src/libs/vwidgets/vplaintextedit.cpp index 16942bf81..b63cbba80 100644 --- a/src/libs/vwidgets/vplaintextedit.cpp +++ b/src/libs/vwidgets/vplaintextedit.cpp @@ -101,21 +101,21 @@ void VPlainTextEdit::appendPlainText(const QString &text) //--------------------------------------------------------------------------------------------------------------------- void VPlainTextEdit::MatchParentheses() { - QList selections; + QList const selections; setExtraSelections(selections); VTextBlockData *data = static_cast(textCursor().block().userData()); if (data) { - QVector infos = data->Parentheses(); + QVector const infos = data->Parentheses(); - int pos = textCursor().block().position(); + int const pos = textCursor().block().position(); for (int i = 0; i < infos.size(); ++i) { ParenthesisInfo *info = infos.at(i); - int curPos = textCursor().position() - textCursor().block().position(); + int const curPos = textCursor().position() - textCursor().block().position(); if ((info->position == curPos - 1 || info->position == curPos) && info->character == '(') { CreateParenthesisSelection(pos + static_cast(info->position), @@ -137,9 +137,9 @@ void VPlainTextEdit::MatchParentheses() auto VPlainTextEdit::MatchLeftParenthesis(QTextBlock currentBlock, int i, int numLeftParentheses) -> bool { VTextBlockData *data = static_cast(currentBlock.userData()); - QVector infos = data->Parentheses(); + QVector const infos = data->Parentheses(); - int docPos = currentBlock.position(); + int const docPos = currentBlock.position(); for (; i < infos.size(); ++i) { ParenthesisInfo *info = infos.at(i); @@ -172,9 +172,9 @@ auto VPlainTextEdit::MatchLeftParenthesis(QTextBlock currentBlock, int i, int nu auto VPlainTextEdit::MatchRightParenthesis(QTextBlock currentBlock, int i, int numRightParentheses) -> bool { VTextBlockData *data = static_cast(currentBlock.userData()); - QVector parentheses = data->Parentheses(); + QVector const parentheses = data->Parentheses(); - int docPos = currentBlock.position(); + int const docPos = currentBlock.position(); for (; i > -1 && parentheses.size() > 0; --i) { ParenthesisInfo *info = parentheses.at(i); diff --git a/src/libs/vwidgets/vtextgraphicsitem.cpp b/src/libs/vwidgets/vtextgraphicsitem.cpp index 72169281b..64a77f51d 100644 --- a/src/libs/vwidgets/vtextgraphicsitem.cpp +++ b/src/libs/vwidgets/vtextgraphicsitem.cpp @@ -72,19 +72,19 @@ constexpr int activeZ = 10; auto GetBoundingRect(const QRectF &rectBB, qreal dRot) -> QRectF { std::array apt = {rectBB.topLeft(), rectBB.topRight(), rectBB.bottomLeft(), rectBB.bottomRight()}; - QPointF ptCenter = rectBB.center(); + QPointF const ptCenter = rectBB.center(); qreal dX1 = 0; qreal dX2 = 0; qreal dY1 = 0; qreal dY2 = 0; - double dAng = qDegreesToRadians(dRot); + double const dAng = qDegreesToRadians(dRot); for (std::size_t i = 0; i < 4; ++i) { - QPointF pt = apt.at(i) - ptCenter; - qreal dX = pt.x() * cos(dAng) + pt.y() * sin(dAng); - qreal dY = -pt.x() * sin(dAng) + pt.y() * cos(dAng); + QPointF const pt = apt.at(i) - ptCenter; + qreal const dX = pt.x() * cos(dAng) + pt.y() * sin(dAng); + qreal const dY = -pt.x() * sin(dAng) + pt.y() * cos(dAng); if (i == 0) { @@ -205,10 +205,10 @@ void VTextGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem painter->setPen(QPen(VSceneStylesheet::PatternPieceStyle().LabelModeColor(), 3)); painter->setBrush(Qt::NoBrush); // and then draw the arc in each of the corners - int iTop = rotateRect - rotateArc; - int iLeft = rotateRect - rotateArc; - int iRight = qRound(m_rectBoundingBox.width()) - rotateRect; - int iBottom = qRound(m_rectBoundingBox.height()) - rotateRect; + int const iTop = rotateRect - rotateArc; + int const iLeft = rotateRect - rotateArc; + int const iRight = qRound(m_rectBoundingBox.width()) - rotateRect; + int const iBottom = qRound(m_rectBoundingBox.height()) - rotateRect; painter->drawArc(iLeft, iTop, rotateArc, rotateArc, 180 * 16, -90 * 16); painter->drawArc(iRight, iTop, rotateArc, rotateArc, 90 * 16, -90 * 16); painter->drawArc(iLeft, iBottom, rotateArc, rotateArc, 270 * 16, -90 * 16); @@ -260,7 +260,7 @@ void VTextGraphicsItem::Update() */ auto VTextGraphicsItem::IsContained(QRectF rectBB, qreal dRot, qreal &dX, qreal &dY) const -> bool { - QRectF rectParent = parentItem()->boundingRect(); + QRectF const rectParent = parentItem()->boundingRect(); rectBB = GetBoundingRect(rectBB, dRot); dX = 0; dY = 0; @@ -337,7 +337,7 @@ auto VTextGraphicsItem::GetFontSize() const -> int int size = m_tm.GetFont().pixelSize(); if (size == -1) { - QFontMetrics fontMetrics(m_tm.GetFont()); + QFontMetrics const fontMetrics(m_tm.GetFont()); size = fontMetrics.height(); } @@ -478,10 +478,10 @@ void VTextGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *pME) SetItemOverrideCursor(this, cursorArrowOpenHand, 1, 1); } - double dDist = fabs(pME->scenePos().x() - m_ptStart.x()) + fabs(pME->scenePos().y() - m_ptStart.y()); + double const dDist = fabs(pME->scenePos().x() - m_ptStart.x()) + fabs(pME->scenePos().y() - m_ptStart.y()); // determine if this was just press/release (bShort == true) or user did some operation between press and // release - bool bShort = (dDist < 2); + bool const bShort = (dDist < 2); if (m_eMode == mMove || m_eMode == mResize) { // if user just pressed and released the button, we must switch the mode to rotate @@ -717,7 +717,7 @@ void VTextGraphicsItem::RotateLabel(QGraphicsSceneMouseEvent *pME) rectBB.setHeight(m_rectBoundingBox.height()); // calculate the angle difference from the starting angle - double dAng = qRadiansToDegrees(GetAngle(mapToParent(pME->pos())) - m_dAngle); + double const dAng = qRadiansToDegrees(GetAngle(mapToParent(pME->pos())) - m_dAngle); // check if the rotated label will be inside the parent item and then rotate it qreal dX; @@ -752,11 +752,11 @@ void VTextGraphicsItem::PaintLabelOutlineFont(QPainter *painter) const QVector labelLines = m_tm.GetLabelSourceLines(iW, fnt); VCommonSettings *settings = VAbstractApplication::VApp()->Settings(); - bool textAsPaths = settings->GetSingleStrokeOutlineFont(); + bool const textAsPaths = settings->GetSingleStrokeOutlineFont(); // draw text lines qreal iY = 0; - qreal penWidth = VAbstractApplication::VApp()->Settings()->WidthHairLine(); + qreal const penWidth = VAbstractApplication::VApp()->Settings()->WidthHairLine(); if (textAsPaths) { @@ -777,8 +777,8 @@ void VTextGraphicsItem::PaintLabelOutlineFont(QPainter *painter) fnt.setBold(tl.m_bold); fnt.setItalic(tl.m_italic); - QString qsText = tl.m_qsText; - QFontMetrics fm(fnt); + QString const qsText = tl.m_qsText; + QFontMetrics const fm(fnt); qreal lineHeight = fm.height(); if (iY + lineHeight > boundingRect.height()) @@ -854,10 +854,10 @@ void VTextGraphicsItem::PaintLabelSVGFont(QPainter *painter) VSvgFontEngine engine = db->FontEngine(m_tm.GetSVGFontFamily(), SVGFontStyle::Normal, SVGFontWeight::Normal, m_tm.GetSVGFontPointSize()); - VSvgFont svgFont = engine.Font(); + VSvgFont const svgFont = engine.Font(); if (!svgFont.IsValid()) { - QString errorMsg = tr("Invalid SVG font '%1'. Fallback to outline font.").arg(svgFont.Name()); + QString const errorMsg = tr("Invalid SVG font '%1'. Fallback to outline font.").arg(svgFont.Name()); VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) : qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; @@ -865,7 +865,7 @@ void VTextGraphicsItem::PaintLabelSVGFont(QPainter *painter) return; } - qreal penWidth = VAbstractApplication::VApp()->Settings()->WidthHairLine(); + qreal const penWidth = VAbstractApplication::VApp()->Settings()->WidthHairLine(); QPen pen = painter->pen(); pen.setCapStyle(Qt::RoundCap); pen.setJoinStyle(Qt::RoundJoin); diff --git a/src/test/CollectionTest/qttestmainlambda.cpp b/src/test/CollectionTest/qttestmainlambda.cpp index 98cc48b94..7efc92e3c 100644 --- a/src/test/CollectionTest/qttestmainlambda.cpp +++ b/src/test/CollectionTest/qttestmainlambda.cpp @@ -33,7 +33,7 @@ auto main(int argc, char **argv) -> int { - QApplication app( argc, argv ); + QApplication const app(argc, argv); int status = 0; auto ASSERT_TEST = [&status, argc, argv](QObject* obj) diff --git a/src/test/ParserTest/main.cpp b/src/test/ParserTest/main.cpp index 1fb5ac2e8..b8cee1401 100644 --- a/src/test/ParserTest/main.cpp +++ b/src/test/ParserTest/main.cpp @@ -34,7 +34,7 @@ //--------------------------------------------------------------------------------------------------------------------- inline void testMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) { - QByteArray localMsg = msg.toLocal8Bit(); + QByteArray const localMsg = msg.toLocal8Bit(); switch (type) { case QtDebugMsg: @@ -57,9 +57,9 @@ inline void testMessageOutput(QtMsgType type, const QMessageLogContext &context, //--------------------------------------------------------------------------------------------------------------------- auto main(int argc, char *argv[]) -> int { - QCoreApplication a(argc, argv); + QCoreApplication const a(argc, argv); qInstallMessageHandler(testMessageOutput); - qmu::Test::QmuParserTester pt; + qmu::Test::QmuParserTester const pt; QTimer::singleShot(0, &pt, &qmu::Test::QmuParserTester::Run); return a.exec(); } diff --git a/src/test/TranslationsTest/qttestmainlambda.cpp b/src/test/TranslationsTest/qttestmainlambda.cpp index 4f098e292..aeeec5486 100644 --- a/src/test/TranslationsTest/qttestmainlambda.cpp +++ b/src/test/TranslationsTest/qttestmainlambda.cpp @@ -44,7 +44,7 @@ using namespace Qt::Literals::StringLiterals; auto main(int argc, char **argv) -> int { - TestVApplication app(argc, argv); // For QPrinter + TestVApplication const app(argc, argv); // For QPrinter int status = 0; auto ASSERT_TEST = [&status, argc, argv](QObject *obj) diff --git a/src/test/TranslationsTest/tst_buitinregexp.cpp b/src/test/TranslationsTest/tst_buitinregexp.cpp index e2a141e9f..0f5609e78 100644 --- a/src/test/TranslationsTest/tst_buitinregexp.cpp +++ b/src/test/TranslationsTest/tst_buitinregexp.cpp @@ -109,7 +109,7 @@ void TST_BuitInRegExp::TestCheckIsNamesUnique_data() QTest::addColumn("translatedName"); QTest::addColumn("originalNames"); - QList keys = names.uniqueKeys(); + QList const keys = names.uniqueKeys(); for (const auto &key : keys) { const QString tag = u"Locale: '%1'. Name '%2'"_s.arg(m_locale, key); diff --git a/src/test/TranslationsTest/tst_qmuparsererrormsg.cpp b/src/test/TranslationsTest/tst_qmuparsererrormsg.cpp index 190865130..eb938ba20 100644 --- a/src/test/TranslationsTest/tst_qmuparsererrormsg.cpp +++ b/src/test/TranslationsTest/tst_qmuparsererrormsg.cpp @@ -68,7 +68,7 @@ void TST_QmuParserErrorMsg::initTestCase() QFAIL("Unsupported locale code."); } - QDir dir(TranslationsPath()); + QDir const dir(TranslationsPath()); const QStringList fileNames = dir.entryList(QStringList("valentina_*.qm")); QVERIFY2(locales.size() == fileNames.size(), "Unexpected count of files."); diff --git a/src/test/TranslationsTest/tst_tslocaletranslation.cpp b/src/test/TranslationsTest/tst_tslocaletranslation.cpp index f752e7dac..95306658c 100644 --- a/src/test/TranslationsTest/tst_tslocaletranslation.cpp +++ b/src/test/TranslationsTest/tst_tslocaletranslation.cpp @@ -51,7 +51,7 @@ void TST_TSLocaleTranslation::CheckPlaceMarkerExist_data() QTest::addColumn("direction"); const QString filename = QStringLiteral("valentina_%1.ts").arg(m_locale); - QLocale locale(m_locale); + QLocale const locale(m_locale); const QDomNodeList messages = LoadTSFile(filename); if (messages.isEmpty()) diff --git a/src/test/TranslationsTest/tst_tstranslation.cpp b/src/test/TranslationsTest/tst_tstranslation.cpp index 9e555a981..7055c10b2 100644 --- a/src/test/TranslationsTest/tst_tstranslation.cpp +++ b/src/test/TranslationsTest/tst_tstranslation.cpp @@ -81,10 +81,10 @@ void TST_TSTranslation::CheckEnglishLocalization_data() auto PluralForm = [translationTag]() { - QDomNodeList children = translationTag.childNodes(); + QDomNodeList const children = translationTag.childNodes(); for (int i = 0; i < children.size(); ++i) { - QDomNode child = children.item(i); + QDomNode const child = children.item(i); if (child.isElement()) { return true; diff --git a/src/test/ValentinaTest/qttestmainlambda.cpp b/src/test/ValentinaTest/qttestmainlambda.cpp index f568dccbf..26acf7c14 100644 --- a/src/test/ValentinaTest/qttestmainlambda.cpp +++ b/src/test/ValentinaTest/qttestmainlambda.cpp @@ -69,7 +69,7 @@ auto main(int argc, char **argv) -> int auto Terminate = qScopeGuard([]() { XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate(); }); #endif - TestVApplication app(argc, argv); // For QPrinter + TestVApplication const app(argc, argv); // For QPrinter QResource::registerResource(QCoreApplication::applicationDirPath() + QStringLiteral("/test_data.rcc")); diff --git a/src/test/ValentinaTest/tst_findpoint.cpp b/src/test/ValentinaTest/tst_findpoint.cpp index 3c2eb3f34..5ff97292e 100644 --- a/src/test/ValentinaTest/tst_findpoint.cpp +++ b/src/test/ValentinaTest/tst_findpoint.cpp @@ -293,7 +293,7 @@ void TST_FindPoint::TestShoulderPoint_data() // The same file /src/app/share/collection/bugs/Issue_#647.val // The length changed to get default value - QPointF p2(-574.724409448819, 115.5904251968504); + QPointF const p2(-574.724409448819, 115.5904251968504); QTest::newRow("Value not found") << QPointF(-234.5669291338583, 39.999874015748034) << p2 << QPointF(-234.5669291338583, -35.590677165354336) @@ -310,7 +310,7 @@ void TST_FindPoint::TestShoulderPoint() QFETCH(qreal, length); QFETCH(QPointF, point); - QPointF resultPoint = VToolShoulderPoint::FindPoint(p1, p2, pShoulder, length); + QPointF const resultPoint = VToolShoulderPoint::FindPoint(p1, p2, pShoulder, length); ComparePointsDistance(point, resultPoint, accuracyPointOnLine); } diff --git a/src/test/ValentinaTest/tst_qmutokenparser.cpp b/src/test/ValentinaTest/tst_qmutokenparser.cpp index ee3445e03..280cf443b 100644 --- a/src/test/ValentinaTest/tst_qmutokenparser.cpp +++ b/src/test/ValentinaTest/tst_qmutokenparser.cpp @@ -153,7 +153,7 @@ auto TST_QmuTokenParser::IsSingleFromUser(const QString &formula) -> bool try { - QScopedPointer cal(new qmu::QmuTokenParser(formula, true, true)); + QScopedPointer const cal(new qmu::QmuTokenParser(formula, true, true)); tokens = cal->GetTokens(); // Tokens (variables, measurements) numbers = cal->GetNumbers(); // All numbers in expression } diff --git a/src/test/ValentinaTest/tst_vabstractcurve.cpp b/src/test/ValentinaTest/tst_vabstractcurve.cpp index 0137b7683..0adaf4a51 100644 --- a/src/test/ValentinaTest/tst_vabstractcurve.cpp +++ b/src/test/ValentinaTest/tst_vabstractcurve.cpp @@ -167,7 +167,7 @@ void TST_VAbstractCurve::IsPointOnCurve() const QFETCH(QPointF, point); QFETCH(bool, expectedResult); - bool result = VAbstractCurve::IsPointOnCurve(points, point); + bool const result = VAbstractCurve::IsPointOnCurve(points, point); QCOMPARE(result, expectedResult); } @@ -180,8 +180,8 @@ void TST_VAbstractCurve::CurveIntersectLine_data() auto ASSERT_TEST_CASE = [](const char *title, const QString &input, const QString &output, QLineF line) { - QVector points = AbstractTest::VectorFromJson(input); - QVector intersections = AbstractTest::VectorFromJson(output); + QVector const points = AbstractTest::VectorFromJson(input); + QVector const intersections = AbstractTest::VectorFromJson(output); QTest::newRow(title) << points << intersections << line; }; diff --git a/src/test/ValentinaTest/tst_vabstractpiece.cpp b/src/test/ValentinaTest/tst_vabstractpiece.cpp index 40c197693..8f938a845 100644 --- a/src/test/ValentinaTest/tst_vabstractpiece.cpp +++ b/src/test/ValentinaTest/tst_vabstractpiece.cpp @@ -52,8 +52,8 @@ void TST_VAbstractPiece::EquidistantRemoveLoop_data() auto ASSERT_TEST_CASE = [](const char *title, const QString &input, const QString &output, qreal width) { - QVector inputPoints = AbstractTest::VectorFromJson(input); - QVector outputPoints = AbstractTest::VectorFromJson(output); + QVector const inputPoints = AbstractTest::VectorFromJson(input); + QVector const outputPoints = AbstractTest::VectorFromJson(output); QTest::newRow(title) << inputPoints << width << outputPoints; }; @@ -285,8 +285,8 @@ void TST_VAbstractPiece::LayoutAllowanceRemoveLoop_data() auto ASSERT_TEST_CASE = [](const char *title, const QString &input, const QString &output, qreal width) { - QVector inputPoints = AbstractTest::VectorFromJson(input); - QVector outputPoints = AbstractTest::VectorFromJson(output); + QVector const inputPoints = AbstractTest::VectorFromJson(input); + QVector const outputPoints = AbstractTest::VectorFromJson(output); QTest::newRow(title) << inputPoints << width << outputPoints; }; @@ -340,7 +340,7 @@ void TST_VAbstractPiece::TestAreaCalculation_data() QTest::addColumn("excpectedArea"); { - QVector rect{QPointF(), QPointF(100, 0), QPointF(100, 50), QPointF(0, 50), QPointF()}; + QVector const rect{QPointF(), QPointF(100, 0), QPointF(100, 50), QPointF(0, 50), QPointF()}; QTest::newRow("Rectangle 100 x 50") << rect << 100.0 * 50.0; } @@ -357,7 +357,7 @@ void TST_VAbstractPiece::TestAreaCalculation_data() } { - VPointF sectorCenter(100, 100, QChar('C'), 0, 0); + VPointF const sectorCenter(100, 100, QChar('C'), 0, 0); VArc sector(sectorCenter, 100, 15, 45); sector.SetApproximationScale(maxCurveApproximationScale); QVector sectorPath = sector.GetPoints(); @@ -385,8 +385,8 @@ void TST_VAbstractPiece::RawPathRemoveLoop_data() const auto ASSERT_TEST_CASE = [](const char *title, const QString &input, const QString &output) { - QVector inputPoints = AbstractTest::VectorFromJson(input); - QVector outputPoints = AbstractTest::VectorFromJson(output); + QVector const inputPoints = AbstractTest::VectorFromJson(input); + QVector const outputPoints = AbstractTest::VectorFromJson(output); QTest::newRow(title) << inputPoints << outputPoints; }; @@ -675,7 +675,7 @@ void TST_VAbstractPiece::PathRemoveLoop() const QFETCH(QVector, path); QFETCH(QVector, expect); - QVector res = VAbstractPiece::CheckLoops(path); + QVector const res = VAbstractPiece::CheckLoops(path); ComparePaths(res, expect); } @@ -874,8 +874,8 @@ void TST_VAbstractPiece::BrokenDetailEquidistant_data() auto ASSERT_TEST_CASE = [](const char *title, const QString &input, const QString &output, qreal width) { - QVector inputPoints = AbstractTest::VectorFromJson(input); - QVector outputPoints = AbstractTest::VectorFromJson(output); + QVector const inputPoints = AbstractTest::VectorFromJson(input); + QVector const outputPoints = AbstractTest::VectorFromJson(output); QTest::newRow(title) << inputPoints << width << outputPoints; }; @@ -973,8 +973,8 @@ void TST_VAbstractPiece::EquidistantAngleType_data() auto ASSERT_TEST_CASE = [](const char *title, const QString &input, const QString &output, qreal width) { - QVector inputPoints = AbstractTest::VectorFromJson(input); - QVector outputPoints = AbstractTest::VectorFromJson(output); + QVector const inputPoints = AbstractTest::VectorFromJson(input); + QVector const outputPoints = AbstractTest::VectorFromJson(output); QTest::newRow(title) << inputPoints << width << outputPoints; }; @@ -1098,8 +1098,8 @@ void TST_VAbstractPiece::TestCorrectEquidistantPoints_data() auto ASSERT_TEST_CASE = [](const char *title, const QString &input, const QString &output) { - QVector inputPoints = AbstractTest::VectorFromJson(input); - QVector outputPoints = AbstractTest::VectorFromJson(output); + QVector const inputPoints = AbstractTest::VectorFromJson(input); + QVector const outputPoints = AbstractTest::VectorFromJson(output); QTest::newRow(title) << inputPoints << outputPoints; }; @@ -1118,7 +1118,7 @@ void TST_VAbstractPiece::TestCorrectEquidistantPoints() const QFETCH(QVector, before); QFETCH(QVector, expect); - QVector after = VAbstractPiece::CorrectEquidistantPoints(before); + QVector const after = VAbstractPiece::CorrectEquidistantPoints(before); ComparePaths(after, expect); } @@ -1235,7 +1235,7 @@ void TST_VAbstractPiece::PossibleInfiniteClearLoops() const QFETCH(QVector, path); QFETCH(QVector, expect); - QVector res = VAbstractPiece::CheckLoops(path); + QVector const res = VAbstractPiece::CheckLoops(path); ComparePaths(res, expect); } @@ -1248,8 +1248,8 @@ void TST_VAbstractPiece::IsAllowanceValid_data() const auto ASSERT_TEST_CASE = [](const char *title, const QString &base, const QString &allowance, bool valid) { - QVector basePoints = AbstractTest::VectorFromJson(base); - QVector allowancePoints = AbstractTest::VectorFromJson(allowance); + QVector const basePoints = AbstractTest::VectorFromJson(base); + QVector const allowancePoints = AbstractTest::VectorFromJson(allowance); QTest::newRow(title) << basePoints << allowancePoints << valid; }; @@ -1265,7 +1265,7 @@ void TST_VAbstractPiece::IsAllowanceValid() const QFETCH(QVector, allowance); QFETCH(bool, valid); - bool result = VAbstractPiece::IsAllowanceValid(base, allowance); + bool const result = VAbstractPiece::IsAllowanceValid(base, allowance); QVERIFY(result == valid); } diff --git a/src/test/ValentinaTest/tst_varc.cpp b/src/test/ValentinaTest/tst_varc.cpp index febdbf5a2..889ecf764 100644 --- a/src/test/ValentinaTest/tst_varc.cpp +++ b/src/test/ValentinaTest/tst_varc.cpp @@ -47,7 +47,7 @@ void PrepareTestCase(const QPointF ¢er, qreal startAngle, qreal endAngle) const qreal threshold = UnitConvertor(2000, Unit::Cm, Unit::Px); while (radius <= threshold) { - VArc arc(VPointF(center), radius, startAngle, endAngle); + VArc const arc(VPointF(center), radius, startAngle, endAngle); const QVector points = arc.GetPoints(); const QString testStartAngle = u"Test start angel. Arc radius %1, start angle %2, end angle %3"_s.arg(radius) @@ -80,8 +80,8 @@ void TST_VArc::CompareTwoWays() const qreal f2 = 46; const qreal length = M_PI * radius / 180 * (f2 - f1); - VArc arc1(center, radius, f1, f2); - VArc arc2(length, center, radius, f1); + VArc const arc1(center, radius, f1, f2); + VArc const arc2(length, center, radius, f1); QCOMPARE(arc1.GetLength(), length); QCOMPARE(arc2.GetLength(), length); @@ -120,7 +120,7 @@ void TST_VArc::ArcByLength() QFETCH(int, direction); const qreal length = (M_PI * qAbs(radius) / 180 * arcAngle) * direction; - VArc arc(length, VPointF(), radius, startAngle); + VArc const arc(length, VPointF(), radius, startAngle); QCOMPARE(arc.GetLength(), length); QCOMPARE(arc.GetEndAngle(), endAngle); @@ -300,7 +300,7 @@ void TST_VArc::TestGetPoints() for (auto point : points) { - QLineF rLine(static_cast(center), point); + QLineF const rLine(static_cast(center), point); const qreal value = qAbs(rLine.length() - qAbs(radius)); // cppcheck-suppress unreadVariable const QString errorMsg = u"Broken the first rule. All points should be on the same distance from " @@ -382,7 +382,7 @@ void TST_VArc::TestFlip_data() QTest::addColumn("prefix"); const qreal radius = 5; - QPointF center(10, 5); + QPointF const center(10, 5); QPointF p1(10, 0); QPointF p2(5, 5); @@ -435,7 +435,7 @@ void TST_VArc::TestFlip() QFETCH(QLineF, axis); QFETCH(QString, prefix); - VArc originArc(VPointF(center), radius, startAngle, endAngle); + VArc const originArc(VPointF(center), radius, startAngle, endAngle); const VArc res = originArc.Flip(axis, prefix); // cppcheck-suppress unreadVariable @@ -531,7 +531,7 @@ void TST_VArc::TestCutArcByLength() VArc arc1; VArc arc2; - QPointF point = arc.CutArc(cutLength, arc1, arc2, QString()); + QPointF const point = arc.CutArc(cutLength, arc1, arc2, QString()); QCOMPARE(point, cutPoint); @@ -548,7 +548,8 @@ void TST_VArc::TestCutArcByLength() QCOMPARE(arc1.GetLength() + arc2.GetLength(), arc.GetLength()); - qreal segmentsLength = VAbstractCurve::PathLength(arc1.GetPoints()) + VAbstractCurve::PathLength(arc2.GetPoints()); + qreal const segmentsLength = + VAbstractCurve::PathLength(arc1.GetPoints()) + VAbstractCurve::PathLength(arc2.GetPoints()); QVERIFY(qAbs(segmentsLength - VAbstractCurve::PathLength(arc.GetPoints())) <= accuracyPointOnLine); } @@ -561,7 +562,7 @@ void TST_VArc::TestCurveIntersectAxis_data() QTest::addColumn("crosPoint"); QTest::addColumn("result"); - QPointF basePoint(10, 10); + QPointF const basePoint(10, 10); PrepareTestCase(basePoint, 0, 15); PrepareTestCase(basePoint, 0, 25); @@ -592,7 +593,7 @@ void TST_VArc::TestCurveIntersectAxis() //--------------------------------------------------------------------------------------------------------------------- void TST_VArc::EmptyArc() { - VArc empty; + VArc const empty; ComparePathsDistance(empty.GetPoints(), {QPointF()}); QCOMPARE(empty.GetLength(), 0.); @@ -757,22 +758,22 @@ void TST_VArc::TestCurvature() QFETCH(qreal, endAngle); const qreal tolerance = 0.1; - qreal expectedCurvature = 1. / qAbs(radius); - qreal scale = VArc::OptimalApproximationScale(radius, startAngle, endAngle, 0.1); + qreal const expectedCurvature = 1. / qAbs(radius); + qreal const scale = VArc::OptimalApproximationScale(radius, startAngle, endAngle, 0.1); const VPointF center; VArc arc(center, radius, startAngle, endAngle); arc.SetApproximationScale(scale); - qreal curvature = VAbstractCurve::Curvature(arc.GetPoints()); + qreal const curvature = VAbstractCurve::Curvature(arc.GetPoints()); if (scale < 10) { QVERIFY(expectedCurvature - curvature <= expectedCurvature * tolerance); - QVector p1 = arc.GetPoints(); + QVector const p1 = arc.GetPoints(); arc.SetApproximationScale(10); - QVector p2 = arc.GetPoints(); + QVector const p2 = arc.GetPoints(); QVERIFY(p1.size() <= p2.size()); } } diff --git a/src/test/ValentinaTest/tst_vellipticalarc.cpp b/src/test/ValentinaTest/tst_vellipticalarc.cpp index e791dc06c..e1d74b54a 100644 --- a/src/test/ValentinaTest/tst_vellipticalarc.cpp +++ b/src/test/ValentinaTest/tst_vellipticalarc.cpp @@ -149,15 +149,16 @@ void TST_VEllipticalArc::CompareTwoWays() const VPointF center(c); - VEllipticalArc arc1(center, radius1, radius2, f1, f2, rotationAngle); + VEllipticalArc const arc1(center, radius1, radius2, f1, f2, rotationAngle); const qreal length = arc1.GetLength(); - VEllipticalArc arc2(length, center, radius1, radius2, f1, rotationAngle); + VEllipticalArc const arc2(length, center, radius1, radius2, f1, rotationAngle); Q_RELAXED_CONSTEXPR qreal lengthEps = ToPixel(0.45, Unit::Mm); // computing error // cppcheck-suppress unreadVariable - QString errorLengthMsg = u"Difference between real and computing lengthes bigger than eps = %1. l1 = %2; l2 = %3"_s; + QString const errorLengthMsg = + u"Difference between real and computing lengthes bigger than eps = %1. l1 = %2; l2 = %3"_s; QVERIFY2(qAbs(arc2.GetLength() - length) <= lengthEps, qUtf8Printable(errorLengthMsg.arg(lengthEps).arg(arc2.GetLength()).arg(length))); QVERIFY2(qAbs(arc1.GetLength() - arc2.GetLength()) <= lengthEps, @@ -212,7 +213,7 @@ void TST_VEllipticalArc::ArcByLength() ((qAbs(radius1) + qAbs(radius2)) * (qAbs(radius1) + qAbs(radius2))); const qreal length = (M_PI * (qAbs(radius1) + qAbs(radius2)) * (1 + 3 * h / (10 + qSqrt(4 - 3 * h))) / 2) * direction; - VEllipticalArc arc(length, center, radius1, radius2, f1, rotationAngle); + VEllipticalArc const arc(length, center, radius1, radius2, f1, rotationAngle); Q_RELAXED_CONSTEXPR qreal eps = ToPixel(0.45, Unit::Mm); // computing error // cppcheck-suppress unreadVariable @@ -718,7 +719,7 @@ void TST_VEllipticalArc::TestGetPoints1() VEllipticalArc arc(center, radius1, radius2, startAngle, endAngle, rotationAngle); arc.SetApproximationScale(maxCurveApproximationScale); - QVector points = arc.GetPoints(); + QVector const points = arc.GetPoints(); if (qFuzzyIsNull(rotationAngle)) { // equation of ellipse will be different when rotation angle isn't 0 so we can't use this test in this case const qreal eps = 0.05; @@ -750,7 +751,7 @@ void TST_VEllipticalArc::TestGetPoints2() const VPointF center; VEllipticalArc arc(center, radius1, radius2, startAngle, endAngle, rotationAngle); arc.SetApproximationScale(maxCurveApproximationScale); - QVector points = arc.GetPoints(); + QVector const points = arc.GetPoints(); const qreal c = qSqrt(qAbs(radius2 * radius2 - radius1 * radius1)); // distance from the center to the focus @@ -826,7 +827,7 @@ void TST_VEllipticalArc::TestGetPoints3() const VPointF center; VEllipticalArc arc(center, radius1, radius2, startAngle, endAngle, rotationAngle); arc.SetApproximationScale(maxCurveApproximationScale); - QVector points = arc.GetPoints(); + QVector const points = arc.GetPoints(); if (VFuzzyComparePossibleNulls(arc.AngleArc(), 360.0)) { // calculated full ellipse square @@ -918,7 +919,7 @@ void TST_VEllipticalArc::TestGetPoints5() QCOMPARE(f1, stAngle); QCOMPARE(f2, enAngle); - QVector points = arc.GetPoints(); + QVector const points = arc.GetPoints(); if (points.size() > 2 && qFuzzyIsNull(rotationAngle)) { @@ -1081,7 +1082,8 @@ void TST_VEllipticalArc::TestRotation() qUtf8Printable(u"a1 = %1, a2 - %2"_s.arg(arcOrigin.AngleArc()).arg(rotatedArc.AngleArc()))); // cppcheck-suppress unreadVariable - QString errorLengthMsg = u"Difference between real and computing lengthes bigger than eps = %1. l1 = %2; l2 = %3"_s; + QString const errorLengthMsg = + u"Difference between real and computing lengthes bigger than eps = %1. l1 = %2; l2 = %3"_s; QVERIFY2(qAbs(arcOrigin.GetLength() - rotatedArc.GetLength()) <= ToPixel(1, Unit::Mm), qUtf8Printable( errorLengthMsg.arg(ToPixel(1, Unit::Mm)).arg(arcOrigin.GetLength()).arg(rotatedArc.GetLength()))); diff --git a/src/test/ValentinaTest/tst_vmeasurements.cpp b/src/test/ValentinaTest/tst_vmeasurements.cpp index f25b1a08a..4ca7d36e3 100644 --- a/src/test/ValentinaTest/tst_vmeasurements.cpp +++ b/src/test/ValentinaTest/tst_vmeasurements.cpp @@ -52,9 +52,9 @@ TST_VMeasurements::TST_VMeasurements(QObject *parent) */ void TST_VMeasurements::CreateEmptyMultisizeFile() { - Unit mUnit = Unit::Cm; + Unit const mUnit = Unit::Cm; - QSharedPointer data = + QSharedPointer const data = QSharedPointer(new VContainer(nullptr, &mUnit, VContainer::UniqueNamespace())); auto m_xDimension = QSharedPointer::create(mUnit, 50, 200, 6); m_xDimension->SetBaseValue(176); @@ -63,9 +63,10 @@ void TST_VMeasurements::CreateEmptyMultisizeFile() m_yDimension->SetBaseValue(50); m_yDimension->SetBodyMeasurement(true); - QVector dimensions{m_xDimension, m_yDimension}; + QVector const dimensions{m_xDimension, m_yDimension}; - QSharedPointer m = QSharedPointer(new VMeasurements(mUnit, dimensions, data.data())); + QSharedPointer const m = + QSharedPointer(new VMeasurements(mUnit, dimensions, data.data())); QTemporaryFile file; QString fileName; @@ -89,7 +90,7 @@ void TST_VMeasurements::CreateEmptyMultisizeFile() try { - VVSTConverter converter(fileName); + VVSTConverter const converter(fileName); } catch (VException &e) { @@ -103,12 +104,12 @@ void TST_VMeasurements::CreateEmptyMultisizeFile() */ void TST_VMeasurements::CreateEmptyIndividualFile() { - Unit mUnit = Unit::Cm; + Unit const mUnit = Unit::Cm; - QSharedPointer data = + QSharedPointer const data = QSharedPointer(new VContainer(nullptr, &mUnit, VContainer::UniqueNamespace())); - QSharedPointer m = QSharedPointer(new VMeasurements(mUnit, data.data())); + QSharedPointer const m = QSharedPointer(new VMeasurements(mUnit, data.data())); QTemporaryFile file; QString fileName; @@ -129,7 +130,7 @@ void TST_VMeasurements::CreateEmptyIndividualFile() try { - VVITConverter converter(fileName); + VVITConverter const converter(fileName); } catch (VException &e) { diff --git a/src/test/ValentinaTest/tst_vpiece.cpp b/src/test/ValentinaTest/tst_vpiece.cpp index 47b79a864..964c93609 100644 --- a/src/test/ValentinaTest/tst_vpiece.cpp +++ b/src/test/ValentinaTest/tst_vpiece.cpp @@ -57,7 +57,8 @@ void TST_VPiece::Issue620() QVector pointsEkv; CastTo(detail.MainPathPoints(data.data()), pointsEkv); - QVector origPoints = AbstractTest::VectorFromJson(QStringLiteral("://Issue_620/output.json")); + QVector const origPoints = + AbstractTest::VectorFromJson(QStringLiteral("://Issue_620/output.json")); // Begin comparison ComparePaths(pointsEkv, origPoints); @@ -85,8 +86,8 @@ void TST_VPiece::TestSAPassmark_data() VPiecePassmarkData inputPassmarkData; AbstractTest::PassmarkDataFromJson(passmarkData, inputPassmarkData); - QVector inputSeamAllowance = AbstractTest::VectorFromJson(seamAllowance); - QVector inputRotatedSeamAllowance = AbstractTest::VectorFromJson(rotatedSeamAllowance); + QVector const inputSeamAllowance = AbstractTest::VectorFromJson(seamAllowance); + QVector const inputRotatedSeamAllowance = AbstractTest::VectorFromJson(rotatedSeamAllowance); QVector inputOutputShape; AbstractTest::PassmarkShapeFromJson(shape, inputOutputShape); @@ -127,7 +128,7 @@ void TST_VPiece::TestSAPassmark() QFETCH(QVector, rotatedSeamAllowance); QFETCH(QVector, expectedResult); - VPassmark passmark(passmarkData); + VPassmark const passmark(passmarkData); CompareLinesDistance(passmark.SAPassmark(seamAllowance, rotatedSeamAllowance, PassmarkSide::All), expectedResult); } diff --git a/src/test/ValentinaTest/tst_vpointf.cpp b/src/test/ValentinaTest/tst_vpointf.cpp index 3d382a22d..3511765fe 100644 --- a/src/test/ValentinaTest/tst_vpointf.cpp +++ b/src/test/ValentinaTest/tst_vpointf.cpp @@ -51,7 +51,7 @@ void TST_VPointF::TestFlip_data() QTest::addColumn("flipped"); QTest::addColumn("prefix"); - VPointF originPoint; + VPointF const originPoint; QLineF axis = QLineF(QPointF(5, 0), QPointF(5, 10)); QPointF flipped = QPointF(10, 0); diff --git a/src/test/ValentinaTest/tst_vposter.cpp b/src/test/ValentinaTest/tst_vposter.cpp index 001f04e55..4910995d3 100644 --- a/src/test/ValentinaTest/tst_vposter.cpp +++ b/src/test/ValentinaTest/tst_vposter.cpp @@ -54,7 +54,7 @@ void TST_VPoster::BigPoster() printer.setPageMargins(QMarginsF(), QPageLayout::Millimeter); const QSize image(2622, 3178); // Little bit bigger than A1 - VPoster posterazor(&printer); + VPoster const posterazor(&printer); const QVector poster = posterazor.Calc(image, 0, PageOrientation::Portrait); QCOMPARE(poster.size(), 12); @@ -74,7 +74,7 @@ void TST_VPoster::SmallPoster() printer.setPageSize(QPageSize(QPageSize::A4)); const QSize image(700, 1000); // Little bit less than A4 - VPoster posterazor(&printer); + VPoster const posterazor(&printer); const QVector poster = posterazor.Calc(image, 0, PageOrientation::Portrait); QCOMPARE(poster.size(), 1); diff --git a/src/test/ValentinaTest/tst_vspline.cpp b/src/test/ValentinaTest/tst_vspline.cpp index edfa490d5..4da1ab3c8 100644 --- a/src/test/ValentinaTest/tst_vspline.cpp +++ b/src/test/ValentinaTest/tst_vspline.cpp @@ -42,14 +42,14 @@ TST_VSpline::TST_VSpline(QObject *parent) void TST_VSpline::GetSegmentPoints() { // Input data taken from real case - VPointF p1(1168.8582803149607, 39.999874015748034, "p1", 5.0000125984251973, 9.9999874015748045); - VPointF p4(681.33729132409951, 1815.7969526662778, "p4", 5.0000125984251973, 9.9999874015748045); + VPointF const p1(1168.8582803149607, 39.999874015748034, "p1", 5.0000125984251973, 9.9999874015748045); + VPointF const p4(681.33729132409951, 1815.7969526662778, "p4", 5.0000125984251973, 9.9999874015748045); VSpline spl(p1, p4, 229.381, 41.6325, 0.96294100000000005, 1.00054, 1); spl.SetApproximationScale(10); - QPointF begin(957.69885233364062, 943.84482037833141); - QPointF end(681.33729132409951, 1815.7969526662778); + QPointF const begin(957.69885233364062, 943.84482037833141); + QPointF const end(681.33729132409951, 1815.7969526662778); QVector points; points << spl.GetSegmentPoints(begin, end, false); @@ -170,14 +170,14 @@ void TST_VSpline::GetSegmentPoints_issue412() { // Input data taken from real case // See issue #412 https://bitbucket.org/dismine/valentina/issues/412/error-in-detail-using-segment-a-simple - VPointF p1(869.11748031496063, -61.117228346456692, "p1", 5.0000125984251973, 9.9999874015748045); - VPointF p4(491.16472440944887, 316.83552755905515, "p4", 5.0000125984251973, 9.9999874015748045); + VPointF const p1(869.11748031496063, -61.117228346456692, "p1", 5.0000125984251973, 9.9999874015748045); + VPointF const p4(491.16472440944887, 316.83552755905515, "p4", 5.0000125984251973, 9.9999874015748045); VSpline spl(p1, p4, 270, 0, 1, 1, 1); spl.SetApproximationScale(10); - QPointF begin(869.11748031496063, -61.117228346456692); - QPointF end(758.41768107838425, 206.13572832247544); + QPointF const begin(869.11748031496063, -61.117228346456692); + QPointF const end(758.41768107838425, 206.13572832247544); QVector points; points << spl.GetSegmentPoints(begin, end, false); @@ -260,14 +260,14 @@ void TST_VSpline::GetSegmentPoints_TestPuzzle() // Input data taken from real case // See the file /src/app/share/collection/TestPuzzle.val // Test issue with method IsPointOnLineSegment. - VPointF p1(1168.8582803149607, 39.999874015748034, "p1", 5.0000125984251973, 9.9999874015748045); - VPointF p4(681.33729132409951, 1815.7969526662778, "p4", 5.0000125984251973, 9.9999874015748045); + VPointF const p1(1168.8582803149607, 39.999874015748034, "p1", 5.0000125984251973, 9.9999874015748045); + VPointF const p4(681.33729132409951, 1815.7969526662778, "p4", 5.0000125984251973, 9.9999874015748045); VSpline spl(p1, p4, 229.381, 41.6325, 0.96294100000000005, 1.00054, 1); spl.SetApproximationScale(10); - QPointF begin(1168.85828031, 39.9998740157); - QPointF end(957.69883966, 943.844812978); + QPointF const begin(1168.85828031, 39.9998740157); + QPointF const end(957.69883966, 943.844812978); QVector points; points << spl.GetSegmentPoints(begin, end, false); @@ -695,8 +695,8 @@ void TST_VSpline::CompareThreeWays() { // Input data taken from real case // See the file /src/app/share/collection/TestPuzzle.val - VPointF p1(1168.8582803149607, 39.999874015748034, "p1", 5.0000125984251973, 9.9999874015748045); - VPointF p4(681.33729132409951, 1815.7969526662778, "p4", 5.0000125984251973, 9.9999874015748045); + VPointF const p1(1168.8582803149607, 39.999874015748034, "p1", 5.0000125984251973, 9.9999874015748045); + VPointF const p4(681.33729132409951, 1815.7969526662778, "p4", 5.0000125984251973, 9.9999874015748045); VSpline spl1(p1, p4, 229.381, 41.6325, 0.96294100000000005, 1.00054, 1); spl1.SetApproximationScale(10); @@ -771,10 +771,10 @@ void TST_VSpline::TestParametrT() //--------------------------------------------------------------------------------------------------------------------- void TST_VSpline::TestLengthByPoint_data() { - VPointF p1(1168.8582803149607, 39.999874015748034, "p1", 5.0000125984251973, 9.9999874015748045); - VPointF p4(681.33729132409951, 1815.7969526662778, "p4", 5.0000125984251973, 9.9999874015748045); + VPointF const p1(1168.8582803149607, 39.999874015748034, "p1", 5.0000125984251973, 9.9999874015748045); + VPointF const p4(681.33729132409951, 1815.7969526662778, "p4", 5.0000125984251973, 9.9999874015748045); - VSpline spl(p1, p4, 229.381, 41.6325, 0.96294100000000005, 1.00054, 1); + VSpline const spl(p1, p4, 229.381, 41.6325, 0.96294100000000005, 1.00054, 1); QTest::addColumn("spl"); QTest::addColumn("point"); @@ -810,10 +810,10 @@ void TST_VSpline::TestFlip_data() QTest::addColumn("axis"); QTest::addColumn("prefix"); - VPointF p1(1168.8582803149607, 39.999874015748034, "p1", 5.0000125984251973, 9.9999874015748045); - VPointF p4(681.33729132409951, 1815.7969526662778, "p4", 5.0000125984251973, 9.9999874015748045); + VPointF const p1(1168.8582803149607, 39.999874015748034, "p1", 5.0000125984251973, 9.9999874015748045); + VPointF const p4(681.33729132409951, 1815.7969526662778, "p4", 5.0000125984251973, 9.9999874015748045); - VSpline spl(p1, p4, 229.381, 41.6325, 0.96294100000000005, 1.00054, 1); + VSpline const spl(p1, p4, 229.381, 41.6325, 0.96294100000000005, 1.00054, 1); QLineF axis(QPointF(600, 30), QPointF(600, 1800)); @@ -855,15 +855,16 @@ void TST_VSpline::TestCutSpline_data() QTest::addColumn("name"); { - VPointF p1(187.31716535433043, 51.31464566929152, QStringLiteral("p1"), 140.42872440944885, -22.62372283464567); - VPointF p4(-991.8954330708666, 9.739842519685212, QStringLiteral("p4"), 9.999987401574804, 15.0); + VPointF const p1(187.31716535433043, 51.31464566929152, QStringLiteral("p1"), 140.42872440944885, + -22.62372283464567); + VPointF const p4(-991.8954330708666, 9.739842519685212, QStringLiteral("p4"), 9.999987401574804, 15.0); VSpline spl(p1, p4, 181.0, QStringLiteral("181"), 356.0, QStringLiteral("356"), 548.7874015748031, QStringLiteral("Line_Г3_Г6*1.1"), 226.7716535433071, QStringLiteral("6")); spl.SetApproximationScale(0.5); - QString name(QStringLiteral("з")); - qreal result = 1.35; // Correct distance in cm. + QString 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) // Size 54 produces incorrect spline segment distance @@ -871,14 +872,14 @@ void TST_VSpline::TestCutSpline_data() } { - VPointF p1(1898.0384322000489, -143.17624447113994, QStringLiteral("p1"), 9.999987401574804, - -105.35848818897638); - VPointF p4(1557.8809518850883, -143.17624447113994, QStringLiteral("p4"), 9.999987401574804, 15.0); + VPointF const p1(1898.0384322000489, -143.17624447113994, QStringLiteral("p1"), 9.999987401574804, + -105.35848818897638); + VPointF const p4(1557.8809518850883, -143.17624447113994, QStringLiteral("p4"), 9.999987401574804, 15.0); - VSpline spl(p1, p4, 175.0, QStringLiteral("175"), 5.0, QStringLiteral("5"), 151.18110236220474, - QStringLiteral("4"), 151.18110236220474, QStringLiteral("4")); + VSpline const spl(p1, p4, 175.0, QStringLiteral("175"), 5.0, QStringLiteral("5"), 151.18110236220474, + QStringLiteral("4"), 151.18110236220474, QStringLiteral("4")); - QString name(QStringLiteral("А193")); + QString 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; @@ -893,9 +894,10 @@ void TST_VSpline::TestCutSpline() QFETCH(QString, name); QPointF spl1p2, spl1p3, spl2p2, spl2p3; - QPointF point = spl.CutSpline(UnitConvertor(result, Unit::Cm, Unit::Px), spl1p2, spl1p3, spl2p2, spl2p3, name); + QPointF const point = + spl.CutSpline(UnitConvertor(result, Unit::Cm, Unit::Px), spl1p2, spl1p3, spl2p2, spl2p3, name); - VPointF p(point, name, -16.590651968503941, 37.574173228346453); + VPointF const p(point, name, -16.590651968503941, 37.574173228346453); VSpline spline1(spl.GetP1(), spl1p2, spl1p3, p); spline1.SetApproximationScale(0.5); diff --git a/src/test/ValentinaTest/tst_vsplinepath.cpp b/src/test/ValentinaTest/tst_vsplinepath.cpp index b50867ba5..b8ffcca1f 100644 --- a/src/test/ValentinaTest/tst_vsplinepath.cpp +++ b/src/test/ValentinaTest/tst_vsplinepath.cpp @@ -55,46 +55,46 @@ void TST_VSplinePath::TestRotation_data() QVector originPoints; { - VPointF pSpline(30, 39.999874015748034, "X", 5.0000125984251973, 9.9999874015748045); - VSplinePoint p(pSpline, 89.208600000000004, "89.2086", 269.20859999999999, "269.209", 0, QChar('0'), - 153.33618897637794, "4.05702"); + VPointF const pSpline(30, 39.999874015748034, "X", 5.0000125984251973, 9.9999874015748045); + VSplinePoint const p(pSpline, 89.208600000000004, "89.2086", 269.20859999999999, "269.209", 0, QChar('0'), + 153.33618897637794, "4.05702"); originPoints.append(p); } { - VPointF pSpline(198.77104389529981, 249.18158602595835, "X", 5.0000125984251973, 9.9999874015748045); - VSplinePoint p(pSpline, 146.43199999999999, "146.432", 326.43200000000002, "326.432", 36.387590551181106, - "0.962755", 60.978897637795278, "1.6134"); + VPointF const pSpline(198.77104389529981, 249.18158602595835, "X", 5.0000125984251973, 9.9999874015748045); + VSplinePoint const p(pSpline, 146.43199999999999, "146.432", 326.43200000000002, "326.432", 36.387590551181106, + "0.962755", 60.978897637795278, "1.6134"); originPoints.append(p); } { - VPointF pSpline(820.42771653543309, 417.95262992125987, "X", 5.0000125984251973, 9.9999874015748045); - VSplinePoint p(pSpline, 173.39500000000001, "173.395", 353.39499999999998, "353.395", 381.23716535433073, - "10.0869", 0, QChar('0')); + VPointF const pSpline(820.42771653543309, 417.95262992125987, "X", 5.0000125984251973, 9.9999874015748045); + VSplinePoint const p(pSpline, 173.39500000000001, "173.395", 353.39499999999998, "353.395", 381.23716535433073, + "10.0869", 0, QChar('0')); originPoints.append(p); } QVector rotatedPoints; { - VPointF pSpline(-347.55140568256883, 400.53936590535034, "X", 5.0000125984251973, 9.9999874015748045); - VSplinePoint p(pSpline, 176.56789999999998, "176.568", 356.56790000000001, "356.568", 0, QChar('0'), - 153.33618897637794, "4.05702"); + VPointF const pSpline(-347.55140568256883, 400.53936590535034, "X", 5.0000125984251973, 9.9999874015748045); + VSplinePoint const p(pSpline, 176.56789999999998, "176.568", 356.56790000000001, "356.568", 0, QChar('0'), + 153.33618897637794, "4.05702"); rotatedPoints.append(p); } { - VPointF pSpline(-130.81610509751462, 241.58508512833563, "X", 5.0000125984251973, 9.9999874015748045); - VSplinePoint p(pSpline, 233.79130000000001, "233.791", 53.791300000000014, "53.7913", 36.387590551181141, - "0.962755", 60.978897637795207, "1.6134"); + VPointF const pSpline(-130.81610509751462, 241.58508512833563, "X", 5.0000125984251973, 9.9999874015748045); + VSplinePoint const p(pSpline, 233.79130000000001, "233.791", 53.791300000000014, "53.7913", 36.387590551181141, + "0.962755", 60.978897637795207, "1.6134"); rotatedPoints.append(p); } { - VPointF pSpline(66.417055567032421, -371.63572683892357, "X", 5.0000125984251973, 9.9999874015748045); - VSplinePoint p(pSpline, 260.7543, "260.754", 80.754300000000015, "80.7543", 381.23716535433078, "10.0869", 0, - QChar('0')); + VPointF const pSpline(66.417055567032421, -371.63572683892357, "X", 5.0000125984251973, 9.9999874015748045); + VSplinePoint const p(pSpline, 260.7543, "260.754", 80.754300000000015, "80.7543", 381.23716535433078, "10.0869", + 0, QChar('0')); rotatedPoints.append(p); } @@ -149,23 +149,23 @@ void TST_VSplinePath::TestFlip_data() QVector originPoints; { - VPointF pSpline(30, 39.999874015748034, "X", 5.0000125984251973, 9.9999874015748045); - VSplinePoint p(pSpline, 89.208600000000004, "89.2086", 269.20859999999999, "269.209", 0, QChar('0'), - 153.33618897637794, "4.05702"); + VPointF const pSpline(30, 39.999874015748034, "X", 5.0000125984251973, 9.9999874015748045); + VSplinePoint const p(pSpline, 89.208600000000004, "89.2086", 269.20859999999999, "269.209", 0, QChar('0'), + 153.33618897637794, "4.05702"); originPoints.append(p); } { - VPointF pSpline(198.77104389529981, 249.18158602595835, "X", 5.0000125984251973, 9.9999874015748045); - VSplinePoint p(pSpline, 146.43199999999999, "146.432", 326.43200000000002, "326.432", 36.387590551181106, - "0.962755", 60.978897637795278, "1.6134"); + VPointF const pSpline(198.77104389529981, 249.18158602595835, "X", 5.0000125984251973, 9.9999874015748045); + VSplinePoint const p(pSpline, 146.43199999999999, "146.432", 326.43200000000002, "326.432", 36.387590551181106, + "0.962755", 60.978897637795278, "1.6134"); originPoints.append(p); } { - VPointF pSpline(820.42771653543309, 417.95262992125987, "X", 5.0000125984251973, 9.9999874015748045); - VSplinePoint p(pSpline, 173.39500000000001, "173.395", 353.39499999999998, "353.395", 381.23716535433073, - "10.0869", 0, QChar('0')); + VPointF const pSpline(820.42771653543309, 417.95262992125987, "X", 5.0000125984251973, 9.9999874015748045); + VSplinePoint const p(pSpline, 173.39500000000001, "173.395", 353.39499999999998, "353.395", 381.23716535433073, + "10.0869", 0, QChar('0')); originPoints.append(p); } diff --git a/src/test/ValentinaTest/tst_vsvgpathtokenizer.cpp b/src/test/ValentinaTest/tst_vsvgpathtokenizer.cpp index b26b36019..b1d4c3dfc 100644 --- a/src/test/ValentinaTest/tst_vsvgpathtokenizer.cpp +++ b/src/test/ValentinaTest/tst_vsvgpathtokenizer.cpp @@ -79,14 +79,15 @@ void TST_VSVGPathTokenizer::TokenizingSVGPath_data() QTest::newRow("Empty path") << "" << QList(); { - QList path = {{'M', {444, 665}}, {'L', {403, 592}}, {'L', {295, 362}}, - {'L', {232, 214}}, {'M', {204, 63}}, {'L', {182, 40.9}}}; + QList const path = {{'M', {444, 665}}, {'L', {403, 592}}, {'L', {295, 362}}, + {'L', {232, 214}}, {'M', {204, 63}}, {'L', {182, 40.9}}}; QTest::newRow("Valid path1") << "M 444 665 L 403 592 L 295 362 L 232 214 M 204 63 L 182 40.9" << path; QTest::newRow("Valid path1. No space") << "M444,665L403,592L295,362L232,214M204,63L182,40.9" << path; } { - QList path = {{'M', {444, 665, 403, 592, 295, 362, 232, 214}}, {'M', {204, 63, 182, 40.9}}}; + QList const path = {{'M', {444, 665, 403, 592, 295, 362, 232, 214}}, + {'M', {204, 63, 182, 40.9}}}; QTest::newRow("Valid path1. Implicit 'lineto'") << "M 444 665 403 592 295 362 232 214 M 204 63 182 40.9" << path; @@ -95,25 +96,25 @@ void TST_VSVGPathTokenizer::TokenizingSVGPath_data() } { - QList path = {{'M', {444, 403, 592, 295, 362, 232, 214}}, {'M', {204, 63, 182, 40.9}}}; + QList const path = {{'M', {444, 403, 592, 295, 362, 232, 214}}, {'M', {204, 63, 182, 40.9}}}; QTest::newRow("Invalid path1. Implicit 'lineto'") << "M 444 665r0 403 592 295 362 232 214 M 204 63 182 40.9" << path; } { - QList path = {{'M', {89.2783, 316.097}}, - {'C', {400.408, 348.062, 712.222, 329.315, 1024.04, 321.159}}, - {'M', {1096.6, 543.884}}, - {'C', {1082.96, 623.613, 1099.42, 642.388, 1172.53, 710.927}}, - {'C', {1001.15, 691.624, 719.415, 750.709, 646.089, 638.373}}, - {'M', {-44.0188, -100.667}}, - {'C', {-44.0188, -100.667, 102.6, 292.235, 198.953, 419.023}}, - {'C', {295.306, 545.811, 398.471, 665.784, 479.046, 709.239}}, - {'C', {586.956, 762.684, 641.433, 740.563, 646.089, 692.366}}, - {'C', {638.726, 495.905, 445.602, 252.633, 504.355, 74.8129}}, - {'C', {532.714, -1.50505, 568.017, -23.3497, 654.525, -55.1095}}, - {'C', {741.033, -86.8694, 902.328, -79.7905, 1008.86, -51.7349}}, - {'C', {1115.39, -23.6793, 1277.14, 96.7478, 1277.14, 0.7478}}}; + QList const path = {{'M', {89.2783, 316.097}}, + {'C', {400.408, 348.062, 712.222, 329.315, 1024.04, 321.159}}, + {'M', {1096.6, 543.884}}, + {'C', {1082.96, 623.613, 1099.42, 642.388, 1172.53, 710.927}}, + {'C', {1001.15, 691.624, 719.415, 750.709, 646.089, 638.373}}, + {'M', {-44.0188, -100.667}}, + {'C', {-44.0188, -100.667, 102.6, 292.235, 198.953, 419.023}}, + {'C', {295.306, 545.811, 398.471, 665.784, 479.046, 709.239}}, + {'C', {586.956, 762.684, 641.433, 740.563, 646.089, 692.366}}, + {'C', {638.726, 495.905, 445.602, 252.633, 504.355, 74.8129}}, + {'C', {532.714, -1.50505, 568.017, -23.3497, 654.525, -55.1095}}, + {'C', {741.033, -86.8694, 902.328, -79.7905, 1008.86, -51.7349}}, + {'C', {1115.39, -23.6793, 1277.14, 96.7478, 1277.14, 0.7478}}}; QTest::newRow("Valid path2") << "M89.2783 316.097C400.408 348.062 712.222 329.315 1024.04 " "321.159M1096.6 543.884C1082.96 623.613 " "1099.42 642.388 1172.53 710.927C1001.15 691.624 719.415 " @@ -129,7 +130,7 @@ void TST_VSVGPathTokenizer::TokenizingSVGPath_data() } { - QList path = { + QList const path = { {'M', {10, 30}}, {'A', {20, 20, 0, 0, 1, 50, 30}}, {'A', {20, 20, 0, 0, 1, 90, 30}}, {'Q', {90, 60, 50, 90}}, {'Q', {10, 60, 10, 0.3}}, {'z', {0}}}; QTest::newRow("Valid path3") << "M 10,30 A 20,20 0,0,1 50,30 A 20,20 0,0,1 90,30 Q 90,60 50,90 Q 10,60 10,.3 z" @@ -139,7 +140,7 @@ void TST_VSVGPathTokenizer::TokenizingSVGPath_data() } { - QList path = { + QList const path = { {'M', {10, 10}}, {'h', {10}}, {'m', {0, 10}}, {'h', {10}}, {'m', {0, 10}}, {'h', {10}}, {'M', {40, 20}}, {'h', {10}}, {'m', {0, 10}}, {'h', {10}}, {'m', {0, 10}}, {'h', {10}}, {'m', {0, 10}}, {'h', {10}}, {'M', {50, 50}}, {'h', {10}}, {'m', {-20, 10}}, {'h', {10}}, @@ -153,18 +154,19 @@ void TST_VSVGPathTokenizer::TokenizingSVGPath_data() } { - QList path = {{'M', {109.547, 99.5815}}, {'L', {51.0984, -1.90735e-005}}, {'L', {0, 123.374}}}; + QList const path = { + {'M', {109.547, 99.5815}}, {'L', {51.0984, -1.90735e-005}}, {'L', {0, 123.374}}}; QTest::newRow("Valid path5") << "M 109.547,99.5815L 51.0984,-1.90735e-005L 0,123.374" << path; QTest::newRow("Valid path5. No space") << "M109.547,99.5815L51.0984-1.90735e-005L0,123.374" << path; } { - QList path = {{'M', {198.44, 340.26}}, {'l', {-.4, 41.2}}, {'m', {13.93, -36.83}}, - {'l', {-.2, 44.12}}, {'m', {15.2, -42.25}}, {'l', {-.43, 46.2}}, - {'m', {13.96, -45.16}}, {'l', {-.22, 46.83}}, {'m', {15.4, -46.4}}, - {'v', {46.82}}, {'m', {14.57, -47.1}}, {'l', {.2, 46.8}}, - {'m', {12.92, -48.1}}, {'l', {.4, 46}}, {'m', {14.8, -48.5}}, - {'l', {.2, 44.1}}, {'m', {13.53, -49.6}}, {'l', {.4, 41.6}}}; + QList const path = {{'M', {198.44, 340.26}}, {'l', {-.4, 41.2}}, {'m', {13.93, -36.83}}, + {'l', {-.2, 44.12}}, {'m', {15.2, -42.25}}, {'l', {-.43, 46.2}}, + {'m', {13.96, -45.16}}, {'l', {-.22, 46.83}}, {'m', {15.4, -46.4}}, + {'v', {46.82}}, {'m', {14.57, -47.1}}, {'l', {.2, 46.8}}, + {'m', {12.92, -48.1}}, {'l', {.4, 46}}, {'m', {14.8, -48.5}}, + {'l', {.2, 44.1}}, {'m', {13.53, -49.6}}, {'l', {.4, 41.6}}}; QTest::newRow("Valid path6") << "M198.44 340.26l-.4 41.2m13.93-36.83l-.2 44.12m15.2-42.25l-.43 46.2m13.96-45.16l-.22 " "46.83m15.4-46.4v46.82m14.57-47.1l.2 46.8m12.92-48.1l.4 46m14.8-48.5l.2 44.1m13.53-49.6l.4 41.6" @@ -172,7 +174,7 @@ void TST_VSVGPathTokenizer::TokenizingSVGPath_data() } { - QList path = { + QList const path = { {'M', {349.56, 354.82}}, {'l', {94.5, -44.54}}, {'c', @@ -199,34 +201,34 @@ void TST_VSVGPathTokenizer::TokenizingSVGPath_data() } { - QList path = {{'M', {167, 467}}, - {'v', {-243.688}}, - {'l', {33.2998, -44.6221}}, - {'l', {100, -22.3779}}, - {'h', {100}}, - {'l', {100, 22.3779}}, - {'l', {66.7002, 44.6221}}, - {'z', {0}}, - {'M', {201, 467}}, - {'l', {-0.700195, -243.688}}, - {'l', {33.2998, -44.6221}}, - {'l', {66.7002, -22.3779}}, - {'z', {0}}, - {'M', {567, 467}}, - {'v', {-467}}, - {'z', {0}}, - {'M', {600, 467}}, - {'l', {0.299805, -467}}, - {'z', {0}}, - {'M', {67, 467}}, - {'h', {233}}, - {'z', {0}}, - {'M', {467, 467}}, - {'h', {234}}, - {'z', {0}}, - {'M', {467, 0}}, - {'h', {233.3}}, - {'z', {0}}}; + QList const path = {{'M', {167, 467}}, + {'v', {-243.688}}, + {'l', {33.2998, -44.6221}}, + {'l', {100, -22.3779}}, + {'h', {100}}, + {'l', {100, 22.3779}}, + {'l', {66.7002, 44.6221}}, + {'z', {0}}, + {'M', {201, 467}}, + {'l', {-0.700195, -243.688}}, + {'l', {33.2998, -44.6221}}, + {'l', {66.7002, -22.3779}}, + {'z', {0}}, + {'M', {567, 467}}, + {'v', {-467}}, + {'z', {0}}, + {'M', {600, 467}}, + {'l', {0.299805, -467}}, + {'z', {0}}, + {'M', {67, 467}}, + {'h', {233}}, + {'z', {0}}, + {'M', {467, 467}}, + {'h', {234}}, + {'z', {0}}, + {'M', {467, 0}}, + {'h', {233.3}}, + {'z', {0}}}; QTest::newRow("Valid path7") << "M167 467v-243.688l33.2998 -44.6221l100 -22.3779h100l100 22.3779l66.7002 " "44.6221zM201 467l-0.700195 -243.688l33.2998 -44.6221l66.7002 -22.3779zM567 " "467v-467zM600 467l0.299805 -467zM67 467h233zM467 467h234zM467 0h233.3z" @@ -240,7 +242,7 @@ void TST_VSVGPathTokenizer::TokenizingSVGPath() const QFETCH(QString, path); QFETCH(QList, expectedCommands); - VSVGPathTokenizer tokenizer(path); - QList commands = tokenizer.GetCommands(); + VSVGPathTokenizer const tokenizer(path); + QList const commands = tokenizer.GetCommands(); CompareCommandLists(commands, expectedCommands); } diff --git a/src/test/ValentinaTest/tst_vtooluniondetails.cpp b/src/test/ValentinaTest/tst_vtooluniondetails.cpp index eaea28e15..e414d7ee7 100644 --- a/src/test/ValentinaTest/tst_vtooluniondetails.cpp +++ b/src/test/ValentinaTest/tst_vtooluniondetails.cpp @@ -58,18 +58,18 @@ void TST_VToolUnionDetails::TestUnitingMainPaths_data() QTest::addColumn("pRotate"); QTest::addColumn>("result"); - VPieceNode d1p0(1205, Tool::NodePoint); - VPieceNode d1p1(1206, Tool::NodePoint); - VPieceNode d1p2(1207, Tool::NodeSpline); - VPieceNode d1p3(1208, Tool::NodePoint); - VPieceNode d1p4(1209, Tool::NodePoint); - VPieceNode d1p5(1204, Tool::NodeSpline); + VPieceNode const d1p0(1205, Tool::NodePoint); + VPieceNode const d1p1(1206, Tool::NodePoint); + VPieceNode const d1p2(1207, Tool::NodeSpline); + VPieceNode const d1p3(1208, Tool::NodePoint); + VPieceNode const d1p4(1209, Tool::NodePoint); + VPieceNode const d1p5(1204, Tool::NodeSpline); - VPieceNode d2p0(1211, Tool::NodePoint); - VPieceNode d2p1(1212, Tool::NodePoint); - VPieceNode d2p2(1213, Tool::NodeSpline); - VPieceNode d2p3(1214, Tool::NodePoint); - VPieceNode d2p4(1215, Tool::NodePoint); + VPieceNode const d2p0(1211, Tool::NodePoint); + VPieceNode const d2p1(1212, Tool::NodePoint); + VPieceNode const d2p2(1213, Tool::NodeSpline); + VPieceNode const d2p3(1214, Tool::NodePoint); + VPieceNode const d2p4(1215, Tool::NodePoint); QVector result; result.append(qMakePair(true, d1p0)); @@ -98,8 +98,8 @@ void TST_VToolUnionDetails::TestUnitingMainPaths_data() d2.Append(d2p3); d2.Append(d2p4); - quint32 indexD2 = 0; - quint32 pRotate = 1208; + quint32 const indexD2 = 0; + quint32 const pRotate = 1208; // See the file /src/app/share/collection/Issue_#752.val QTest::newRow("Case 1") << d1 << d2 << indexD2 << pRotate << result; diff --git a/src/test/ValentinaTest/tst_vtranslatevars.cpp b/src/test/ValentinaTest/tst_vtranslatevars.cpp index 75922440d..958ce8388 100644 --- a/src/test/ValentinaTest/tst_vtranslatevars.cpp +++ b/src/test/ValentinaTest/tst_vtranslatevars.cpp @@ -167,7 +167,7 @@ void TST_VTranslateVars::PrepareVal(const QString &inputFormula, const QString & auto PREPARE_CASE = [locale](const QString &inputString, const QString &outputString) { - QString tag = QStringLiteral("%1. String '%2'").arg(locale.name(), inputString); + QString const tag = QStringLiteral("%1. String '%2'").arg(locale.name(), inputString); QTest::newRow(qUtf8Printable(tag)) << inputString << outputString << locale; }; diff --git a/src/test/ValentinaTest/tst_xsdschema.cpp b/src/test/ValentinaTest/tst_xsdschema.cpp index 777a19fe9..1c825fcf8 100644 --- a/src/test/ValentinaTest/tst_xsdschema.cpp +++ b/src/test/ValentinaTest/tst_xsdschema.cpp @@ -69,7 +69,7 @@ void ValidateSchema(const QString &schema) const char *schemaData = data.constData(); const auto schemaSize = static_cast(data.size()); - QScopedPointer grammarSource(new XERCES_CPP_NAMESPACE::MemBufInputSource( + QScopedPointer const grammarSource(new XERCES_CPP_NAMESPACE::MemBufInputSource( reinterpret_cast(schemaData), schemaSize, "schema")); if (domParser.loadGrammar(*grammarSource, XERCES_CPP_NAMESPACE::Grammar::SchemaGrammarType, true) == nullptr) @@ -131,7 +131,7 @@ void TST_XSDShema::TestPatternSchema_data() auto i = schemas.constBegin(); while (i != schemas.constEnd()) { - QFileInfo f(i.value()); + QFileInfo const f(i.value()); QTest::newRow(qUtf8Printable(f.fileName())) << i.value(); ++i; } @@ -155,7 +155,7 @@ void TST_XSDShema::TestPatternLabelSchema_data() auto i = schemas.constBegin(); while (i != schemas.constEnd()) { - QFileInfo f(i.value()); + QFileInfo const f(i.value()); QTest::newRow(qUtf8Printable(f.fileName())) << i.value(); ++i; } @@ -179,7 +179,7 @@ void TST_XSDShema::TestLayoutSchema_data() auto i = schemas.constBegin(); while (i != schemas.constEnd()) { - QFileInfo f(i.value()); + QFileInfo const f(i.value()); QTest::newRow(qUtf8Printable(f.fileName())) << i.value(); ++i; } @@ -203,7 +203,7 @@ void TST_XSDShema::TestVITSchema_data() auto i = schemas.constBegin(); while (i != schemas.constEnd()) { - QFileInfo f(i.value()); + QFileInfo const f(i.value()); QTest::newRow(qUtf8Printable(f.fileName())) << i.value(); ++i; } @@ -227,7 +227,7 @@ void TST_XSDShema::TestVSTSchema_data() auto i = schemas.constBegin(); while (i != schemas.constEnd()) { - QFileInfo f(i.value()); + QFileInfo const f(i.value()); QTest::newRow(qUtf8Printable(f.fileName())) << i.value(); ++i; } @@ -251,7 +251,7 @@ void TST_XSDShema::TestWatermarkSchema_data() auto i = schemas.constBegin(); while (i != schemas.constEnd()) { - QFileInfo f(i.value()); + QFileInfo const f(i.value()); QTest::newRow(qUtf8Printable(f.fileName())) << i.value(); ++i; }
%1: %2