Clang warnings.

This commit is contained in:
Roman Telezhynskyi 2024-01-11 16:25:31 +02:00
parent b6542e989c
commit af6b86fb97
21 changed files with 137 additions and 97 deletions

View File

@ -246,8 +246,6 @@ void DialogHistory::FillTable()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
/** /**
* @brief Record return description for record * @brief Record return description for record
* @param tool record data * @param tool record data
@ -498,13 +496,11 @@ auto DialogHistory::RecordDescription(const VToolRecord &tool, HistoryRecord rec
case Tool::InsertNode: case Tool::InsertNode:
case Tool::DuplicateDetail: case Tool::DuplicateDetail:
return record; return record;
default:
return record;
} }
return record;
} }
QT_WARNING_POP
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief InitialTable set initial option of table * @brief InitialTable set initial option of table

View File

@ -3476,8 +3476,6 @@ void MainWindow::MouseMove(const QPointF &scenePos)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
/** /**
* @brief CancelTool cancel tool. * @brief CancelTool cancel tool.
*/ */
@ -3498,6 +3496,10 @@ void MainWindow::CancelTool()
currentScene->clearSelection(); currentScene->clearSelection();
emit ui->view->itemClicked(nullptr); // Hide visualization to avoid a crash emit ui->view->itemClicked(nullptr); // Hide visualization to avoid a crash
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (m_currentTool) switch (m_currentTool)
{ {
case Tool::Arrow: case Tool::Arrow:
@ -3667,6 +3669,8 @@ void MainWindow::CancelTool()
break; break;
} }
QT_WARNING_POP
// Crash: using CRTL+Z while using line tool. // Crash: using CRTL+Z while using line tool.
// related bug report: // related bug report:
// https://bitbucket.org/dismine/valentina/issues/454/crash-using-crtl-z-while-using-line-tool // https://bitbucket.org/dismine/valentina/issues/454/crash-using-crtl-z-while-using-line-tool
@ -3739,8 +3743,6 @@ void MainWindow::SetupDrawToolsIcons()
ui->actionArcEndPointTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("arc_end.png"))); ui->actionArcEndPointTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("arc_end.png")));
} }
QT_WARNING_POP
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief ArrowTool enable arrow tool. * @brief ArrowTool enable arrow tool.
@ -5477,6 +5479,8 @@ void MainWindow::SetEnableTool(bool enable)
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (VAbstractValApplication::VApp()->GetDrawMode()) switch (VAbstractValApplication::VApp()->GetDrawMode())
{ {
case Draw::Calculation: case Draw::Calculation:
@ -5489,6 +5493,7 @@ void MainWindow::SetEnableTool(bool enable)
layoutTools = enable; layoutTools = enable;
break; break;
} }
QT_WARNING_POP QT_WARNING_POP
// This check helps to find missed tools // This check helps to find missed tools
@ -5837,8 +5842,6 @@ void MainWindow::CreateMenus()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
void MainWindow::LastUsedTool() void MainWindow::LastUsedTool()
{ {
// This check helps to find missed tools in the switch // This check helps to find missed tools in the switch
@ -5849,6 +5852,10 @@ void MainWindow::LastUsedTool()
return; return;
} }
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (m_lastUsedTool) switch (m_lastUsedTool)
{ {
case Tool::Arrow: case Tool::Arrow:
@ -6055,9 +6062,9 @@ void MainWindow::LastUsedTool()
ToolArcEnd(true); ToolArcEnd(true);
break; break;
} }
}
QT_WARNING_POP QT_WARNING_POP
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void MainWindow::AddDocks() void MainWindow::AddDocks()

View File

@ -4591,9 +4591,6 @@ void VPattern::DrawToolsCommonAttributes(const QDomElement &domElement, quint32
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
auto VPattern::ActiveDrawBoundingRect() const -> QRectF auto VPattern::ActiveDrawBoundingRect() const -> QRectF
{ {
// This check helps to find missed tools in the switch // This check helps to find missed tools in the switch
@ -4601,9 +4598,8 @@ auto VPattern::ActiveDrawBoundingRect() const -> QRectF
QRectF rec; QRectF rec;
for (qint32 i = 0; i < history.size(); ++i) for (const auto &tool : history)
{ {
const VToolRecord tool = history.at(i);
if (tool.getNameDraw() == nameActivPP) if (tool.getNameDraw() == nameActivPP)
{ {
switch (tool.getTypeTool()) switch (tool.getTypeTool())
@ -4685,6 +4681,7 @@ auto VPattern::ActiveDrawBoundingRect() const -> QRectF
case Tool::InsertNode: case Tool::InsertNode:
case Tool::PlaceLabel: case Tool::PlaceLabel:
case Tool::DuplicateDetail: case Tool::DuplicateDetail:
default:
break; break;
} }
} }
@ -4692,9 +4689,6 @@ auto VPattern::ActiveDrawBoundingRect() const -> QRectF
return rec; return rec;
} }
// cppcheck-suppress unknownMacro
QT_WARNING_POP
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
template <typename T> auto VPattern::ToolBoundingRect(const QRectF &rec, quint32 id) const -> QRectF template <typename T> auto VPattern::ToolBoundingRect(const QRectF &rec, quint32 id) const -> QRectF
{ {

View File

@ -197,9 +197,6 @@ auto LineStyleToPenStyle(const QString &typeLine) -> Qt::PenStyle
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto PenStyleToLineStyle(Qt::PenStyle penStyle) -> QString auto PenStyleToLineStyle(Qt::PenStyle penStyle) -> QString
{ {
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
switch (penStyle) switch (penStyle)
{ {
case Qt::NoPen: case Qt::NoPen:
@ -216,9 +213,6 @@ auto PenStyleToLineStyle(Qt::PenStyle penStyle) -> QString
break; break;
} }
// cppcheck-suppress unknownMacro
QT_WARNING_POP
return TypeLineLine; return TypeLineLine;
} }

View File

@ -685,10 +685,11 @@ auto DRW_MText::parseCode(int code, const std::unique_ptr<dxfReader> &reader) ->
case 71: case 71:
{ {
// Attachment point // Attachment point
Attach a = static_cast<Attach>(reader->getInt32()); auto a = static_cast<Attach>(reader->getInt32());
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (a) switch (a)
{ {

View File

@ -3563,6 +3563,7 @@ auto dxfRW::processDimension() -> bool
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (type) switch (type)
{ {

View File

@ -742,9 +742,6 @@ auto VDxfEngine::ErrorString() const -> QString
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
auto VDxfEngine::FromPixel(double pix, const VarInsunits &unit) const -> double auto VDxfEngine::FromPixel(double pix, const VarInsunits &unit) const -> double
{ {
switch (unit) switch (unit)
@ -755,8 +752,9 @@ auto VDxfEngine::FromPixel(double pix, const VarInsunits &unit) const -> double
return pix / m_resolution * 25.4 / 10.0; return pix / m_resolution * 25.4 / 10.0;
case VarInsunits::Inches: case VarInsunits::Inches:
return pix / m_resolution; return pix / m_resolution;
default:
return pix;
} }
return pix;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -770,12 +768,11 @@ auto VDxfEngine::ToPixel(double val, const VarInsunits &unit) const -> double
return ((val * 10.0) / 25.4) * m_resolution; return ((val * 10.0) / 25.4) * m_resolution;
case VarInsunits::Inches: case VarInsunits::Inches:
return val * m_resolution; return val * m_resolution;
default:
return val;
} }
return val;
} }
QT_WARNING_POP
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VDxfEngine::ExportToAAMA(const QVector<VLayoutPiece> &details) -> bool auto VDxfEngine::ExportToAAMA(const QVector<VLayoutPiece> &details) -> bool
{ {

View File

@ -359,6 +359,8 @@ auto VPatternRecipe::Step(const VToolRecord &tool, const VContainer &data) -> QD
{ {
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (tool.getTypeTool()) switch (tool.getTypeTool())
{ {
case Tool::Arrow: case Tool::Arrow:
@ -461,8 +463,9 @@ auto VPatternRecipe::Step(const VToolRecord &tool, const VContainer &data) -> QD
case Tool::PlaceLabel: case Tool::PlaceLabel:
case Tool::InsertNode: case Tool::InsertNode:
case Tool::DuplicateDetail: case Tool::DuplicateDetail:
return QDomElement(); return {};
} }
QT_WARNING_POP QT_WARNING_POP
} }
catch (const VExceptionBadId &e) catch (const VExceptionBadId &e)
@ -1249,6 +1252,8 @@ auto VPatternRecipe::GroupOperationSource(VAbstractOperation *tool, quint32 id,
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (static_cast<GOType>(obj->getType())) switch (static_cast<GOType>(obj->getType()))
{ {
case GOType::Point: case GOType::Point:
@ -1273,6 +1278,7 @@ auto VPatternRecipe::GroupOperationSource(VAbstractOperation *tool, quint32 id,
Q_UNREACHABLE(); Q_UNREACHABLE();
break; break;
} }
QT_WARNING_POP QT_WARNING_POP
nodes.appendChild(node); nodes.appendChild(node);

View File

@ -1119,6 +1119,8 @@ auto VAbstractPiece::Equidistant(QVector<VSAPoint> points, qreal width, const QS
{ {
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
// This check helps to find missed angle types in the switch // This check helps to find missed angle types in the switch
Q_STATIC_ASSERT_X(static_cast<int>(PieceNodeAngle::LAST_ONE_DO_NOT_USE) == 7, "Not all types were handled."); Q_STATIC_ASSERT_X(static_cast<int>(PieceNodeAngle::LAST_ONE_DO_NOT_USE) == 7, "Not all types were handled.");
switch (points.constLast().GetAngleType()) switch (points.constLast().GetAngleType())
@ -1144,6 +1146,7 @@ auto VAbstractPiece::Equidistant(QVector<VSAPoint> points, qreal width, const QS
RollbackBySecondEdgeRightAngle(ekvPoints, points, width); RollbackBySecondEdgeRightAngle(ekvPoints, points, width);
break; break;
} }
QT_WARNING_POP QT_WARNING_POP
} }
@ -1307,6 +1310,8 @@ auto VAbstractPiece::EkvPoint(QVector<VRawSAPoint> points, const VSAPoint &p1Lin
{ // Regular equdistant case { // Regular equdistant case
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
// This check helps to find missed angle types in the switch // This check helps to find missed angle types in the switch
Q_STATIC_ASSERT_X(static_cast<int>(PieceNodeAngle::LAST_ONE_DO_NOT_USE) == 7, Q_STATIC_ASSERT_X(static_cast<int>(PieceNodeAngle::LAST_ONE_DO_NOT_USE) == 7,
"Not all types were handled."); "Not all types were handled.");
@ -1335,6 +1340,7 @@ auto VAbstractPiece::EkvPoint(QVector<VRawSAPoint> points, const VSAPoint &p1Lin
return AngleBySecondRightAngle(points, p1Line1, p2Line1, p1Line2, bigLine1, crosPoint, bigLine2, return AngleBySecondRightAngle(points, p1Line1, p2Line1, p1Line2, bigLine1, crosPoint, bigLine2,
p2Line1, width, needRollback); p2Line1, width, needRollback);
} }
QT_WARNING_POP QT_WARNING_POP
} }
else else

View File

@ -689,8 +689,6 @@ auto LineColor(const QColor &borderColor, int size, const QString &color) -> QIc
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
auto SegmentAliases(GOType curveType, const QString &alias1, const QString &alias2) -> QPair<QString, QString> auto SegmentAliases(GOType curveType, const QString &alias1, const QString &alias2) -> QPair<QString, QString>
{ {
switch (curveType) switch (curveType)
@ -712,11 +710,10 @@ auto SegmentAliases(GOType curveType, const QString &alias1, const QString &alia
case GOType::Unknown: case GOType::Unknown:
Q_UNREACHABLE(); Q_UNREACHABLE();
break; break;
default:
return {};
} }
return {};
} }
QT_WARNING_POP
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto GetNodeName(const VContainer *data, const VPieceNode &node, bool showPassmarkDetails) -> QString auto GetNodeName(const VContainer *data, const VPieceNode &node, bool showPassmarkDetails) -> QString

View File

@ -384,6 +384,8 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos)
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (selectedOption) switch (selectedOption)
{ {
case ContextMenuOption::NoSelection: case ContextMenuOption::NoSelection:
@ -448,6 +450,7 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos)
Q_UNREACHABLE(); Q_UNREACHABLE();
break; break;
}; };
QT_WARNING_POP QT_WARNING_POP
ValidObjects(PathIsValid()); ValidObjects(PathIsValid());

View File

@ -796,7 +796,7 @@ void DialogSeamAllowance::InitFold(const VPiece &piece)
} }
{ {
const qint32 indexSize = uiTabFoldLine->comboBoxLabelFontSize->findData(piece.GetFoldLineSvgFontSize()); const qint32 indexSize = uiTabFoldLine->comboBoxLabelFontSize->findData(piece.GetFoldLineSvgFontSize());
if (indexSize != -1) if (indexSize != -1)
{ {
uiTabFoldLine->comboBoxLabelFontSize->setCurrentIndex(indexSize); uiTabFoldLine->comboBoxLabelFontSize->setCurrentIndex(indexSize);
@ -1114,6 +1114,8 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos)
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (selectedOption) switch (selectedOption)
{ {
case MainPathContextMenuOption::NoSelection: case MainPathContextMenuOption::NoSelection:
@ -1178,6 +1180,7 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos)
Q_UNREACHABLE(); Q_UNREACHABLE();
break; break;
}; };
QT_WARNING_POP QT_WARNING_POP
ValidObjects(MainPathIsValid()); ValidObjects(MainPathIsValid());
@ -1847,6 +1850,8 @@ void DialogSeamAllowance::FancyTabChanged(int index)
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (index) // NOLINT(hicpp-multiway-paths-covered) switch (index) // NOLINT(hicpp-multiway-paths-covered)
{ {
case TabOrder::Paths: case TabOrder::Paths:
@ -1874,6 +1879,7 @@ void DialogSeamAllowance::FancyTabChanged(int index)
Q_UNREACHABLE(); Q_UNREACHABLE();
break; break;
} }
QT_WARNING_POP QT_WARNING_POP
if (index == TabOrder::Pins || index == TabOrder::Grainline || if (index == TabOrder::Pins || index == TabOrder::Grainline ||

View File

@ -29,9 +29,9 @@
#include "vabstractflipping.h" #include "vabstractflipping.h"
#include "../vgeometry/vabstractcurve.h" #include "../vgeometry/vabstractcurve.h"
#include "../vgeometry/varc.h" #include "../vgeometry/varc.h"
#include "../vgeometry/vellipticalarc.h"
#include "../vgeometry/vcubicbezier.h" #include "../vgeometry/vcubicbezier.h"
#include "../vgeometry/vcubicbezierpath.h" #include "../vgeometry/vcubicbezierpath.h"
#include "../vgeometry/vellipticalarc.h"
#include "../vgeometry/vgobject.h" #include "../vgeometry/vgobject.h"
#include "../vgeometry/vpointf.h" #include "../vgeometry/vpointf.h"
#include "../vgeometry/vspline.h" #include "../vgeometry/vspline.h"
@ -39,8 +39,9 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractFlipping::VAbstractFlipping(const VAbstractOperationInitData &initData, QGraphicsItem *parent) VAbstractFlipping::VAbstractFlipping(const VAbstractOperationInitData &initData, QGraphicsItem *parent)
: VAbstractOperation(initData, parent) : VAbstractOperation(initData, parent)
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VAbstractFlipping::CreateDestination(VAbstractOperationInitData &initData, const QPointF &fPoint, void VAbstractFlipping::CreateDestination(VAbstractOperationInitData &initData, const QPointF &fPoint,
@ -48,9 +49,9 @@ void VAbstractFlipping::CreateDestination(VAbstractOperationInitData &initData,
{ {
if (initData.typeCreation == Source::FromGui) if (initData.typeCreation == Source::FromGui)
{ {
initData.destination.clear();// Try to avoid mistake, value must be empty initData.destination.clear(); // Try to avoid mistake, value must be empty
initData.id = initData.data->getNextId();//Just reserve id for tool initData.id = initData.data->getNextId(); // Just reserve id for tool
for (auto object : qAsConst(initData.source)) for (auto object : qAsConst(initData.source))
{ {
@ -59,46 +60,47 @@ void VAbstractFlipping::CreateDestination(VAbstractOperationInitData &initData,
// This check helps to find missed objects in the switch // This check helps to find missed objects in the switch
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects were handled."); Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects were handled.");
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_DISABLE_GCC("-Wswitch-default")
switch(static_cast<GOType>(obj->getType())) QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (static_cast<GOType>(obj->getType()))
{ {
case GOType::Point: case GOType::Point:
initData.destination.append(CreatePoint(initData.id, object, fPoint, sPoint, initData.suffix, initData.destination.append(
initData.data)); CreatePoint(initData.id, object, fPoint, sPoint, initData.suffix, initData.data));
break; break;
case GOType::Arc: case GOType::Arc:
initData.destination.append(CreateArc<VArc>(initData.id, object, fPoint, sPoint, initData.suffix, initData.destination.append(
initData.data)); CreateArc<VArc>(initData.id, object, fPoint, sPoint, initData.suffix, initData.data));
break; break;
case GOType::EllipticalArc: case GOType::EllipticalArc:
initData.destination.append(CreateArc<VEllipticalArc>(initData.id, object, fPoint, sPoint, initData.destination.append(
initData.suffix, initData.data)); CreateArc<VEllipticalArc>(initData.id, object, fPoint, sPoint, initData.suffix, initData.data));
break; break;
case GOType::Spline: case GOType::Spline:
initData.destination.append(CreateCurve<VSpline>(initData.id, object, fPoint, sPoint, initData.destination.append(
initData.suffix, initData.data)); CreateCurve<VSpline>(initData.id, object, fPoint, sPoint, initData.suffix, initData.data));
break; break;
case GOType::SplinePath: case GOType::SplinePath:
initData.destination.append(CreateCurveWithSegments<VSplinePath>(initData.id, object, fPoint, initData.destination.append(CreateCurveWithSegments<VSplinePath>(
sPoint, initData.suffix, initData.id, object, fPoint, sPoint, initData.suffix, initData.data));
initData.data));
break; break;
case GOType::CubicBezier: case GOType::CubicBezier:
initData.destination.append(CreateCurve<VCubicBezier>(initData.id, object, fPoint, sPoint, initData.destination.append(
initData.suffix, initData.data)); CreateCurve<VCubicBezier>(initData.id, object, fPoint, sPoint, initData.suffix, initData.data));
break; break;
case GOType::CubicBezierPath: case GOType::CubicBezierPath:
initData.destination.append(CreateCurveWithSegments<VCubicBezierPath>(initData.id, object, fPoint, initData.destination.append(CreateCurveWithSegments<VCubicBezierPath>(
sPoint, initData.suffix, initData.id, object, fPoint, sPoint, initData.suffix, initData.data));
initData.data));
break; break;
case GOType::Unknown: case GOType::Unknown:
case GOType::PlaceLabel: case GOType::PlaceLabel:
Q_UNREACHABLE(); Q_UNREACHABLE();
break; break;
} }
QT_WARNING_POP
QT_WARNING_POP
} }
} }
else else
@ -111,9 +113,11 @@ QT_WARNING_POP
// This check helps to find missed objects in the switch // This check helps to find missed objects in the switch
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects were handled."); Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects were handled.");
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_DISABLE_GCC("-Wswitch-default")
switch(static_cast<GOType>(obj->getType())) QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (static_cast<GOType>(obj->getType()))
{ {
case GOType::Point: case GOType::Point:
{ {
@ -150,7 +154,8 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
Q_UNREACHABLE(); Q_UNREACHABLE();
break; break;
} }
QT_WARNING_POP
QT_WARNING_POP
} }
if (initData.parse != Document::FullParse) if (initData.parse != Document::FullParse)
{ {

View File

@ -888,6 +888,8 @@ void VAbstractOperation::InitOperatedObjects()
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (static_cast<GOType>(obj->getType())) switch (static_cast<GOType>(obj->getType()))
{ {
case GOType::Point: case GOType::Point:
@ -926,6 +928,7 @@ void VAbstractOperation::InitOperatedObjects()
Q_UNREACHABLE(); Q_UNREACHABLE();
break; break;
} }
QT_WARNING_POP QT_WARNING_POP
} }
} }

View File

@ -70,8 +70,6 @@ const QString VToolMove::ToolType = QStringLiteral("moving");
namespace namespace
{ {
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
auto GetOriginPoint(const QVector<SourceItem> &objects, const VContainer *data, qreal calcLength, qreal calcAngle) auto GetOriginPoint(const QVector<SourceItem> &objects, const VContainer *data, qreal calcLength, qreal calcAngle)
-> QPointF -> QPointF
{ {
@ -101,6 +99,8 @@ auto GetOriginPoint(const QVector<SourceItem> &objects, const VContainer *data,
case GOType::PlaceLabel: case GOType::PlaceLabel:
Q_UNREACHABLE(); Q_UNREACHABLE();
break; break;
default:
break;
} }
} }
@ -109,7 +109,6 @@ auto GetOriginPoint(const QVector<SourceItem> &objects, const VContainer *data,
move.setAngle(calcAngle); move.setAngle(calcAngle);
return move.p2(); return move.p2();
} }
QT_WARNING_POP
} // namespace } // namespace
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -202,6 +201,8 @@ auto VToolMove::Create(VToolMoveInitData &initData) -> VToolMove *
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (static_cast<GOType>(obj->getType())) switch (static_cast<GOType>(obj->getType()))
{ {
case GOType::Point: case GOType::Point:
@ -244,6 +245,7 @@ auto VToolMove::Create(VToolMoveInitData &initData) -> VToolMove *
Q_UNREACHABLE(); Q_UNREACHABLE();
break; break;
} }
QT_WARNING_POP QT_WARNING_POP
} }
} }
@ -259,6 +261,8 @@ auto VToolMove::Create(VToolMoveInitData &initData) -> VToolMove *
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (static_cast<GOType>(obj->getType())) switch (static_cast<GOType>(obj->getType()))
{ {
case GOType::Point: case GOType::Point:
@ -298,6 +302,7 @@ auto VToolMove::Create(VToolMoveInitData &initData) -> VToolMove *
Q_UNREACHABLE(); Q_UNREACHABLE();
break; break;
} }
QT_WARNING_POP QT_WARNING_POP
} }
if (initData.parse != Document::FullParse) if (initData.parse != Document::FullParse)

View File

@ -152,6 +152,8 @@ auto VToolRotation::Create(VToolRotationInitData &initData) -> VToolRotation *
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (static_cast<GOType>(obj->getType())) switch (static_cast<GOType>(obj->getType()))
{ {
case GOType::Point: case GOType::Point:
@ -187,6 +189,7 @@ auto VToolRotation::Create(VToolRotationInitData &initData) -> VToolRotation *
Q_UNREACHABLE(); Q_UNREACHABLE();
break; break;
} }
QT_WARNING_POP QT_WARNING_POP
} }
} }
@ -202,6 +205,8 @@ auto VToolRotation::Create(VToolRotationInitData &initData) -> VToolRotation *
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (static_cast<GOType>(obj->getType())) switch (static_cast<GOType>(obj->getType()))
{ {
case GOType::Point: case GOType::Point:
@ -239,6 +244,7 @@ auto VToolRotation::Create(VToolRotationInitData &initData) -> VToolRotation *
Q_UNREACHABLE(); Q_UNREACHABLE();
break; break;
} }
QT_WARNING_POP QT_WARNING_POP
} }
if (initData.parse != Document::FullParse) if (initData.parse != Document::FullParse)

View File

@ -390,12 +390,15 @@ void VToolSinglePoint::ToolSelectionType(const SelectionType &type)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
auto VToolSinglePoint::InitSegments(GOType curveType, qreal segLength, const VPointF *p, quint32 curveId, auto VToolSinglePoint::InitSegments(GOType curveType, qreal segLength, const VPointF *p, quint32 curveId,
VContainer *data, const QString &alias1, const QString &alias2) VContainer *data, const QString &alias1, const QString &alias2)
-> QPair<QString, QString> -> QPair<QString, QString>
{ {
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (curveType) switch (curveType)
{ {
case GOType::EllipticalArc: case GOType::EllipticalArc:
@ -518,7 +521,7 @@ auto VToolSinglePoint::InitSegments(GOType curveType, qreal segLength, const VPo
break; break;
} }
QT_WARNING_POP
return {}; return {};
} }
QT_WARNING_POP

View File

@ -591,6 +591,8 @@ void VNodePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (selectedOption) switch (selectedOption)
{ {
case ContextMenuOption::LAST_ONE_DO_NOT_USE: case ContextMenuOption::LAST_ONE_DO_NOT_USE:
@ -709,6 +711,7 @@ void VNodePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
SelectPassmarkLine(PassmarkLineType::CheckMark); SelectPassmarkLine(PassmarkLineType::CheckMark);
break; break;
}; };
QT_WARNING_POP QT_WARNING_POP
} }

View File

@ -83,8 +83,7 @@ auto VisOperation::GetCurve(quint32 i, VColorRole role) -> VCurvePathItem *
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
void VisOperation::RefreshFlippedObjects(quint32 originPointId, const QPointF &firstPoint, const QPointF &secondPoint) void VisOperation::RefreshFlippedObjects(quint32 originPointId, const QPointF &firstPoint, const QPointF &secondPoint)
{ {
int iPoint = -1; int iPoint = -1;
@ -96,6 +95,10 @@ void VisOperation::RefreshFlippedObjects(quint32 originPointId, const QPointF &f
// This check helps to find missed objects in the switch // This check helps to find missed objects in the switch
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects were handled."); Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects were handled.");
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (static_cast<GOType>(obj->getType())) switch (static_cast<GOType>(obj->getType()))
{ {
case GOType::Point: case GOType::Point:
@ -150,6 +153,7 @@ void VisOperation::RefreshFlippedObjects(quint32 originPointId, const QPointF &f
Q_UNREACHABLE(); Q_UNREACHABLE();
break; break;
} }
QT_WARNING_POP
} }
} }
QT_WARNING_POP

View File

@ -280,9 +280,6 @@ auto VisToolMove::GetOriginPoint(const QVector<QGraphicsItem *> &objects) -> QPo
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
auto VisToolMove::CreateOriginObjects(int &iPoint, int &iCurve) -> QVector<QGraphicsItem *> auto VisToolMove::CreateOriginObjects(int &iPoint, int &iCurve) -> QVector<QGraphicsItem *>
{ {
QVector<QGraphicsItem *> originObjects; QVector<QGraphicsItem *> originObjects;
@ -295,6 +292,10 @@ auto VisToolMove::CreateOriginObjects(int &iPoint, int &iCurve) -> QVector<QGrap
// This check helps to find missed objects in the switch // This check helps to find missed objects in the switch
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects were handled."); Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects were handled.");
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (static_cast<GOType>(obj->getType())) switch (static_cast<GOType>(obj->getType()))
{ {
case GOType::Point: case GOType::Point:
@ -331,17 +332,14 @@ auto VisToolMove::CreateOriginObjects(int &iPoint, int &iCurve) -> QVector<QGrap
Q_UNREACHABLE(); Q_UNREACHABLE();
break; break;
} }
QT_WARNING_POP
} }
return originObjects; return originObjects;
} }
QT_WARNING_POP
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
void VisToolMove::CreateMovedRotatedObjects(int &iPoint, int &iCurve, qreal length, qreal angle, qreal rotationAngle, void VisToolMove::CreateMovedRotatedObjects(int &iPoint, int &iCurve, qreal length, qreal angle, qreal rotationAngle,
const QPointF &rotationOrigin) const QPointF &rotationOrigin)
{ {
@ -352,6 +350,10 @@ void VisToolMove::CreateMovedRotatedObjects(int &iPoint, int &iCurve, qreal leng
// This check helps to find missed objects in the switch // This check helps to find missed objects in the switch
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects was handled."); Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects was handled.");
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (static_cast<GOType>(obj->getType())) switch (static_cast<GOType>(obj->getType()))
{ {
case GOType::Point: case GOType::Point:
@ -387,7 +389,7 @@ void VisToolMove::CreateMovedRotatedObjects(int &iPoint, int &iCurve, qreal leng
Q_UNREACHABLE(); Q_UNREACHABLE();
break; break;
} }
QT_WARNING_POP
} }
} }
QT_WARNING_POP

View File

@ -65,9 +65,6 @@ VisToolRotation::VisToolRotation(const VContainer *data, QGraphicsItem *parent)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
void VisToolRotation::RefreshGeometry() void VisToolRotation::RefreshGeometry()
{ {
if (Objects().isEmpty()) if (Objects().isEmpty())
@ -124,6 +121,10 @@ void VisToolRotation::RefreshGeometry()
// This check helps to find missed objects in the switch // This check helps to find missed objects in the switch
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects was handled."); Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects was handled.");
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_CLANG("-Wswitch-default")
switch (static_cast<GOType>(obj->getType())) switch (static_cast<GOType>(obj->getType()))
{ {
case GOType::Point: case GOType::Point:
@ -178,11 +179,11 @@ void VisToolRotation::RefreshGeometry()
Q_UNREACHABLE(); Q_UNREACHABLE();
break; break;
} }
QT_WARNING_POP
} }
} }
QT_WARNING_POP
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VisToolRotation::Angle() const -> QString auto VisToolRotation::Angle() const -> QString
{ {