diff --git a/src/app/tape/dialogs/configpages/tapeconfigurationpage.h b/src/app/tape/dialogs/configpages/tapeconfigurationpage.h index c27e15ec4..e3bb02c2d 100644 --- a/src/app/tape/dialogs/configpages/tapeconfigurationpage.h +++ b/src/app/tape/dialogs/configpages/tapeconfigurationpage.h @@ -42,7 +42,7 @@ class TapeConfigurationPage : public QWidget { Q_OBJECT public: - TapeConfigurationPage(QWidget *parent = nullptr); + explicit TapeConfigurationPage(QWidget *parent = nullptr); void Apply(); public slots: void LangChanged(); diff --git a/src/app/tape/dialogs/configpages/tapepathpage.h b/src/app/tape/dialogs/configpages/tapepathpage.h index a129e841f..5d9930f21 100644 --- a/src/app/tape/dialogs/configpages/tapepathpage.h +++ b/src/app/tape/dialogs/configpages/tapepathpage.h @@ -40,7 +40,7 @@ class TapePathPage : public QWidget { Q_OBJECT public: - TapePathPage(QWidget *parent = nullptr); + explicit TapePathPage(QWidget *parent = nullptr); void Apply(); public slots: void TableActivated(); diff --git a/src/app/tape/mapplication.cpp b/src/app/tape/mapplication.cpp index 55d14480f..d24076928 100644 --- a/src/app/tape/mapplication.cpp +++ b/src/app/tape/mapplication.cpp @@ -183,6 +183,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con } //--------------------------------------------------------------------------------------------------------------------- +// cppcheck-suppress uninitMemberVar MApplication::MApplication(int &argc, char **argv) :VAbstractApplication(argc, argv), mainWindows(), diff --git a/src/app/tape/vlitepattern.h b/src/app/tape/vlitepattern.h index a540eb327..170178298 100644 --- a/src/app/tape/vlitepattern.h +++ b/src/app/tape/vlitepattern.h @@ -35,7 +35,7 @@ class VLitePattern : public VAbstractPattern { Q_OBJECT public: - VLitePattern(QObject *parent = nullptr); + explicit VLitePattern(QObject *parent = nullptr); virtual void CreateEmptyFile() Q_DECL_OVERRIDE; diff --git a/src/app/tape/vtablesearch.h b/src/app/tape/vtablesearch.h index 187f5571d..9f42a5f8e 100644 --- a/src/app/tape/vtablesearch.h +++ b/src/app/tape/vtablesearch.h @@ -35,7 +35,7 @@ class VTableSearch { public: - VTableSearch(QTableWidget *table); + explicit VTableSearch(QTableWidget *table); void Find(const QString &term); void FindPrevious(); diff --git a/src/app/valentina/core/vapplication.cpp b/src/app/valentina/core/vapplication.cpp index c5a112395..cad9af09f 100644 --- a/src/app/valentina/core/vapplication.cpp +++ b/src/app/valentina/core/vapplication.cpp @@ -581,7 +581,9 @@ QStringList VApplication::LabelLanguages() void VApplication::StartLogging() { CreateLogDir(); + // cppcheck-suppress leakReturnValNotUsed BeginLogging(); + // cppcheck-suppress leakReturnValNotUsed ClearOldLogs(); #if defined(Q_OS_WIN) && defined(Q_CC_GNU) ClearOldReports(); @@ -786,6 +788,7 @@ void VApplication::CollectReport(const QString &reportName) const reportFile.remove(); // Clear after yourself filename = QString("%1/reports/log-%2.log").arg(qApp->applicationDirPath()).arg(timestamp); + // cppcheck-suppress leakReturnValNotUsed GatherLogs(); QFile logFile(QString("%1/valentina.log").arg(LogDirPath())); logFile.copy(filename); // Collect log @@ -849,6 +852,7 @@ void VApplication::SendReport(const QString &reportName) const content.append(QString("\r\n-------------------------------\r\n")); content.append(QString("Log:")+"\r\n"); + // cppcheck-suppress leakReturnValNotUsed GatherLogs(); QFile logFile(QString("%1/valentina.log").arg(LogDirPath())); if (logFile.open(QIODevice::ReadOnly | QIODevice::Text)) diff --git a/src/app/valentina/core/vformulaproperty.h b/src/app/valentina/core/vformulaproperty.h index b5ca10648..73eb251b7 100644 --- a/src/app/valentina/core/vformulaproperty.h +++ b/src/app/valentina/core/vformulaproperty.h @@ -37,7 +37,7 @@ class VFormulaProperty : public VPE::VProperty { Q_OBJECT public: - VFormulaProperty(const QString &name); + explicit VFormulaProperty(const QString &name); //! Get the data how it should be displayed virtual QVariant data (int column = DPC_Name, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; diff --git a/src/app/valentina/core/vformulapropertyeditor.h b/src/app/valentina/core/vformulapropertyeditor.h index 2f9d73064..062d5b380 100644 --- a/src/app/valentina/core/vformulapropertyeditor.h +++ b/src/app/valentina/core/vformulapropertyeditor.h @@ -43,7 +43,7 @@ class VFormulaPropertyEditor : public QWidget public: //! Constructor taking a widget as parent - VFormulaPropertyEditor(QWidget *parent); + explicit VFormulaPropertyEditor(QWidget *parent); //! Destructor virtual ~VFormulaPropertyEditor() Q_DECL_OVERRIDE; diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.h b/src/app/valentina/core/vtooloptionspropertybrowser.h index 71c7e8f2d..cba5aef90 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.h +++ b/src/app/valentina/core/vtooloptionspropertybrowser.h @@ -45,7 +45,7 @@ class VToolOptionsPropertyBrowser : public QObject { Q_OBJECT public: - VToolOptionsPropertyBrowser(QDockWidget *parent); + explicit VToolOptionsPropertyBrowser(QDockWidget *parent); void ClearPropertyBrowser(); public slots: void itemClicked(QGraphicsItem *item); diff --git a/src/app/valentina/dialogs/configpages/communitypage.h b/src/app/valentina/dialogs/configpages/communitypage.h index 532b0e520..8d98bf75f 100644 --- a/src/app/valentina/dialogs/configpages/communitypage.h +++ b/src/app/valentina/dialogs/configpages/communitypage.h @@ -41,7 +41,7 @@ class CommunityPage : public QWidget { Q_OBJECT public: - CommunityPage(QWidget *parent = nullptr); + explicit CommunityPage(QWidget *parent = nullptr); void Apply(); private: Q_DISABLE_COPY(CommunityPage) diff --git a/src/app/valentina/dialogs/configpages/configurationpage.h b/src/app/valentina/dialogs/configpages/configurationpage.h index 8fdedf410..3b79b97c2 100644 --- a/src/app/valentina/dialogs/configpages/configurationpage.h +++ b/src/app/valentina/dialogs/configpages/configurationpage.h @@ -41,7 +41,7 @@ class ConfigurationPage : public QWidget { Q_OBJECT public: - ConfigurationPage(QWidget *parent = nullptr); + explicit ConfigurationPage(QWidget *parent = nullptr); void Apply(); public slots: void LangChanged(); diff --git a/src/app/valentina/dialogs/configpages/pathpage.h b/src/app/valentina/dialogs/configpages/pathpage.h index f81c14b36..f050baf01 100644 --- a/src/app/valentina/dialogs/configpages/pathpage.h +++ b/src/app/valentina/dialogs/configpages/pathpage.h @@ -40,7 +40,7 @@ class PathPage : public QWidget { Q_OBJECT public: - PathPage(QWidget *parent = nullptr); + explicit PathPage(QWidget *parent = nullptr); void Apply(); public slots: void TableActivated(); diff --git a/src/app/valentina/dialogs/configpages/patternpage.h b/src/app/valentina/dialogs/configpages/patternpage.h index 2a7743b09..4af994927 100644 --- a/src/app/valentina/dialogs/configpages/patternpage.h +++ b/src/app/valentina/dialogs/configpages/patternpage.h @@ -41,7 +41,7 @@ class PatternPage : public QWidget { Q_OBJECT public: - PatternPage(QWidget *parent = nullptr); + explicit PatternPage(QWidget *parent = nullptr); void Apply(); private: Q_DISABLE_COPY(PatternPage) diff --git a/src/app/valentina/mainwindowsnogui.h b/src/app/valentina/mainwindowsnogui.h index c1d6f191b..5029db74d 100644 --- a/src/app/valentina/mainwindowsnogui.h +++ b/src/app/valentina/mainwindowsnogui.h @@ -46,7 +46,7 @@ class MainWindowsNoGUI : public QMainWindow { Q_OBJECT public: - MainWindowsNoGUI(QWidget *parent = nullptr); + explicit MainWindowsNoGUI(QWidget *parent = nullptr); virtual ~MainWindowsNoGUI() Q_DECL_OVERRIDE; public slots: diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index eab12d6c5..a5483e17d 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -906,14 +906,14 @@ void VPattern::ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement & SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - QString name; - qreal mx = 0; - qreal my = 0; - VToolBasePoint *spoint = 0; try { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + PointsCommonAttributes(domElement, id, name, mx, my); const qreal x = qApp->toPixel(GetParametrDouble(domElement, AttrX, "10.0")); const qreal y = qApp->toPixel(GetParametrDouble(domElement, AttrY, "10.0")); @@ -951,15 +951,15 @@ void VPattern::ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domEleme SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - QString name; - qreal mx = 0; - qreal my = 0; - QString typeLine; - QString lineColor; - try { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + QString typeLine; + QString lineColor; + PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor); const QString formula = GetParametrString(domElement, AttrLength, "100.0"); @@ -1000,15 +1000,15 @@ void VPattern::ParseToolAlongLine(VMainGraphicsScene *scene, QDomElement &domEle SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - QString name; - qreal mx = 0; - qreal my = 0; - QString typeLine; - QString lineColor; - try { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + QString typeLine; + QString lineColor; + PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor); const QString formula = GetParametrString(domElement, AttrLength, "100.0"); QString f = formula;//need for saving fixed formula; @@ -1044,15 +1044,15 @@ void VPattern::ParseToolShoulderPoint(VMainGraphicsScene *scene, QDomElement &do SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - QString name; - qreal mx = 0; - qreal my = 0; - QString typeLine; - QString lineColor; - try { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + QString typeLine; + QString lineColor; + PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor); const QString formula = GetParametrString(domElement, AttrLength, "100.0"); QString f = formula;//need for saving fixed formula; @@ -1089,15 +1089,15 @@ void VPattern::ParseToolNormal(VMainGraphicsScene *scene, QDomElement &domElemen SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - QString name; - qreal mx = 0; - qreal my = 0; - QString typeLine; - QString lineColor; - try { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + QString typeLine; + QString lineColor; + PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor); const QString formula = GetParametrString(domElement, AttrLength, "100.0"); QString f = formula;//need for saving fixed formula; @@ -1134,15 +1134,15 @@ void VPattern::ParseToolBisector(VMainGraphicsScene *scene, QDomElement &domElem SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - QString name; - qreal mx = 0; - qreal my = 0; - QString typeLine; - QString lineColor; - try { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + QString typeLine; + QString lineColor; + PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor); const QString formula = GetParametrString(domElement, AttrLength, "100.0"); QString f = formula;//need for saving fixed formula; @@ -1179,13 +1179,13 @@ void VPattern::ParseToolLineIntersect(VMainGraphicsScene *scene, const QDomEleme SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - QString name; - qreal mx = 0; - qreal my = 0; - try { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + PointsCommonAttributes(domElement, id, name, mx, my); const quint32 p1Line1Id = GetParametrUInt(domElement, AttrP1Line1, NULL_ID_STR); const quint32 p2Line1Id = GetParametrUInt(domElement, AttrP2Line1, NULL_ID_STR); @@ -1209,13 +1209,13 @@ void VPattern::ParseToolPointOfContact(VMainGraphicsScene *scene, QDomElement &d SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - QString name; - qreal mx = 0; - qreal my = 0; - try { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + PointsCommonAttributes(domElement, id, name, mx, my); const QString radius = GetParametrString(domElement, AttrRadius, "0"); QString f = radius;//need for saving fixed formula; @@ -1251,12 +1251,12 @@ void VPattern::ParseNodePoint(const QDomElement &domElement, const Document &par { Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - qreal mx = 0; - qreal my = 0; - try { + quint32 id = 0; + qreal mx = 0; + qreal my = 0; + PointsCommonAttributes(domElement, id, mx, my); const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, NULL_ID_STR); const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, NULL_ID_STR); @@ -1279,15 +1279,15 @@ void VPattern::ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &dom SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - QString name; - qreal mx = 0; - qreal my = 0; - QString typeLine; - QString lineColor; - try { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + QString typeLine; + QString lineColor; + PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor); const quint32 basePointId = GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR); const quint32 p1LineId = GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR); @@ -1310,13 +1310,13 @@ void VPattern::ParseToolTriangle(VMainGraphicsScene *scene, const QDomElement &d SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - QString name; - qreal mx = 0; - qreal my = 0; - try { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + PointsCommonAttributes(domElement, id, name, mx, my); const quint32 axisP1Id = GetParametrUInt(domElement, AttrAxisP1, NULL_ID_STR); const quint32 axisP2Id = GetParametrUInt(domElement, AttrAxisP2, NULL_ID_STR); @@ -1341,13 +1341,13 @@ void VPattern::ParseToolPointOfIntersection(VMainGraphicsScene *scene, const QDo SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - QString name; - qreal mx = 0; - qreal my = 0; - try { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + PointsCommonAttributes(domElement, id, name, mx, my); const quint32 firstPointId = GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR); const quint32 secondPointId = GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR); @@ -1369,13 +1369,13 @@ void VPattern::ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domEle SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - QString name; - qreal mx = 0; - qreal my = 0; - try { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + PointsCommonAttributes(domElement, id, name, mx, my); const QString formula = GetParametrString(domElement, AttrLength, "0"); QString f = formula;//need for saving fixed formula; @@ -1412,13 +1412,13 @@ void VPattern::ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &do SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - QString name; - qreal mx = 0; - qreal my = 0; - try { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + PointsCommonAttributes(domElement, id, name, mx, my); const QString formula = GetParametrString(domElement, AttrLength, "0"); QString f = formula;//need for saving fixed formula; @@ -1456,13 +1456,13 @@ void VPattern::ParseToolCutArc(VMainGraphicsScene *scene, QDomElement &domElemen SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - QString name; - qreal mx = 0; - qreal my = 0; - try { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + PointsCommonAttributes(domElement, id, name, mx, my); const QString formula = GetParametrString(domElement, AttrLength, "0"); QString f = formula;//need for saving fixed formula; @@ -1498,15 +1498,15 @@ void VPattern::ParseToolLineIntersectAxis(VMainGraphicsScene *scene, QDomElement SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - QString name; - qreal mx = 0; - qreal my = 0; - QString typeLine; - QString lineColor; - try { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + QString typeLine; + QString lineColor; + PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor); const quint32 basePointId = GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR); @@ -1548,15 +1548,15 @@ void VPattern::ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElemen SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - QString name; - qreal mx = 0; - qreal my = 0; - QString typeLine; - QString lineColor; - try { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + QString typeLine; + QString lineColor; + PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor); const quint32 basePointId = GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR); @@ -1596,13 +1596,13 @@ void VPattern::ParseToolPointOfIntersectionArcs(VMainGraphicsScene *scene, const SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - QString name; - qreal mx = 0; - qreal my = 0; - try { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + PointsCommonAttributes(domElement, id, name, mx, my); const quint32 firstArcId = GetParametrUInt(domElement, AttrFirstArc, NULL_ID_STR); const quint32 secondArcId = GetParametrUInt(domElement, AttrSecondArc, NULL_ID_STR); @@ -1628,13 +1628,13 @@ void VPattern::ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QD SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - QString name; - qreal mx = 0; - qreal my = 0; - try { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + PointsCommonAttributes(domElement, id, name, mx, my); const quint32 c1CenterId = GetParametrUInt(domElement, AttrC1Center, NULL_ID_STR); const quint32 c2CenterId = GetParametrUInt(domElement, AttrC2Center, NULL_ID_STR); @@ -1670,13 +1670,13 @@ void VPattern::ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDo SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - QString name; - qreal mx = 0; - qreal my = 0; - try { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + PointsCommonAttributes(domElement, id, name, mx, my); const quint32 cCenterId = GetParametrUInt(domElement, AttrCCenter, NULL_ID_STR); const quint32 tangentId = GetParametrUInt(domElement, AttrTangent, NULL_ID_STR); @@ -1710,13 +1710,13 @@ void VPattern::ParseToolPointFromArcAndTangent(VMainGraphicsScene *scene, const SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - QString name; - qreal mx = 0; - qreal my = 0; - try { + quint32 id = 0; + QString name; + qreal mx = 0; + qreal my = 0; + PointsCommonAttributes(domElement, id, name, mx, my); const quint32 arcId = GetParametrUInt(domElement, AttrArc, NULL_ID_STR); const quint32 tangentId = GetParametrUInt(domElement, AttrTangent, NULL_ID_STR); @@ -1741,10 +1741,10 @@ void VPattern::ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement & SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - try { + quint32 id = 0; + ToolsCommonAttributes(domElement, id); const quint32 p1Id = GetParametrUInt(domElement, AttrPoint1, NULL_ID_STR); @@ -1783,10 +1783,10 @@ void VPattern::ParseToolSpline(VMainGraphicsScene *scene, const QDomElement &dom SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - try { + quint32 id = 0; + ToolsCommonAttributes(domElement, id); const quint32 point1 = GetParametrUInt(domElement, AttrPoint1, NULL_ID_STR); const quint32 point4 = GetParametrUInt(domElement, AttrPoint4, NULL_ID_STR); @@ -1814,10 +1814,10 @@ void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - try { + quint32 id = 0; + ToolsCommonAttributes(domElement, id); const qreal kCurve = GetParametrDouble(domElement, AttrKCurve, "1.0"); const QString color = GetParametrString(domElement, AttrColor, ColorBlack); @@ -1866,12 +1866,12 @@ void VPattern::ParseNodeSpline(const QDomElement &domElement, const Document &pa { Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - quint32 idObject = 0; - quint32 idTool = 0; - try { + quint32 id = 0; + quint32 idObject = 0; + quint32 idTool = 0; + SplinesCommonAttributes(domElement, id, idObject, idTool); VSpline *spl = new VSpline(*data->GeometricObject(idObject)); spl->setIdObject(idObject); @@ -1892,12 +1892,12 @@ void VPattern::ParseNodeSplinePath(const QDomElement &domElement, const Document { Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - quint32 idObject = 0; - quint32 idTool = 0; - try { + quint32 id = 0; + quint32 idObject = 0; + quint32 idTool = 0; + SplinesCommonAttributes(domElement, id, idObject, idTool); VSplinePath *path = new VSplinePath(*data->GeometricObject(idObject)); path->setIdObject(idObject); @@ -1919,10 +1919,10 @@ void VPattern::ParseToolArc(VMainGraphicsScene *scene, QDomElement &domElement, SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - try { + quint32 id = 0; + ToolsCommonAttributes(domElement, id); const quint32 center = GetParametrUInt(domElement, AttrCenter, NULL_ID_STR); const QString radius = GetParametrString(domElement, AttrRadius, "10"); @@ -1962,10 +1962,10 @@ void VPattern::ParseNodeArc(const QDomElement &domElement, const Document &parse { Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - try { + quint32 id = 0; + ToolsCommonAttributes(domElement, id); const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, NULL_ID_STR); const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, NULL_ID_STR); @@ -1989,10 +1989,10 @@ void VPattern::ParseToolArcWithLength(VMainGraphicsScene *scene, QDomElement &do SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - quint32 id = 0; - try { + quint32 id = 0; + ToolsCommonAttributes(domElement, id); const quint32 center = GetParametrUInt(domElement, AttrCenter, NULL_ID_STR); const QString radius = GetParametrString(domElement, AttrRadius, "10"); diff --git a/src/libs/ifc/exception/vexception.h b/src/libs/ifc/exception/vexception.h index 78db09df8..0c73fbacd 100644 --- a/src/libs/ifc/exception/vexception.h +++ b/src/libs/ifc/exception/vexception.h @@ -43,7 +43,7 @@ class VException : public QException { Q_DECLARE_TR_FUNCTIONS(VException) public: - VException(const QString &what); + explicit VException(const QString &what); VException(const VException &e); VException &operator=(const VException &e); virtual ~VException() V_NOEXCEPT_EXPR (true) Q_DECL_OVERRIDE {} diff --git a/src/libs/ifc/exception/vexceptionundo.h b/src/libs/ifc/exception/vexceptionundo.h index c8adcd8e4..c78d3c8fa 100644 --- a/src/libs/ifc/exception/vexceptionundo.h +++ b/src/libs/ifc/exception/vexceptionundo.h @@ -34,7 +34,7 @@ class VExceptionUndo : public VException { public: - VExceptionUndo(const QString &what); + explicit VExceptionUndo(const QString &what); VExceptionUndo(const VExceptionUndo &e); virtual ~VExceptionUndo() V_NOEXCEPT_EXPR (true) Q_DECL_OVERRIDE; }; diff --git a/src/libs/ifc/xml/vabstractconverter.h b/src/libs/ifc/xml/vabstractconverter.h index 4964d830a..5f8adff7e 100644 --- a/src/libs/ifc/xml/vabstractconverter.h +++ b/src/libs/ifc/xml/vabstractconverter.h @@ -35,7 +35,7 @@ class VAbstractConverter :public VDomDocument { Q_DECLARE_TR_FUNCTIONS(VAbstractConverter) public: - VAbstractConverter(const QString &fileName); + explicit VAbstractConverter(const QString &fileName); virtual ~VAbstractConverter() Q_DECL_OVERRIDE; void Convert(); diff --git a/src/libs/ifc/xml/vabstractmconverter.h b/src/libs/ifc/xml/vabstractmconverter.h index c31ff71a5..3f73b6c46 100644 --- a/src/libs/ifc/xml/vabstractmconverter.h +++ b/src/libs/ifc/xml/vabstractmconverter.h @@ -34,7 +34,7 @@ class VAbstractMConverter : public VAbstractConverter { public: - VAbstractMConverter(const QString &fileName); + explicit VAbstractMConverter(const QString &fileName); virtual ~VAbstractMConverter() Q_DECL_OVERRIDE; protected: diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h index e65a0d79c..d9cf1eb17 100644 --- a/src/libs/ifc/xml/vabstractpattern.h +++ b/src/libs/ifc/xml/vabstractpattern.h @@ -45,7 +45,7 @@ class VAbstractPattern : public QObject, public VDomDocument { Q_OBJECT public: - VAbstractPattern(QObject *parent = nullptr); + explicit VAbstractPattern(QObject *parent = nullptr); virtual ~VAbstractPattern() Q_DECL_OVERRIDE; QStringList ListMeasurements() const; diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h index 2a0c2d53b..5da3b07e1 100644 --- a/src/libs/ifc/xml/vpatternconverter.h +++ b/src/libs/ifc/xml/vpatternconverter.h @@ -35,7 +35,7 @@ class VPatternConverter : public VAbstractConverter { Q_DECLARE_TR_FUNCTIONS(VPatternConverter) public: - VPatternConverter(const QString &fileName); + explicit VPatternConverter(const QString &fileName); virtual ~VPatternConverter() Q_DECL_OVERRIDE; static const QString PatternMaxVerStr; diff --git a/src/libs/ifc/xml/vvitconverter.h b/src/libs/ifc/xml/vvitconverter.h index d3b45b0a3..83a22a92f 100644 --- a/src/libs/ifc/xml/vvitconverter.h +++ b/src/libs/ifc/xml/vvitconverter.h @@ -35,7 +35,7 @@ class VVITConverter : public VAbstractMConverter { Q_DECLARE_TR_FUNCTIONS(VVITConverter) public: - VVITConverter(const QString &fileName); + explicit VVITConverter(const QString &fileName); virtual ~VVITConverter() Q_DECL_OVERRIDE; static const QString MeasurementMaxVerStr; diff --git a/src/libs/ifc/xml/vvstconverter.h b/src/libs/ifc/xml/vvstconverter.h index 5ed54f0f1..4a0d55c49 100644 --- a/src/libs/ifc/xml/vvstconverter.h +++ b/src/libs/ifc/xml/vvstconverter.h @@ -35,7 +35,7 @@ class VVSTConverter : public VAbstractMConverter { Q_DECLARE_TR_FUNCTIONS(VVSTConverter) public: - VVSTConverter(const QString &fileName); + explicit VVSTConverter(const QString &fileName); virtual ~VVSTConverter() Q_DECL_OVERRIDE; static const QString MeasurementMaxVerStr; diff --git a/src/libs/qmuparser/qmuparser.cpp b/src/libs/qmuparser/qmuparser.cpp index 2141a007b..d3c211848 100644 --- a/src/libs/qmuparser/qmuparser.cpp +++ b/src/libs/qmuparser/qmuparser.cpp @@ -134,7 +134,7 @@ qreal QmuParser::FMod(qreal number, qreal denom) */ qreal QmuParser::Sum(const qreal *a_afArg, int a_iArgc) { - if (a_iArgc == false) + if (a_iArgc == 0) { throw QmuParserError("too few arguments for function sum."); } @@ -154,7 +154,7 @@ qreal QmuParser::Sum(const qreal *a_afArg, int a_iArgc) */ qreal QmuParser::Avg(const qreal *a_afArg, int a_iArgc) { - if (a_iArgc == false) + if (a_iArgc == 0) { throw QmuParserError("too few arguments for function sum."); } @@ -174,7 +174,7 @@ qreal QmuParser::Avg(const qreal *a_afArg, int a_iArgc) */ qreal QmuParser::Min(const qreal *a_afArg, int a_iArgc) { - if (a_iArgc == false) + if (a_iArgc == 0) { throw QmuParserError("too few arguments for function min."); } @@ -194,7 +194,7 @@ qreal QmuParser::Min(const qreal *a_afArg, int a_iArgc) */ qreal QmuParser::Max(const qreal *a_afArg, int a_iArgc) { - if (a_iArgc == false) + if (a_iArgc == 0) { throw QmuParserError("too few arguments for function min."); } diff --git a/src/libs/qmuparser/qmuparserbase.cpp b/src/libs/qmuparser/qmuparserbase.cpp index 2563349d9..7b4760a43 100644 --- a/src/libs/qmuparser/qmuparserbase.cpp +++ b/src/libs/qmuparser/qmuparserbase.cpp @@ -331,6 +331,7 @@ void QmuParserBase::AddCallback(const QString &a_strName, const QmuParserCallbac * * @throw ParserException if the name contains invalid charakters. */ +// cppcheck-suppress void QmuParserBase::CheckOprt(const QString &a_sName, const QmuParserCallback &a_Callback, const QString &a_szCharSet) const { @@ -361,6 +362,7 @@ void QmuParserBase::CheckOprt(const QString &a_sName, const QmuParserCallback &a * * @throw ParserException if the name contains invalid charakters. */ +// cppcheck-suppress void QmuParserBase::CheckName(const QString &a_sName, const QString &a_szCharSet) const { std::wstring a_sNameStd = a_sName.toStdWString(); diff --git a/src/libs/qmuparser/qmuparserbase.h b/src/libs/qmuparser/qmuparserbase.h index 7a59ea3b0..544301ca1 100644 --- a/src/libs/qmuparser/qmuparserbase.h +++ b/src/libs/qmuparser/qmuparserbase.h @@ -54,7 +54,7 @@ class QMUPARSERSHARED_EXPORT QmuParserBase friend class QmuParserTokenReader; public: QmuParserBase(); - QmuParserBase(const QmuParserBase &a_Parser); + explicit QmuParserBase(const QmuParserBase &a_Parser); QmuParserBase& operator=(const QmuParserBase &a_Parser); virtual ~QmuParserBase(); @@ -248,7 +248,9 @@ private: qreal ParseString() const; qreal ParseCmdCode() const; qreal ParseCmdCodeBulk(int nOffset, int nThreadID) const; + // cppcheck-suppress functionStatic void CheckName(const QString &a_strName, const QString &a_CharSet) const; + // cppcheck-suppress functionStatic void CheckOprt(const QString &a_sName, const QmuParserCallback &a_Callback, const QString &a_szCharSet) const; void StackDump(const QStack &a_stVal, const QStack &a_stOprt) const; diff --git a/src/libs/qmuparser/qmuparserbytecode.cpp b/src/libs/qmuparser/qmuparserbytecode.cpp index 5ba153629..29e525a62 100644 --- a/src/libs/qmuparser/qmuparserbytecode.cpp +++ b/src/libs/qmuparser/qmuparserbytecode.cpp @@ -34,7 +34,6 @@ namespace qmu /** * @brief Bytecode default constructor. */ -// cppcheck-suppress uninitMemberVar QmuParserByteCode::QmuParserByteCode() :m_iStackPos(0), m_iMaxStackSize(0), m_vRPN(), m_bEnableOptimizer(true) { @@ -47,7 +46,6 @@ QmuParserByteCode::QmuParserByteCode() * * Implemented in Terms of Assign(const QParserByteCode &a_ByteCode) */ -// cppcheck-suppress uninitMemberVar QmuParserByteCode::QmuParserByteCode(const QmuParserByteCode &a_ByteCode) :m_iStackPos(a_ByteCode.m_iStackPos), m_iMaxStackSize(a_ByteCode.m_iMaxStackSize), m_vRPN(a_ByteCode.m_vRPN), m_bEnableOptimizer(true) @@ -61,7 +59,6 @@ QmuParserByteCode::QmuParserByteCode(const QmuParserByteCode &a_ByteCode) * * Implemented in Terms of Assign(const QParserByteCode &a_ByteCode) */ -// cppcheck-suppress operatorEqVarError QmuParserByteCode& QmuParserByteCode::operator=(const QmuParserByteCode &a_ByteCode) { Assign(a_ByteCode); diff --git a/src/libs/qmuparser/qmuparsertest.h b/src/libs/qmuparser/qmuparsertest.h index c85ccafcf..006fa4edb 100644 --- a/src/libs/qmuparser/qmuparsertest.h +++ b/src/libs/qmuparser/qmuparsertest.h @@ -184,7 +184,7 @@ private: static qreal FirstArg ( const qreal* a_afArg, int a_iArgc ) { - if ( a_iArgc == false) + if ( a_iArgc == 0) { throw QmuParserError ( "too few arguments for function FirstArg." ); } @@ -194,7 +194,7 @@ private: static qreal LastArg ( const qreal* a_afArg, int a_iArgc ) { - if ( a_iArgc == false) + if ( a_iArgc == 0) { throw QmuParserError ( "too few arguments for function LastArg." ); } @@ -204,7 +204,7 @@ private: static qreal Sum ( const qreal* a_afArg, int a_iArgc ) { - if ( a_iArgc == false) + if ( a_iArgc == 0) { throw QmuParserError ( "too few arguments for function sum." ); } diff --git a/src/libs/qmuparser/qmuparsertoken.h b/src/libs/qmuparser/qmuparsertoken.h index 2c68be7cd..cbd0d12f9 100644 --- a/src/libs/qmuparser/qmuparsertoken.h +++ b/src/libs/qmuparser/qmuparsertoken.h @@ -335,6 +335,7 @@ public: FunctionPtr func; } var; + // cppcheck-suppress duplicateExpression Q_STATIC_ASSERT_X(sizeof(void *) == sizeof(void (*)(void)), "object pointer and function pointer sizes must equal"); diff --git a/src/libs/qmuparser/qmuparsertokenreader.h b/src/libs/qmuparser/qmuparsertokenreader.h index af4dbc245..7c57d1b54 100644 --- a/src/libs/qmuparser/qmuparsertokenreader.h +++ b/src/libs/qmuparser/qmuparsertokenreader.h @@ -44,7 +44,7 @@ class QmuParserTokenReader private: typedef QmuParserToken token_type; public: - QmuParserTokenReader(QmuParserBase *a_pParent); + explicit QmuParserTokenReader(QmuParserBase *a_pParent); QmuParserTokenReader* Clone(QmuParserBase *a_pParent) const; void AddValIdent(identfun_type a_pCallback); diff --git a/src/libs/vdxf/dxflib/dl_attributes.h b/src/libs/vdxf/dxflib/dl_attributes.h index 7de8ad73d..38d192db8 100644 --- a/src/libs/vdxf/dxflib/dl_attributes.h +++ b/src/libs/vdxf/dxflib/dl_attributes.h @@ -237,7 +237,7 @@ public: inPaperSpace = on; } - bool isInPaperSpace() + bool isInPaperSpace() const { return inPaperSpace; } diff --git a/src/libs/vdxf/dxflib/dl_creationinterface.h b/src/libs/vdxf/dxflib/dl_creationinterface.h index 317986063..67590e97f 100644 --- a/src/libs/vdxf/dxflib/dl_creationinterface.h +++ b/src/libs/vdxf/dxflib/dl_creationinterface.h @@ -346,7 +346,7 @@ public: } /** @return the current attributes used for new entities. */ - DL_Attributes getAttributes() + DL_Attributes getAttributes() const { return attributes; } diff --git a/src/libs/vdxf/dxflib/dl_dxf.cpp b/src/libs/vdxf/dxflib/dl_dxf.cpp index 7ce27f418..b4d79c966 100644 --- a/src/libs/vdxf/dxflib/dl_dxf.cpp +++ b/src/libs/vdxf/dxflib/dl_dxf.cpp @@ -68,7 +68,7 @@ DL_Dxf::DL_Dxf() firstHatchLoop(), hatchEdge(), hatchEdges(), xRecordHandle(), xRecordValues(), groupCodeTmp(), groupCode(), groupValue(), - currentObjectType(), settingKey(), values(), firstCall(), attrib(), + currentObjectType(), settingValue(), settingKey(), values(), firstCall(), attrib(), libVersion(), appDictionaryHandle(), styleHandleStd() { } @@ -189,18 +189,13 @@ bool DL_Dxf::in(std::stringstream& stream, */ bool DL_Dxf::readDxfGroups(FILE *fp, DL_CreationInterface* creationInterface) { - - static int line = 1; - // Read one group of the DXF file and strip the lines: if (DL_Dxf::getStrippedLine(groupCodeTmp, DL_DXF_MAXLINE, fp) && DL_Dxf::getStrippedLine(groupValue, DL_DXF_MAXLINE, fp) ) { - groupCode = static_cast(toInt(groupCodeTmp)); creationInterface->processCodeValuePair(groupCode, groupValue); - line+=2; processDXFGroup(creationInterface, groupCode, groupValue); } @@ -215,17 +210,12 @@ bool DL_Dxf::readDxfGroups(FILE *fp, DL_CreationInterface* creationInterface) bool DL_Dxf::readDxfGroups(std::stringstream& stream, DL_CreationInterface* creationInterface) { - - static int line = 1; - // Read one group of the DXF file and chop the lines: if (DL_Dxf::getStrippedLine(groupCodeTmp, DL_DXF_MAXLINE, stream) && DL_Dxf::getStrippedLine(groupValue, DL_DXF_MAXLINE, stream) ) { groupCode = static_cast(toInt(groupCodeTmp)); - - line+=2; processDXFGroup(creationInterface, groupCode, groupValue); } return !stream.eof(); @@ -2593,7 +2583,7 @@ DL_WriterA* DL_Dxf::out(const char* file, DL_Codes::version version) * @brief Writes a DXF header to the file currently opened * by the given DXF writer object. */ -void DL_Dxf::writeHeader(DL_WriterA& dw) +void DL_Dxf::writeHeader(DL_WriterA& dw) const { dw.comment("dxflib " DL_VERSION); dw.sectionHeader(); @@ -2800,7 +2790,7 @@ void DL_Dxf::writeVertex(DL_WriterA& dw, /** * Writes the polyline end. Only needed for DXF R12. */ -void DL_Dxf::writePolylineEnd(DL_WriterA& dw) +void DL_Dxf::writePolylineEnd(DL_WriterA& dw) const { if (version==DL_VERSION_2000) { @@ -3248,7 +3238,7 @@ void DL_Dxf::writeAttribute(DL_WriterA& dw, } void DL_Dxf::writeDimStyleOverrides(DL_WriterA& dw, - const DL_DimensionData& data) + const DL_DimensionData& data) const { if (version==DL_VERSION_2000) @@ -3781,7 +3771,7 @@ void DL_Dxf::writeLeader(DL_WriterA& dw, * @param data Entity data */ void DL_Dxf::writeLeaderVertex(DL_WriterA& dw, - const DL_LeaderVertexData& data) + const DL_LeaderVertexData& data) const { if (version>DL_VERSION_R12) { @@ -3843,7 +3833,7 @@ void DL_Dxf::writeHatch1(DL_WriterA& dw, */ void DL_Dxf::writeHatch2(DL_WriterA& dw, const DL_HatchData& data, - const DL_Attributes& /*attrib*/) + const DL_Attributes& /*attrib*/) const { dw.dxfInt(75, 0); // odd parity @@ -4076,7 +4066,7 @@ int DL_Dxf::writeImage(DL_WriterA& dw, */ void DL_Dxf::writeImageDef(DL_WriterA& dw, int handle, - const DL_ImageData& data) + const DL_ImageData& data) const { /*if (data.file.empty()) { @@ -4187,7 +4177,7 @@ void DL_Dxf::writeLayer(DL_WriterA& dw, * tables section of a DXF file. */ void DL_Dxf::writeLinetype(DL_WriterA& dw, - const DL_LinetypeData& data) + const DL_LinetypeData& data) const { std::string nameUpper = data.name; @@ -4376,7 +4366,7 @@ void DL_Dxf::writeEndBlock(DL_WriterA& dw, const std::string& name) * Note that this method currently only writes a faked VPORT section * to make the file readable by Aut*cad. */ -void DL_Dxf::writeVPort(DL_WriterA& dw) +void DL_Dxf::writeVPort(DL_WriterA& dw) const { dw.dxfString(0, "TABLE"); dw.dxfString(2, "VPORT"); @@ -4533,7 +4523,7 @@ void DL_Dxf::writeStyle(DL_WriterA& dw, const DL_StyleData& style) * Note that this method currently only writes a faked VIEW section * to make the file readable by Aut*cad. */ -void DL_Dxf::writeView(DL_WriterA& dw) +void DL_Dxf::writeView(DL_WriterA& dw) const { dw.dxfString( 0, "TABLE"); dw.dxfString( 2, "VIEW"); @@ -4557,7 +4547,7 @@ void DL_Dxf::writeView(DL_WriterA& dw) * Note that this method currently only writes a faked UCS section * to make the file readable by Aut*cad. */ -void DL_Dxf::writeUcs(DL_WriterA& dw) +void DL_Dxf::writeUcs(DL_WriterA& dw) const { dw.dxfString( 0, "TABLE"); dw.dxfString( 2, "UCS"); @@ -4701,7 +4691,7 @@ void DL_Dxf::writeDimStyle(DL_WriterA& dw, * Note that this method currently only writes a faked BLOCKRECORD section * to make the file readable by Aut*cad. */ -void DL_Dxf::writeBlockRecord(DL_WriterA& dw) +void DL_Dxf::writeBlockRecord(DL_WriterA& dw) const { dw.dxfString( 0, "TABLE"); dw.dxfString( 2, "BLOCK_RECORD"); @@ -4772,7 +4762,7 @@ void DL_Dxf::writeBlockRecord(DL_WriterA& dw) /** * Writes a single block record with the given name. */ -void DL_Dxf::writeBlockRecord(DL_WriterA& dw, const std::string& name) +void DL_Dxf::writeBlockRecord(DL_WriterA& dw, const std::string& name) const { dw.dxfString( 0, "BLOCK_RECORD"); if (version==DL_VERSION_2000) @@ -5815,9 +5805,6 @@ int DL_Dxf::getLibVersion(const std::string& str) { int d[4]; int idx = 0; - //char v[4][5]; - std::string v[4]; - int ret = 0; for (unsigned int i=0; i(str.length()); + std::string v[4]; + v[0] = str.substr(0, d[0]); v[1] = str.substr(d[0]+1, d[1]-d[0]-1); v[2] = str.substr(d[1]+1, d[2]-d[1]-1); @@ -5844,10 +5833,10 @@ int DL_Dxf::getLibVersion(const std::string& str) v[3] = "0"; } - ret = (atoi(v[0].c_str())<<(3*8)) + - (atoi(v[1].c_str())<<(2*8)) + - (atoi(v[2].c_str())<<(1*8)) + - (atoi(v[3].c_str())<<(0*8)); + const int ret = (atoi(v[0].c_str())<<(3*8)) + + (atoi(v[1].c_str())<<(2*8)) + + (atoi(v[2].c_str())<<(1*8)) + + (atoi(v[3].c_str())<<(0*8)); return ret; } diff --git a/src/libs/vdxf/dxflib/dl_dxf.h b/src/libs/vdxf/dxflib/dl_dxf.h index 7d36df357..7f1465f3c 100644 --- a/src/libs/vdxf/dxflib/dl_dxf.h +++ b/src/libs/vdxf/dxflib/dl_dxf.h @@ -143,7 +143,7 @@ public: void addLayer(DL_CreationInterface* creationInterface); void addLinetype(DL_CreationInterface *creationInterface); void addBlock(DL_CreationInterface* creationInterface); - void endBlock(DL_CreationInterface* creationInterface); + static void endBlock(DL_CreationInterface* creationInterface); void addTextStyle(DL_CreationInterface* creationInterface); void addPoint(DL_CreationInterface* creationInterface); @@ -189,7 +189,7 @@ public: void addImage(DL_CreationInterface* creationInterface); void addImageDef(DL_CreationInterface* creationInterface); - void addComment(DL_CreationInterface* creationInterface, const std::string& comment); + static void addComment(DL_CreationInterface* creationInterface, const std::string& comment); void addDictionary(DL_CreationInterface* creationInterface); void addDictionaryEntry(DL_CreationInterface* creationInterface); @@ -204,16 +204,16 @@ public: bool handleLeaderData(DL_CreationInterface* creationInterface); bool handleLinetypeData(DL_CreationInterface* creationInterface); - void endEntity(DL_CreationInterface* creationInterface); + static void endEntity(DL_CreationInterface* creationInterface); - void endSequence(DL_CreationInterface* creationInterface); + static void endSequence(DL_CreationInterface* creationInterface); //int stringToInt(const char* s, bool* ok=NULL); DL_WriterA* out(const char* file, DL_Codes::version version=DL_VERSION_2000); - void writeHeader(DL_WriterA& dw); + void writeHeader(DL_WriterA& dw) const; void writePoint(DL_WriterA& dw, const DL_PointData& data, @@ -232,16 +232,16 @@ public: const DL_Attributes& attrib); void writeVertex(DL_WriterA& dw, const DL_VertexData& data); - void writePolylineEnd(DL_WriterA& dw); + void writePolylineEnd(DL_WriterA& dw) const; void writeSpline(DL_WriterA& dw, const DL_SplineData& data, const DL_Attributes& attrib); - void writeControlPoint(DL_WriterA& dw, - const DL_ControlPointData& data); - void writeFitPoint(DL_WriterA& dw, - const DL_FitPointData& data); - void writeKnot(DL_WriterA& dw, - const DL_KnotData& data); + static void writeControlPoint(DL_WriterA& dw, + const DL_ControlPointData& data); + static void writeFitPoint(DL_WriterA& dw, + const DL_FitPointData& data); + static void writeKnot(DL_WriterA& dw, + const DL_KnotData& data); void writeCircle(DL_WriterA& dw, const DL_CircleData& data, const DL_Attributes& attrib); @@ -273,7 +273,7 @@ public: const DL_AttributeData& data, const DL_Attributes& attrib); void writeDimStyleOverrides(DL_WriterA& dw, - const DL_DimensionData& data); + const DL_DimensionData& data) const; void writeDimAligned(DL_WriterA& dw, const DL_DimensionData& data, const DL_DimAlignedData& edata, @@ -306,59 +306,59 @@ public: const DL_LeaderData& data, const DL_Attributes& attrib); void writeLeaderVertex(DL_WriterA& dw, - const DL_LeaderVertexData& data); + const DL_LeaderVertexData& data) const; void writeHatch1(DL_WriterA& dw, const DL_HatchData& data, const DL_Attributes& attrib); void writeHatch2(DL_WriterA& dw, const DL_HatchData& data, - const DL_Attributes& attrib); - void writeHatchLoop1(DL_WriterA& dw, - const DL_HatchLoopData& data); - void writeHatchLoop2(DL_WriterA& dw, - const DL_HatchLoopData& data); - void writeHatchEdge(DL_WriterA& dw, - const DL_HatchEdgeData& data); + const DL_Attributes& attrib) const; + static void writeHatchLoop1(DL_WriterA& dw, + const DL_HatchLoopData& data); + static void writeHatchLoop2(DL_WriterA& dw, + const DL_HatchLoopData& data); + static void writeHatchEdge(DL_WriterA& dw, + const DL_HatchEdgeData& data); int writeImage(DL_WriterA& dw, const DL_ImageData& data, const DL_Attributes& attrib); void writeImageDef(DL_WriterA& dw, int handle, - const DL_ImageData& data); + const DL_ImageData& data) const; void writeLayer(DL_WriterA& dw, const DL_LayerData& data, const DL_Attributes& attrib); void writeLinetype(DL_WriterA& dw, - const DL_LinetypeData& data); + const DL_LinetypeData& data) const; - void writeAppid(DL_WriterA& dw, const std::string& name); + static void writeAppid(DL_WriterA& dw, const std::string& name); - void writeBlock(DL_WriterA& dw, - const DL_BlockData& data); - void writeEndBlock(DL_WriterA& dw, const std::string& name); + static void writeBlock(DL_WriterA& dw, + const DL_BlockData& data); + static void writeEndBlock(DL_WriterA& dw, const std::string& name); - void writeVPort(DL_WriterA& dw); + void writeVPort(DL_WriterA& dw) const; void writeStyle(DL_WriterA& dw, const DL_StyleData& style); - void writeView(DL_WriterA& dw); - void writeUcs(DL_WriterA& dw); + void writeView(DL_WriterA& dw) const; + void writeUcs(DL_WriterA& dw) const; void writeDimStyle(DL_WriterA& dw, double dimasz, double dimexe, double dimexo, double dimgap, double dimtxt); - void writeBlockRecord(DL_WriterA& dw); - void writeBlockRecord(DL_WriterA& dw, const std::string& name); + void writeBlockRecord(DL_WriterA& dw) const; + void writeBlockRecord(DL_WriterA& dw, const std::string& name) const; void writeObjects(DL_WriterA& dw, const std::string& appDictionaryName = ""); void writeAppDictionary(DL_WriterA& dw); - int writeDictionaryEntry(DL_WriterA& dw, const std::string& name); + static int writeDictionaryEntry(DL_WriterA& dw, const std::string& name); void writeXRecord(DL_WriterA& dw, int handle, int value); void writeXRecord(DL_WriterA& dw, int handle, double value); void writeXRecord(DL_WriterA& dw, int handle, bool value); void writeXRecord(DL_WriterA& dw, int handle, const std::string& value); - void writeObjectsEnd(DL_WriterA& dw); + static void writeObjectsEnd(DL_WriterA& dw); - void writeComment(DL_WriterA& dw, const std::string& comment); + static void writeComment(DL_WriterA& dw, const std::string& comment); /** * Converts the given string into a double or returns the given @@ -392,12 +392,12 @@ public: static bool checkVariable(const char* var, DL_Codes::version version); - DL_Codes::version getVersion() + DL_Codes::version getVersion() const { return version; } - int getLibVersion(const std::string &str); + static int getLibVersion(const std::string &str); static void test(); @@ -415,13 +415,13 @@ public: return toInt(values[code]); } - int toInt(const std::string& str) + static int toInt(const std::string& str) { char* p; return static_cast(strtol(str.c_str(), &p, 10)); } - bool toBool(const std::string& str) + static bool toBool(const std::string& str) { char* p; return static_cast(strtol(str.c_str(), &p, 10)); @@ -445,7 +445,7 @@ public: return toReal(values[code]); } - double toReal(const std::string& str) + static double toReal(const std::string& str) { double ret; // make sure the real value uses '.' not ',': diff --git a/src/libs/vdxf/dxflib/dl_entities.h b/src/libs/vdxf/dxflib/dl_entities.h index 3c99e5177..4ff6c270c 100644 --- a/src/libs/vdxf/dxflib/dl_entities.h +++ b/src/libs/vdxf/dxflib/dl_entities.h @@ -568,7 +568,7 @@ struct DXFLIB_EXPORT DL_KnotData * Constructor. * Parameters: see member variables. */ - DL_KnotData(double pk) + explicit DL_KnotData(double pk) : k(pk) { } @@ -1425,7 +1425,7 @@ struct DXFLIB_EXPORT DL_HatchLoopData * Constructor. * Parameters: see member variables. */ - DL_HatchLoopData(int hNumEdges) + explicit DL_HatchLoopData(int hNumEdges) : numEdges(hNumEdges) { } @@ -1725,7 +1725,7 @@ struct DXFLIB_EXPORT DL_ImageDefData */ struct DXFLIB_EXPORT DL_DictionaryData { - DL_DictionaryData(const std::string& handle) : handle(handle) {} + explicit DL_DictionaryData(const std::string& handle) : handle(handle) {} std::string handle; }; diff --git a/src/libs/vdxf/dxflib/dl_extrusion.h b/src/libs/vdxf/dxflib/dl_extrusion.h index 0f1ab9790..c96886474 100644 --- a/src/libs/vdxf/dxflib/dl_extrusion.h +++ b/src/libs/vdxf/dxflib/dl_extrusion.h @@ -59,8 +59,9 @@ public: } DL_Extrusion(const DL_Extrusion &L) - : direction(L.direction), elevation(L.elevation) + : direction(new double[3]), elevation(L.elevation) { + setDirection(L.direction[0], L.direction[1], L.direction[0]); } /** diff --git a/src/libs/vdxf/dxflib/dl_writer.h b/src/libs/vdxf/dxflib/dl_writer.h index 00515fded..69264fd8b 100644 --- a/src/libs/vdxf/dxflib/dl_writer.h +++ b/src/libs/vdxf/dxflib/dl_writer.h @@ -62,7 +62,8 @@ public: /** * @param version DXF version. Defaults to DL_VERSION_2002. */ - DL_Writer(DL_Codes::version version) : m_handle(0x30), modelSpaceHandle(0), paperSpaceHandle(0), paperSpace0Handle(0), version(version) + explicit DL_Writer(DL_Codes::version version) + : m_handle(0x30), modelSpaceHandle(0), paperSpaceHandle(0), paperSpace0Handle(0), version(version) { } @@ -616,12 +617,13 @@ public: * Sets the handle of the model space. Entities refer to * this handle. */ + // cppcheck-suppress functionConst void setModelSpaceHandle(unsigned long h) { modelSpaceHandle = h; } - unsigned long getModelSpaceHandle() + unsigned long getModelSpaceHandle() const { return modelSpaceHandle; } @@ -630,12 +632,13 @@ public: * Sets the handle of the paper space. Some special blocks refer to * this handle. */ + // cppcheck-suppress functionConst void setPaperSpaceHandle(unsigned long h) { paperSpaceHandle = h; } - unsigned long getPaperSpaceHandle() + unsigned long getPaperSpaceHandle() const { return paperSpaceHandle; } @@ -644,12 +647,13 @@ public: * Sets the handle of the paper space 0. Some special blocks refer to * this handle. */ + // cppcheck-suppress functionConst void setPaperSpace0Handle(unsigned long h) { paperSpace0Handle = h; } - unsigned long getPaperSpace0Handle() + unsigned long getPaperSpace0Handle() const { return paperSpace0Handle; } diff --git a/src/libs/vformat/vmeasurements.h b/src/libs/vformat/vmeasurements.h index 1acfb0fae..bf64a8129 100644 --- a/src/libs/vformat/vmeasurements.h +++ b/src/libs/vformat/vmeasurements.h @@ -38,7 +38,7 @@ class VMeasurements : public VDomDocument { Q_DECLARE_TR_FUNCTIONS(VMeasurements) public: - VMeasurements(VContainer *data); + explicit VMeasurements(VContainer *data); VMeasurements(Unit unit, VContainer *data); VMeasurements(Unit unit, int baseSize, int baseHeight, VContainer *data); virtual ~VMeasurements() Q_DECL_OVERRIDE; diff --git a/src/libs/vgeometry/vabstractcurve.h b/src/libs/vgeometry/vabstractcurve.h index 3276561f1..d6082041d 100644 --- a/src/libs/vgeometry/vabstractcurve.h +++ b/src/libs/vgeometry/vabstractcurve.h @@ -42,7 +42,7 @@ class VAbstractCurve :public VGObject { public: VAbstractCurve(const GOType &type, const quint32 &idObject = NULL_ID, const Draw &mode = Draw::Calculation); - VAbstractCurve(const VAbstractCurve &curve); + explicit VAbstractCurve(const VAbstractCurve &curve); VAbstractCurve& operator= (const VAbstractCurve &curve); virtual QVector GetPoints() const =0; diff --git a/src/libs/vgeometry/vpointf.h b/src/libs/vgeometry/vpointf.h index b41a93d1f..da141fa0d 100644 --- a/src/libs/vgeometry/vpointf.h +++ b/src/libs/vgeometry/vpointf.h @@ -43,11 +43,12 @@ class VPointF:public VGObject public: VPointF (); VPointF (const VPointF &point ); + // cppcheck-suppress noExplicitConstructor VPointF (const QPointF &point ); VPointF (qreal x, qreal y, const QString &name, qreal mx, qreal my, quint32 idObject = 0, - const Draw &mode = Draw::Calculation); + const Draw &mode = Draw::Calculation); VPointF (const QPointF &point, const QString &name, qreal mx, qreal my, quint32 idObject = 0, - const Draw &mode = Draw::Calculation); + const Draw &mode = Draw::Calculation); virtual ~VPointF() Q_DECL_OVERRIDE; VPointF &operator=(const VPointF &point); qreal mx() const; diff --git a/src/libs/vgeometry/vpointf_p.h b/src/libs/vgeometry/vpointf_p.h index cc7e35801..fd5553ee3 100644 --- a/src/libs/vgeometry/vpointf_p.h +++ b/src/libs/vgeometry/vpointf_p.h @@ -50,7 +50,7 @@ public: :QSharedData(point), _mx(point._mx), _my(point._my), _x(point._x), _y(point._y) {} - VPointFData(const QPointF &point) + explicit VPointFData(const QPointF &point) :_mx(0), _my(0), _x(point.x()), _y(point.y()) {} diff --git a/src/libs/vgeometry/vspline.cpp b/src/libs/vgeometry/vspline.cpp index ab51f05ce..9a22810e7 100644 --- a/src/libs/vgeometry/vspline.cpp +++ b/src/libs/vgeometry/vspline.cpp @@ -371,7 +371,6 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, const double da2 = y3 - y1; d3 = k * (da1*dx + da2*dy); } - // cppcheck-suppress incorrectLogicOperator if (d2 > 0 && d2 < 1 && d3 > 0 && d3 < 1) { // Simple collinear case, 1---2---3---4 diff --git a/src/libs/vgeometry/vsplinepath_p.h b/src/libs/vgeometry/vsplinepath_p.h index 627bbeaee..cf6dcd319 100644 --- a/src/libs/vgeometry/vsplinepath_p.h +++ b/src/libs/vgeometry/vsplinepath_p.h @@ -45,7 +45,7 @@ public: : path(QVector()), kCurve(1) {} - VSplinePathData(qreal kCurve) + explicit VSplinePathData(qreal kCurve) : path(QVector()), kCurve(kCurve) {} diff --git a/src/libs/vlayout/vabstractdetail.h b/src/libs/vlayout/vabstractdetail.h index 04ef46214..339d931bf 100644 --- a/src/libs/vlayout/vabstractdetail.h +++ b/src/libs/vlayout/vabstractdetail.h @@ -45,7 +45,7 @@ class VAbstractDetail { public: VAbstractDetail(); - VAbstractDetail(const QString &name); + explicit VAbstractDetail(const QString &name); VAbstractDetail(const VAbstractDetail &detail); VAbstractDetail &operator=(const VAbstractDetail &detail); virtual ~VAbstractDetail(); diff --git a/src/libs/vlayout/vabstractdetail_p.h b/src/libs/vlayout/vabstractdetail_p.h index 9f4fca2f5..57ee2c96b 100644 --- a/src/libs/vlayout/vabstractdetail_p.h +++ b/src/libs/vlayout/vabstractdetail_p.h @@ -44,7 +44,7 @@ public: :name(QString()), seamAllowance(false), closed(true), width(0) {} - VAbstractDetailData(const QString &name) + explicit VAbstractDetailData(const QString &name) :name(name), seamAllowance(false), closed(true), width(0) {} diff --git a/src/libs/vlayout/vlayoutgenerator.h b/src/libs/vlayout/vlayoutgenerator.h index 233d102ae..b2797298a 100644 --- a/src/libs/vlayout/vlayoutgenerator.h +++ b/src/libs/vlayout/vlayoutgenerator.h @@ -44,7 +44,7 @@ class VLayoutGenerator :public QObject { Q_OBJECT public: - VLayoutGenerator(QObject *parent = 0); + explicit VLayoutGenerator(QObject *parent = 0); virtual ~VLayoutGenerator() Q_DECL_OVERRIDE; void SetDetails(const QVector &details); diff --git a/src/libs/vlayout/vposter.h b/src/libs/vlayout/vposter.h index b3adf3576..8b30ab5ba 100644 --- a/src/libs/vlayout/vposter.h +++ b/src/libs/vlayout/vposter.h @@ -39,7 +39,7 @@ class VPoster { Q_DECLARE_TR_FUNCTIONS(VPoster) public: - VPoster(const QPrinter *printer); + explicit VPoster(const QPrinter *printer); QVector Generate(const QImage &image, int page, int sheets = 1) const; private: diff --git a/src/libs/vmisc/vlockguard.h b/src/libs/vmisc/vlockguard.h index ec7d822f6..4f1e84630 100644 --- a/src/libs/vmisc/vlockguard.h +++ b/src/libs/vmisc/vlockguard.h @@ -75,6 +75,7 @@ private: std::shared_ptr lock; #endif + // cppcheck-suppress functionStatic bool TryLock(const QString &lockName, int stale, int timeout); }; diff --git a/src/libs/vpatterndb/variables/vincrement.cpp b/src/libs/vpatterndb/variables/vincrement.cpp index c72a96d9f..8c7f60718 100644 --- a/src/libs/vpatterndb/variables/vincrement.cpp +++ b/src/libs/vpatterndb/variables/vincrement.cpp @@ -48,7 +48,7 @@ VIncrement::VIncrement() * @param description description of increment */ VIncrement::VIncrement(VContainer *data, const QString &name, quint32 index, qreal base, const QString &formula, - bool ok, const QString description) + bool ok, const QString &description) :VVariable(name, base, description), d(new VIncrementData(data, index, formula, ok)) { SetType(VarType::Increment); diff --git a/src/libs/vpatterndb/variables/vincrement.h b/src/libs/vpatterndb/variables/vincrement.h index 7a7d088cd..5f20905fa 100644 --- a/src/libs/vpatterndb/variables/vincrement.h +++ b/src/libs/vpatterndb/variables/vincrement.h @@ -42,7 +42,7 @@ class VIncrement :public VVariable public: VIncrement(); VIncrement(VContainer *data, const QString &name, quint32 index, qreal base, const QString &formula, bool ok, - const QString description = QString()); + const QString &description = QString()); VIncrement(const VIncrement &incr); VIncrement &operator=(const VIncrement &incr); virtual ~VIncrement() Q_DECL_OVERRIDE; diff --git a/src/libs/vpatterndb/vcontainer.cpp b/src/libs/vpatterndb/vcontainer.cpp index dc895d5ae..c933be86c 100644 --- a/src/libs/vpatterndb/vcontainer.cpp +++ b/src/libs/vpatterndb/vcontainer.cpp @@ -96,7 +96,7 @@ const QSharedPointer VContainer::GetGObject(quint32 id)const } //--------------------------------------------------------------------------------------------------------------------- -const QSharedPointer VContainer::GetFakeGObject(quint32 id) const +const QSharedPointer VContainer::GetFakeGObject(quint32 id) { VGObject *obj = new VGObject(); obj->setId(id); diff --git a/src/libs/vpatterndb/vcontainer.h b/src/libs/vpatterndb/vcontainer.h index 492ad2be5..5d4f8f5f2 100644 --- a/src/libs/vpatterndb/vcontainer.h +++ b/src/libs/vpatterndb/vcontainer.h @@ -103,7 +103,7 @@ public: template const QSharedPointer GeometricObject(const quint32 &id) const; const QSharedPointer GetGObject(quint32 id) const; - const QSharedPointer GetFakeGObject(quint32 id) const; + static const QSharedPointer GetFakeGObject(quint32 id); const VDetail GetDetail(quint32 id) const; qreal GetTableValue(const QString& name, MeasurementsType patternType) const; template diff --git a/src/libs/vpatterndb/vdetail_p.h b/src/libs/vpatterndb/vdetail_p.h index 28e5fcfa8..d8c45f90b 100644 --- a/src/libs/vpatterndb/vdetail_p.h +++ b/src/libs/vpatterndb/vdetail_p.h @@ -45,7 +45,7 @@ public: :_id(NULL_ID), nodes(QVector()), mx(0), my(0) {} - VDetailData(const QVector &nodes) + explicit VDetailData(const QVector &nodes) :_id(NULL_ID), nodes(nodes), mx(0), my(0) {} diff --git a/src/libs/vpatterndb/vtranslatevars.h b/src/libs/vpatterndb/vtranslatevars.h index 162152309..92249db40 100644 --- a/src/libs/vpatterndb/vtranslatevars.h +++ b/src/libs/vpatterndb/vtranslatevars.h @@ -34,7 +34,7 @@ class VTranslateVars : public VTranslateMeasurements { public: - VTranslateVars(bool osSeparator); + explicit VTranslateVars(bool osSeparator); virtual ~VTranslateVars() Q_DECL_OVERRIDE; bool VariablesFromUser(QString &newFormula, int position, const QString &token, int &bias) const; diff --git a/src/libs/vpropertyexplorer/checkablemessagebox.cpp b/src/libs/vpropertyexplorer/checkablemessagebox.cpp index c37e7c2ca..320df4bca 100644 --- a/src/libs/vpropertyexplorer/checkablemessagebox.cpp +++ b/src/libs/vpropertyexplorer/checkablemessagebox.cpp @@ -42,7 +42,7 @@ namespace Utils class CheckableMessageBoxPrivate { public: - CheckableMessageBoxPrivate(QDialog *q) + explicit CheckableMessageBoxPrivate(QDialog *q) : pixmapLabel(nullptr), messageLabel(nullptr), checkBox(nullptr), buttonBox(nullptr), clickedButton(nullptr) { QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); diff --git a/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.h b/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.h index ffd196312..c2ea067aa 100644 --- a/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.h +++ b/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.h @@ -53,7 +53,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT QVector3DProperty : public VProperty { Q_OBJECT public: - QVector3DProperty(const QString& name); + explicit QVector3DProperty(const QString& name); virtual ~QVector3DProperty() Q_DECL_OVERRIDE {} diff --git a/src/libs/vpropertyexplorer/plugins/vboolproperty.h b/src/libs/vpropertyexplorer/plugins/vboolproperty.h index f4fc1835e..6e9d4b3f0 100644 --- a/src/libs/vpropertyexplorer/plugins/vboolproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vboolproperty.h @@ -32,7 +32,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VBoolProperty : public VProperty Q_OBJECT public: //! Default constructor - VBoolProperty(const QString& name); + explicit VBoolProperty(const QString& name); //! Destructor virtual ~VBoolProperty() Q_DECL_OVERRIDE {} diff --git a/src/libs/vpropertyexplorer/plugins/vcolorproperty.h b/src/libs/vpropertyexplorer/plugins/vcolorproperty.h index bf75a98e4..b7f13c6a6 100644 --- a/src/libs/vpropertyexplorer/plugins/vcolorproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vcolorproperty.h @@ -32,7 +32,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VColorProperty : public VProperty { Q_OBJECT public: - VColorProperty(const QString &name); + explicit VColorProperty(const QString &name); //! Get the data how it should be displayed virtual QVariant data (int column = DPC_Name, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; diff --git a/src/libs/vpropertyexplorer/plugins/vcolorpropertyeditor.h b/src/libs/vpropertyexplorer/plugins/vcolorpropertyeditor.h index 32c94b9df..9f833d27b 100644 --- a/src/libs/vpropertyexplorer/plugins/vcolorpropertyeditor.h +++ b/src/libs/vpropertyexplorer/plugins/vcolorpropertyeditor.h @@ -38,7 +38,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VColorPropertyEditor : public QWidget public: //! Constructor taking a widget as parent - VColorPropertyEditor(QWidget *parent); + explicit VColorPropertyEditor(QWidget *parent); //! Destructor virtual ~VColorPropertyEditor() Q_DECL_OVERRIDE; diff --git a/src/libs/vpropertyexplorer/plugins/vemptyproperty.h b/src/libs/vpropertyexplorer/plugins/vemptyproperty.h index 47e11d9d0..5f8c41803 100644 --- a/src/libs/vpropertyexplorer/plugins/vemptyproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vemptyproperty.h @@ -65,7 +65,7 @@ public: protected: //! Protected constructor - VEmptyProperty(VPropertyPrivate* d); + explicit VEmptyProperty(VPropertyPrivate* d); private: Q_DISABLE_COPY(VEmptyProperty) diff --git a/src/libs/vpropertyexplorer/plugins/venumproperty.h b/src/libs/vpropertyexplorer/plugins/venumproperty.h index adae0a71d..8e11375cc 100644 --- a/src/libs/vpropertyexplorer/plugins/venumproperty.h +++ b/src/libs/vpropertyexplorer/plugins/venumproperty.h @@ -33,7 +33,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VEnumProperty : public VProperty Q_OBJECT public: //! Constructor - VEnumProperty(const QString& name); + explicit VEnumProperty(const QString& name); //! Destructor virtual ~VEnumProperty() Q_DECL_OVERRIDE {} diff --git a/src/libs/vpropertyexplorer/plugins/vfileproperty.h b/src/libs/vpropertyexplorer/plugins/vfileproperty.h index b520e2bf9..5eb7681d9 100644 --- a/src/libs/vpropertyexplorer/plugins/vfileproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vfileproperty.h @@ -34,7 +34,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VFileProperty : public VProperty { Q_OBJECT public: - VFileProperty(const QString &name); + explicit VFileProperty(const QString &name); //! The destructor virtual ~VFileProperty() Q_DECL_OVERRIDE; diff --git a/src/libs/vpropertyexplorer/plugins/vlinecolorproperty.h b/src/libs/vpropertyexplorer/plugins/vlinecolorproperty.h index 10d94e7cb..017b60c86 100644 --- a/src/libs/vpropertyexplorer/plugins/vlinecolorproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vlinecolorproperty.h @@ -42,7 +42,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VLineColorProperty : public VProperty Q_OBJECT public: //! Constructor - VLineColorProperty(const QString& name); + explicit VLineColorProperty(const QString& name); //! Destructor virtual ~VLineColorProperty() Q_DECL_OVERRIDE {} diff --git a/src/libs/vpropertyexplorer/plugins/vlinetypeproperty.h b/src/libs/vpropertyexplorer/plugins/vlinetypeproperty.h index 9e79eb462..cb10616d0 100644 --- a/src/libs/vpropertyexplorer/plugins/vlinetypeproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vlinetypeproperty.h @@ -43,7 +43,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VLineTypeProperty : public VProperty Q_OBJECT public: //! Constructor - VLineTypeProperty(const QString& name); + explicit VLineTypeProperty(const QString& name); //! Destructor virtual ~VLineTypeProperty() Q_DECL_OVERRIDE {} diff --git a/src/libs/vpropertyexplorer/plugins/vnumberproperty.h b/src/libs/vpropertyexplorer/plugins/vnumberproperty.h index 2a65023ae..9c2a81762 100644 --- a/src/libs/vpropertyexplorer/plugins/vnumberproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vnumberproperty.h @@ -35,7 +35,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VIntegerProperty : public VProperty public: VIntegerProperty(const QString& name, const QMap& settings); - VIntegerProperty(const QString& name); + explicit VIntegerProperty(const QString& name); //! Returns an editor widget, or NULL if it doesn't supply one //! \param parent The widget to which the editor will be added as a child @@ -89,7 +89,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VDoubleProperty : public VIntegerProperty public: VDoubleProperty(const QString& name, const QMap& settings); - VDoubleProperty(const QString& name); + explicit VDoubleProperty(const QString& name); //! Returns an editor widget, or NULL if it doesn't supply one //! \param parent The widget to which the editor will be added as a child diff --git a/src/libs/vpropertyexplorer/plugins/vobjectproperty.h b/src/libs/vpropertyexplorer/plugins/vobjectproperty.h index 55495ad5a..50d3d1cfd 100644 --- a/src/libs/vpropertyexplorer/plugins/vobjectproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vobjectproperty.h @@ -35,7 +35,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VObjectProperty : public VProperty Q_OBJECT public: //! Constructor - VObjectProperty(const QString& name); + explicit VObjectProperty(const QString& name); //! Destructor virtual ~VObjectProperty() Q_DECL_OVERRIDE {} diff --git a/src/libs/vpropertyexplorer/plugins/vpointfproperty.h b/src/libs/vpropertyexplorer/plugins/vpointfproperty.h index d899a7c95..4ca9b647e 100644 --- a/src/libs/vpropertyexplorer/plugins/vpointfproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vpointfproperty.h @@ -32,7 +32,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VPointFProperty : public VProperty { Q_OBJECT public: - VPointFProperty(const QString& name); + explicit VPointFProperty(const QString& name); virtual ~VPointFProperty() Q_DECL_OVERRIDE {} diff --git a/src/libs/vpropertyexplorer/plugins/vshortcutproperty.h b/src/libs/vpropertyexplorer/plugins/vshortcutproperty.h index df5bffa51..0f5a21b79 100644 --- a/src/libs/vpropertyexplorer/plugins/vshortcutproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vshortcutproperty.h @@ -32,7 +32,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VShortcutProperty : public VProperty { Q_OBJECT public: - VShortcutProperty(const QString &name); + explicit VShortcutProperty(const QString &name); //! The destructor virtual ~VShortcutProperty() Q_DECL_OVERRIDE; diff --git a/src/libs/vpropertyexplorer/plugins/vshortcutpropertyeditor.h b/src/libs/vpropertyexplorer/plugins/vshortcutpropertyeditor.h index d8b14130f..db75b531c 100644 --- a/src/libs/vpropertyexplorer/plugins/vshortcutpropertyeditor.h +++ b/src/libs/vpropertyexplorer/plugins/vshortcutpropertyeditor.h @@ -37,7 +37,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VShortcutEditWidget : public QWidget Q_OBJECT public: - VShortcutEditWidget(QWidget* parent); + explicit VShortcutEditWidget(QWidget* parent); virtual ~VShortcutEditWidget() Q_DECL_OVERRIDE; //! Needed for proper event handling diff --git a/src/libs/vpropertyexplorer/plugins/vstringproperty.h b/src/libs/vpropertyexplorer/plugins/vstringproperty.h index 11cac1f74..10f3bee84 100644 --- a/src/libs/vpropertyexplorer/plugins/vstringproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vstringproperty.h @@ -35,7 +35,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VStringProperty : public VProperty public: VStringProperty(const QString& name, const QMap& settings); - VStringProperty(const QString& name); + explicit VStringProperty(const QString& name); //! Returns an editor widget, or NULL if it doesn't supply one //! \param parent The widget to which the editor will be added as a child diff --git a/src/libs/vpropertyexplorer/vproperty.h b/src/libs/vpropertyexplorer/vproperty.h index 613b6eb72..951ff3b12 100644 --- a/src/libs/vpropertyexplorer/vproperty.h +++ b/src/libs/vpropertyexplorer/vproperty.h @@ -203,7 +203,7 @@ signals: protected: //! Protected constructor - VProperty(VPropertyPrivate* d); + explicit VProperty(VPropertyPrivate* d); //! The protected structure holding the member variables (to assure binary compatibility) VPropertyPrivate* d_ptr; diff --git a/src/libs/vpropertyexplorer/vpropertyfactorymanager.h b/src/libs/vpropertyexplorer/vpropertyfactorymanager.h index e113e1b96..feab9e4be 100644 --- a/src/libs/vpropertyexplorer/vpropertyfactorymanager.h +++ b/src/libs/vpropertyexplorer/vpropertyfactorymanager.h @@ -36,7 +36,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VPropertyFactoryManager : public QObject Q_OBJECT public: //! Constructor - VPropertyFactoryManager(QObject* parent = nullptr); + explicit VPropertyFactoryManager(QObject* parent = nullptr); //! Destructor virtual ~VPropertyFactoryManager() Q_DECL_OVERRIDE; diff --git a/src/libs/vpropertyexplorer/vpropertyformview_p.h b/src/libs/vpropertyexplorer/vpropertyformview_p.h index 1414a6d10..dfb145bac 100644 --- a/src/libs/vpropertyexplorer/vpropertyformview_p.h +++ b/src/libs/vpropertyexplorer/vpropertyformview_p.h @@ -56,12 +56,12 @@ public: IgnoreDataChangedSignal(false) {} - VPropertyFormViewPrivate(VPropertyModel* prop_model) + explicit VPropertyFormViewPrivate(VPropertyModel* prop_model) : VPropertyFormWidgetPrivate(), Model(prop_model), PropertySet(NULL), NeedsRebuild(false), IgnoreDataChangedSignal(false) {} - VPropertyFormViewPrivate(VPropertySet* prop_set) + explicit VPropertyFormViewPrivate(VPropertySet* prop_set) : VPropertyFormWidgetPrivate(), Model(NULL), PropertySet(prop_set), NeedsRebuild(false), IgnoreDataChangedSignal(false) {} diff --git a/src/libs/vpropertyexplorer/vpropertyformwidget_p.h b/src/libs/vpropertyexplorer/vpropertyformwidget_p.h index 70b34fa29..71a1e005d 100644 --- a/src/libs/vpropertyexplorer/vpropertyformwidget_p.h +++ b/src/libs/vpropertyexplorer/vpropertyformwidget_p.h @@ -41,8 +41,8 @@ public: struct SEditorWidget { SEditorWidget() : FormWidget(nullptr), Editor(nullptr) {} - SEditorWidget(VPropertyFormWidget* form_widget) : FormWidget(form_widget), Editor(nullptr) {} - SEditorWidget(QWidget* editor_widget) : FormWidget(nullptr), Editor(editor_widget) {} + explicit SEditorWidget(VPropertyFormWidget* form_widget) : FormWidget(form_widget), Editor(nullptr) {} + explicit SEditorWidget(QWidget* editor_widget) : FormWidget(nullptr), Editor(editor_widget) {} VPropertyFormWidget* FormWidget; QWidget* Editor; @@ -64,7 +64,7 @@ public: {} //! Constructor - VPropertyFormWidgetPrivate(const QList& properties) + explicit VPropertyFormWidgetPrivate(const QList& properties) : Properties(properties), EditorWidgets(QList()), UpdateEditors(true) {} diff --git a/src/libs/vpropertyexplorer/vpropertytreeview_p.h b/src/libs/vpropertyexplorer/vpropertytreeview_p.h index cf7e072a4..ec748072f 100644 --- a/src/libs/vpropertyexplorer/vpropertytreeview_p.h +++ b/src/libs/vpropertyexplorer/vpropertytreeview_p.h @@ -38,7 +38,7 @@ public: VPropertyDelegate* PropertyDelegate; //! Constructor - VPropertyTreeViewPrivate(VPropertyDelegate* delegate) + explicit VPropertyTreeViewPrivate(VPropertyDelegate* delegate) : PropertyDelegate(delegate) {} //! Constructor diff --git a/src/libs/vpropertyexplorer/vstandardpropertyfactory.h b/src/libs/vpropertyexplorer/vstandardpropertyfactory.h index 7607e2e6e..4c4dd6261 100644 --- a/src/libs/vpropertyexplorer/vstandardpropertyfactory.h +++ b/src/libs/vpropertyexplorer/vstandardpropertyfactory.h @@ -41,7 +41,7 @@ public: //! Constructor //! \param manager Registers this factory at the manager for all it's types - VStandardPropertyFactory(VPropertyFactoryManager* manager); + explicit VStandardPropertyFactory(VPropertyFactoryManager* manager); //! Creates a new property of a certain type and assigns a name and description (otionally) //! \param type The type of the property as string diff --git a/src/libs/vtools/visualization/visualization.h b/src/libs/vtools/visualization/visualization.h index f5a1193e5..ad3dc7b5e 100644 --- a/src/libs/vtools/visualization/visualization.h +++ b/src/libs/vtools/visualization/visualization.h @@ -43,7 +43,7 @@ class Visualization : public QObject { Q_OBJECT public: - Visualization(const VContainer *data); + explicit Visualization(const VContainer *data); virtual ~Visualization() Q_DECL_OVERRIDE; virtual void RefreshGeometry()=0; diff --git a/src/libs/vwidgets/vgraphicssimpletextitem.h b/src/libs/vwidgets/vgraphicssimpletextitem.h index ef7ff4693..9605d6fbb 100644 --- a/src/libs/vwidgets/vgraphicssimpletextitem.h +++ b/src/libs/vwidgets/vgraphicssimpletextitem.h @@ -40,7 +40,7 @@ class VGraphicsSimpleTextItem : public QObject, public QGraphicsSimpleTextItem { Q_OBJECT public: - VGraphicsSimpleTextItem(QGraphicsItem *parent = nullptr); + explicit VGraphicsSimpleTextItem(QGraphicsItem *parent = nullptr); VGraphicsSimpleTextItem( const QString & text, QGraphicsItem *parent = nullptr ); virtual ~VGraphicsSimpleTextItem() Q_DECL_OVERRIDE; diff --git a/src/libs/vwidgets/vmaingraphicsview.h b/src/libs/vwidgets/vmaingraphicsview.h index a10007e71..755bbd909 100644 --- a/src/libs/vwidgets/vmaingraphicsview.h +++ b/src/libs/vwidgets/vmaingraphicsview.h @@ -69,7 +69,7 @@ class GraphicsViewZoom : public QObject { Q_OBJECT public: - GraphicsViewZoom(QGraphicsView* view); + explicit GraphicsViewZoom(QGraphicsView* view); void gentle_zoom(double factor); void set_modifiers(Qt::KeyboardModifiers modifiers); void set_zoom_factor_base(double value); diff --git a/src/libs/vwidgets/vwidgetpopup.h b/src/libs/vwidgets/vwidgetpopup.h index aadb6cc19..8f6153c44 100644 --- a/src/libs/vwidgets/vwidgetpopup.h +++ b/src/libs/vwidgets/vwidgetpopup.h @@ -51,7 +51,7 @@ public: If \a parent not specified (default), then popup widget gets attribute Qt::WA_DeleteOnClose and will be deleted after close. */ - VWidgetPopup(QWidget *parent = 0); + explicit VWidgetPopup(QWidget *parent = 0); /** Sets widget to be popped up to \a widget. If \a own is true then the widget will be reparented to the popup widget. diff --git a/src/test/ValentinaTest/tst_tapecommandline.h b/src/test/ValentinaTest/tst_tapecommandline.h index 98f97a7dd..a1ab5b18f 100644 --- a/src/test/ValentinaTest/tst_tapecommandline.h +++ b/src/test/ValentinaTest/tst_tapecommandline.h @@ -35,7 +35,7 @@ class TST_TapeCommandLine : public AbstractTest { Q_OBJECT public: - TST_TapeCommandLine(QObject *parent = 0); + explicit TST_TapeCommandLine(QObject *parent = 0); private slots: void init(); diff --git a/src/test/ValentinaTest/tst_valentinacommandline.h b/src/test/ValentinaTest/tst_valentinacommandline.h index 974a31a4a..148ede2ec 100644 --- a/src/test/ValentinaTest/tst_valentinacommandline.h +++ b/src/test/ValentinaTest/tst_valentinacommandline.h @@ -35,7 +35,7 @@ class TST_ValentinaCommandLine : public AbstractTest { Q_OBJECT public: - TST_ValentinaCommandLine(QObject *parent = 0); + explicit TST_ValentinaCommandLine(QObject *parent = 0); private slots: void init(); diff --git a/src/test/ValentinaTest/tst_vlayoutdetail.h b/src/test/ValentinaTest/tst_vlayoutdetail.h index 1fe004a52..2b0f08509 100644 --- a/src/test/ValentinaTest/tst_vlayoutdetail.h +++ b/src/test/ValentinaTest/tst_vlayoutdetail.h @@ -35,7 +35,7 @@ class TST_VLayoutDetail : public AbstractTest { Q_OBJECT public: - TST_VLayoutDetail(QObject *parent = 0); + explicit TST_VLayoutDetail(QObject *parent = 0); private slots: void RemoveDublicates() const;