diff --git a/src/app/puzzle/vpmainwindow.cpp b/src/app/puzzle/vpmainwindow.cpp index 7acf931d0..30844942d 100644 --- a/src/app/puzzle/vpmainwindow.cpp +++ b/src/app/puzzle/vpmainwindow.cpp @@ -77,6 +77,10 @@ #include "xml/vplayoutfilereader.h" #include "xml/vplayoutfilewriter.h" +#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0) +#include "../vmisc/compatibility.h" +#endif + QT_WARNING_PUSH QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes") QT_WARNING_DISABLE_INTEL(1418) @@ -86,11 +90,6 @@ Q_LOGGING_CATEGORY(pWindow, "p.window") // NOLINT QT_WARNING_POP using namespace std::chrono_literals; - -#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0) -#include "../vmisc/compatibility.h" -#endif - using namespace Qt::Literals::StringLiterals; namespace diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index a89536651..ce78c9c06 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -217,12 +217,11 @@ #include #endif // defined(Q_OS_MAC) -using namespace std::chrono_literals; - #if QT_VERSION < QT_VERSION_CHECK(6, 4, 0) #include "../vmisc/compatibility.h" #endif +using namespace std::chrono_literals; using namespace Qt::Literals::StringLiterals; QT_WARNING_PUSH @@ -4349,9 +4348,9 @@ void MainWindow::on_actionUpdateManualLayout_triggered() rldFile.setAutoRemove(false); - const QString path = VApplication::PuzzleFilePath(); - qDebug("Opening Puzzle: path = %s.", qUtf8Printable(path)); - VApplication::StartDetachedProcess(path, arguments); + const QString puzzlePath = VApplication::PuzzleFilePath(); + qDebug("Opening Puzzle: path = %s.", qUtf8Printable(puzzlePath)); + VApplication::StartDetachedProcess(puzzlePath, arguments); } else { diff --git a/src/libs/vdxf/libdxfrw/drw_entities.cpp b/src/libs/vdxf/libdxfrw/drw_entities.cpp index f5b0f1fef..3f2d59e42 100644 --- a/src/libs/vdxf/libdxfrw/drw_entities.cpp +++ b/src/libs/vdxf/libdxfrw/drw_entities.cpp @@ -580,19 +580,19 @@ auto DRW_LWPolyline::parseCode(int code, const std::unique_ptr &reade break; } case 20: - if (vertex != NULL) + if (vertex != nullptr) vertex->y = reader->getDouble(); break; case 40: - if (vertex != NULL) + if (vertex != nullptr) vertex->stawidth = reader->getDouble(); break; case 41: - if (vertex != NULL) + if (vertex != nullptr) vertex->endwidth = reader->getDouble(); break; case 42: - if (vertex != NULL) + if (vertex != nullptr) vertex->bulge = reader->getDouble(); break; case 38: @@ -1038,11 +1038,11 @@ auto DRW_Spline::parseCode(int code, const std::unique_ptr &reader) - break; } case 20: - if (controlpoint != NULL) + if (controlpoint != nullptr) controlpoint->y = reader->getDouble(); break; case 30: - if (controlpoint != NULL) + if (controlpoint != nullptr) controlpoint->z = reader->getDouble(); break; case 11: @@ -1053,11 +1053,11 @@ auto DRW_Spline::parseCode(int code, const std::unique_ptr &reader) - break; } case 21: - if (fitpoint != NULL) + if (fitpoint != nullptr) fitpoint->y = reader->getDouble(); break; case 31: - if (fitpoint != NULL) + if (fitpoint != nullptr) fitpoint->z = reader->getDouble(); break; case 40: @@ -1279,11 +1279,11 @@ auto DRW_Leader::parseCode(int code, const std::unique_ptr &reader) - break; } case 20: - if (vertexpoint != NULL) + if (vertexpoint != nullptr) vertexpoint->y = reader->getDouble(); break; case 30: - if (vertexpoint != NULL) + if (vertexpoint != nullptr) vertexpoint->z = reader->getDouble(); break; case 340: diff --git a/src/libs/vdxf/libdxfrw/libdxfrw.cpp b/src/libs/vdxf/libdxfrw/libdxfrw.cpp index 8c8a2ea9c..78287d897 100644 --- a/src/libs/vdxf/libdxfrw/libdxfrw.cpp +++ b/src/libs/vdxf/libdxfrw/libdxfrw.cpp @@ -1649,7 +1649,7 @@ auto dxfRW::writeImage(DRW_Image *ent, const std::string &name) -> DRW_ImageDef id = imageDef.at(i); } } - if (id == NULL) + if (id == nullptr) { id = new DRW_ImageDef(); imageDef.push_back(id); diff --git a/src/libs/vganalytics/vganalytics.cpp b/src/libs/vganalytics/vganalytics.cpp index b910f4f70..962e4bda2 100644 --- a/src/libs/vganalytics/vganalytics.cpp +++ b/src/libs/vganalytics/vganalytics.cpp @@ -57,12 +57,11 @@ #include #endif -using namespace std::chrono_literals; - #if QT_VERSION < QT_VERSION_CHECK(6, 4, 0) #include "../vmisc/compatibility.h" #endif +using namespace std::chrono_literals; using namespace Qt::Literals::StringLiterals; namespace diff --git a/src/libs/vgeometry/vgobject.cpp b/src/libs/vgeometry/vgobject.cpp index ce5460f52..b95f87ba1 100644 --- a/src/libs/vgeometry/vgobject.cpp +++ b/src/libs/vgeometry/vgobject.cpp @@ -386,13 +386,11 @@ auto VGObject::LineIntersectRect(const QRectF &rec, const QLineF &line) -> QPoin QLineF const leftLine(QPointF(x1, y1), QPointF(x1, y2)); QLineF const rightLine(QPointF(x2, y1), QPointF(x2, y2)); - QPointF point; - // Check intersections with each side of the rectangle - if (line.intersects(topLine, &point) == QLineF::BoundedIntersection || - line.intersects(bottomLine, &point) == QLineF::BoundedIntersection || - line.intersects(leftLine, &point) == QLineF::BoundedIntersection || - line.intersects(rightLine, &point) == QLineF::BoundedIntersection) + if (QPointF point; line.intersects(topLine, &point) == QLineF::BoundedIntersection || + line.intersects(bottomLine, &point) == QLineF::BoundedIntersection || + line.intersects(leftLine, &point) == QLineF::BoundedIntersection || + line.intersects(rightLine, &point) == QLineF::BoundedIntersection) { return point; } diff --git a/src/libs/vmisc/theme/vtheme.cpp b/src/libs/vmisc/theme/vtheme.cpp index 5c9f52df6..2d161e5fa 100644 --- a/src/libs/vmisc/theme/vtheme.cpp +++ b/src/libs/vmisc/theme/vtheme.cpp @@ -48,8 +48,6 @@ #include #endif -using namespace std::chrono_literals; - #include "../vabstractapplication.h" #include "vapplicationstyle.h" #include "vscenestylesheet.h" @@ -58,6 +56,7 @@ using namespace std::chrono_literals; #include "../compatibility.h" #endif +using namespace std::chrono_literals; using namespace Qt::Literals::StringLiterals; namespace @@ -597,8 +596,7 @@ VTheme::VTheme(QObject *parent) isProcessingColorSchemeChange = true; QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); - bool darkTheme = IsInDarkTheme(); - if (m_darkTheme != darkTheme) + if (bool darkTheme = IsInDarkTheme(); m_darkTheme != darkTheme) { m_darkTheme = darkTheme; ResetThemeSettings(); diff --git a/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.h b/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.h index f5573383a..56c108fde 100644 --- a/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.h +++ b/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.h @@ -109,7 +109,7 @@ public: //! \param container If a property is being passed here, no new VProperty is being created but instead it is tried //! to fill all the data into container. This can also be used when subclassing this function. //! \return Returns the newly created property (or container, if it was not NULL) - virtual auto clone(bool include_children = true, VProperty *container = NULL) const -> VProperty * override; + virtual auto clone(bool include_children = true, VProperty *container = nullptr) const -> VProperty * override; //! Sets the value of the property virtual void setValue(const QVariant &value) override; diff --git a/src/libs/vpropertyexplorer/plugins/vboolproperty.h b/src/libs/vpropertyexplorer/plugins/vboolproperty.h index de97e820c..aa5b80eeb 100644 --- a/src/libs/vpropertyexplorer/plugins/vboolproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vboolproperty.h @@ -80,7 +80,7 @@ public: //! \param container If a property is being passed here, no new VProperty is being created but instead it is tried //! to fill all the data into container. This can also be used when subclassing this function. //! \return Returns the newly created property (or container, if it was not NULL) - auto clone(bool include_children = true, VProperty *container = NULL) const -> VProperty * override; + auto clone(bool include_children = true, VProperty *container = nullptr) const -> VProperty * override; public slots: void StateChanged(); diff --git a/src/libs/vpropertyexplorer/plugins/vcolorproperty.h b/src/libs/vpropertyexplorer/plugins/vcolorproperty.h index ade990639..4e4a63bea 100644 --- a/src/libs/vpropertyexplorer/plugins/vcolorproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vcolorproperty.h @@ -70,7 +70,7 @@ public: //! \param container If a property is being passed here, no new VProperty is being created but instead it is tried //! to fill all the data into container. This can also be used when subclassing this function. //! \return Returns the newly created property (or container, if it was not NULL) - virtual auto clone(bool include_children = true, VProperty *container = NULL) const -> VProperty * override; + virtual auto clone(bool include_children = true, VProperty *container = nullptr) const -> VProperty * override; private: Q_DISABLE_COPY_MOVE(VColorProperty) // NOLINT diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp index 911a3170a..755f615b3 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp @@ -743,9 +743,8 @@ auto DialogSeamAllowance::GetMirrorLineEndPoint() const -> quint32 nextIndex = 0; } - const int next = FindNotExcludedNeighborNodeDown(uiTabPaths->listWidgetMainPath, nextIndex); - - if (next >= 0 && RowNode(uiTabPaths->listWidgetMainPath, next).GetId() == startPoint) + if (const int next = FindNotExcludedNeighborNodeDown(uiTabPaths->listWidgetMainPath, nextIndex); + next >= 0 && RowNode(uiTabPaths->listWidgetMainPath, next).GetId() == startPoint) { return startPoint; } diff --git a/src/libs/vwidgets/vlineedit.cpp b/src/libs/vwidgets/vlineedit.cpp index 387670967..504b2d626 100644 --- a/src/libs/vwidgets/vlineedit.cpp +++ b/src/libs/vwidgets/vlineedit.cpp @@ -37,12 +37,11 @@ #include "../vmisc/defglobal.h" -using namespace std::chrono_literals; - #if QT_VERSION < QT_VERSION_CHECK(6, 4, 0) #include "../vmisc/compatibility.h" #endif +using namespace std::chrono_literals; using namespace Qt::Literals::StringLiterals; namespace