diff --git a/src/container/calculator.h b/src/container/calculator.h index 34513faf0..6618e310a 100644 --- a/src/container/calculator.h +++ b/src/container/calculator.h @@ -158,6 +158,7 @@ private: * @brief serror report an error * @param error error code */ + // cppcheck-suppress functionStatic void serror(qint32 error); /** * @brief look_up finding the internal format for the current token in the token table. diff --git a/src/container/vcontainer.cpp b/src/container/vcontainer.cpp index 0a7e7c59a..a3319346c 100644 --- a/src/container/vcontainer.cpp +++ b/src/container/vcontainer.cpp @@ -215,7 +215,7 @@ void VContainer::UpdateId(qint64 newId) } } -QVector VContainer::CorrectEquidistantPoints(const QVector &points) const +QVector VContainer::CorrectEquidistantPoints(const QVector &points) { QVector correctPoints; if(points.size()<4)//Better don't check if only three points. We can destroy equidistant. @@ -387,7 +387,7 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const return path; } -QVector VContainer::biasPoints(const QVector &points, const qreal &mx, const qreal &my) const +QVector VContainer::biasPoints(const QVector &points, const qreal &mx, const qreal &my) { QVector p; for (qint32 i = 0; i < points.size(); ++i) @@ -400,7 +400,7 @@ QVector VContainer::biasPoints(const QVector &points, const qr return p; } -QPainterPath VContainer::Equidistant(QVector points, const Detail::Equidistant &eqv, const qreal &width) const +QPainterPath VContainer::Equidistant(QVector points, const Detail::Equidistant &eqv, const qreal &width) { QPainterPath ekv; QVector ekvPoints; @@ -483,7 +483,7 @@ QPointF VContainer::SingleParallelPoint(const QLineF &line, const qreal &angle, return pLine.p2(); } -QVector VContainer::EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width) const +QVector VContainer::EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width) { Q_ASSERT(width > 0); QVector points; @@ -533,7 +533,7 @@ QVector VContainer::EkvPoint(const QLineF &line1, const QLineF &line2, return points; } -QVector VContainer::CheckLoops(const QVector &points) const +QVector VContainer::CheckLoops(const QVector &points) { QVector ekvPoints; /*If we got less than 4 points no need seek loops.*/ @@ -848,7 +848,7 @@ void VContainer::CreateManTableIGroup () AddStandardTableCell("Sb", VStandardTableRow(492, 15, 5)); } -QVector VContainer::GetReversePoint(const QVector &points) const +QVector VContainer::GetReversePoint(const QVector &points) { Q_ASSERT(points.size() > 0); QVector reversePoints; @@ -859,7 +859,7 @@ QVector VContainer::GetReversePoint(const QVector &points) con return reversePoints; } -qreal VContainer::GetLengthContour(const QVector &contour, const QVector &newPoints) const +qreal VContainer::GetLengthContour(const QVector &contour, const QVector &newPoints) { qreal length = 0; QVector points; diff --git a/src/container/vcontainer.h b/src/container/vcontainer.h index e19823197..344f8af65 100644 --- a/src/container/vcontainer.h +++ b/src/container/vcontainer.h @@ -204,6 +204,7 @@ public: * @param secondPoint id of second point of line * @return name of line */ + // cppcheck-suppress functionStatic QString GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint) const; /** * @brief GetNameLineAngle return name of line angle @@ -211,6 +212,7 @@ public: * @param secondPoint id of second point of line * @return name of angle of line */ + // cppcheck-suppress functionStatic QString GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint) const; /** * @brief UpdatePoint update point by id @@ -373,7 +375,12 @@ public: * @param newId id */ static void UpdateId(qint64 newId); - QVector CorrectEquidistantPoints(const QVector &points) const; + /** + * @brief CorrectEquidistantPoints clear equivalent points and remove point on line from equdistant. + * @param points list of points equdistant. + * @return corrected list. + */ + static QVector CorrectEquidistantPoints(const QVector &points); /** * @brief ContourPath create painter path for detail * @param idDetail id of detail @@ -387,7 +394,7 @@ public: * @param my offset respect to y * @return new vector biased points */ - QVector biasPoints(const QVector &points, const qreal &mx, const qreal &my) const; + static QVector biasPoints(const QVector &points, const qreal &mx, const qreal &my); /** * @brief Equidistant create equidistant painter path for detail * @param points vector of points @@ -395,7 +402,7 @@ public: * @param width width of equidistant * @return return painter path of equidistant */ - QPainterPath Equidistant(QVector points, const Detail::Equidistant &eqv, const qreal &width)const; + static QPainterPath Equidistant(QVector points, const Detail::Equidistant &eqv, const qreal &width); /** * @brief ParallelLine create parallel line * @param line starting line @@ -418,13 +425,13 @@ public: * @param width width of equidistant * @return vector of points */ - QVector EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width)const; + static QVector EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width); /** * @brief CheckLoops seek and delete loops in equidistant * @param points vector of points of equidistant * @return vector of points of equidistant */ - QVector CheckLoops(const QVector &points) const; + static QVector CheckLoops(const QVector &points); /** * @brief PrepareDetails prepare detail for creation layout * @param list list of details @@ -480,14 +487,14 @@ private: * @param points container with points * @return reverced points */ - QVector GetReversePoint(const QVector &points)const; + static QVector GetReversePoint(const QVector &points); /** * @brief GetLengthContour return length of contour * @param contour container with points of contour * @param newPoints point whos we try to add to contour * @return length length of contour */ - qreal GetLengthContour(const QVector &contour, const QVector &newPoints)const; + static qreal GetLengthContour(const QVector &contour, const QVector &newPoints); template /** * @brief GetObject return object from container @@ -495,6 +502,7 @@ private: * @param id id of object * @return Object */ + // cppcheck-suppress functionStatic const val GetObject(const QHash &obj, key id) const; template /** @@ -503,6 +511,7 @@ private: * @param id id of object * @return Object */ + // cppcheck-suppress functionStatic val GetVariable(const QHash &obj, key id) const; template /** diff --git a/src/geometry/vdetail.cpp b/src/geometry/vdetail.cpp index fc9573850..61b112d47 100644 --- a/src/geometry/vdetail.cpp +++ b/src/geometry/vdetail.cpp @@ -268,7 +268,7 @@ QVector VDetail::listNodePoint() const return list; } -ptrdiff_t VDetail::indexOfNode(const QVector &list, const qint64 &id) const +ptrdiff_t VDetail::indexOfNode(const QVector &list, const qint64 &id) { for (ptrdiff_t i = 0; i < list.size(); ++i) { diff --git a/src/geometry/vdetail.h b/src/geometry/vdetail.h index 189b2dcd0..9bdaa6eaf 100644 --- a/src/geometry/vdetail.h +++ b/src/geometry/vdetail.h @@ -282,7 +282,7 @@ private: * @param id object (arc, point, spline, splinePath) id. * @return index in list or -1 id can't find. */ - ptrdiff_t indexOfNode(const QVector &list, const qint64 &id) const; + static ptrdiff_t indexOfNode(const QVector &list, const qint64 &id); }; #endif // VDETAIL_H diff --git a/src/geometry/vspline.cpp b/src/geometry/vspline.cpp index 4b0c0c68e..ecde28308 100644 --- a/src/geometry/vspline.cpp +++ b/src/geometry/vspline.cpp @@ -326,6 +326,7 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, da1 = x3 - x1; 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/mainwindow.cpp b/src/mainwindow.cpp index bef6bcc0f..e2d5fd966 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -93,13 +93,12 @@ MainWindow::MainWindow(QWidget *parent) { ui->setupUi(this); static const char * GENERIC_ICON_TO_CHECK = "document-open"; - static const char * FALLBACK_ICON_THEME = "win.icon.theme"; if (!QIcon::hasThemeIcon(GENERIC_ICON_TO_CHECK)) { //If there is no default working icon theme then we should //use an icon theme that we provide via a .qrc file //This case happens under Windows and Mac OS X //This does not happen under GNOME or KDE - QIcon::setThemeName(FALLBACK_ICON_THEME); + QIcon::setThemeName("win.icon.theme"); ui->actionNew->setIcon(QIcon::fromTheme("document-new")); ui->actionOpen->setIcon(QIcon::fromTheme("document-open")); ui->actionSave->setIcon(QIcon::fromTheme("document-save")); diff --git a/src/tools/drawTools/vtoolalongline.cpp b/src/tools/drawTools/vtoolalongline.cpp index d08b36ec9..5fab3be25 100644 --- a/src/tools/drawTools/vtoolalongline.cpp +++ b/src/tools/drawTools/vtoolalongline.cpp @@ -86,6 +86,7 @@ void VToolAlongLine::SetFactor(qreal factor) RefreshGeometry(); } +//cppcheck-suppress unusedFunction void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { ContextMenu(dialogAlongLine, this, event); diff --git a/src/tools/drawTools/vtoolarc.cpp b/src/tools/drawTools/vtoolarc.cpp index bc9dce3f8..40fef4eb8 100644 --- a/src/tools/drawTools/vtoolarc.cpp +++ b/src/tools/drawTools/vtoolarc.cpp @@ -226,12 +226,14 @@ void VToolArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) QGraphicsItem::mouseReleaseEvent(event); } +//cppcheck-suppress unusedFunction void VToolArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); this->setPen(QPen(currentColor, widthMainLine/factor)); } +//cppcheck-suppress unusedFunction void VToolArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); diff --git a/src/tools/drawTools/vtoolpointofcontact.cpp b/src/tools/drawTools/vtoolpointofcontact.cpp index 63aa548be..3ff52733a 100644 --- a/src/tools/drawTools/vtoolpointofcontact.cpp +++ b/src/tools/drawTools/vtoolpointofcontact.cpp @@ -35,7 +35,7 @@ VToolPointOfContact::VToolPointOfContact(VDomDocument *doc, VContainer *data, co const QString &radius, const qint64 ¢er, const qint64 &firstPointId, const qint64 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) - : VToolPoint(doc, data, id, parent), radius(radius), center(center), firstPointId(firstPointId), + : VToolPoint(doc, data, id, parent), arcRadius(radius), center(center), firstPointId(firstPointId), secondPointId(secondPointId), dialogPointOfContact(QSharedPointer()) { if (typeCreation == Tool::FromGui) @@ -52,7 +52,7 @@ void VToolPointOfContact::setDialog() { Q_ASSERT(dialogPointOfContact.isNull() == false); const VPointF *p = VAbstractTool::data.GeometricObject(id); - dialogPointOfContact->setRadius(radius); + dialogPointOfContact->setRadius(arcRadius); dialogPointOfContact->setCenter(center, id); dialogPointOfContact->setFirstPoint(firstPointId, id); dialogPointOfContact->setSecondPoint(secondPointId, id); @@ -154,7 +154,7 @@ void VToolPointOfContact::FullUpdateFromFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - radius = domElement.attribute(AttrRadius, ""); + arcRadius = domElement.attribute(AttrRadius, ""); center = domElement.attribute(AttrCenter, "").toLongLong(); firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); @@ -207,7 +207,7 @@ void VToolPointOfContact::AddToFile() SetAttribute(domElement, AttrMx, toMM(point->mx())); SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrRadius, radius); + SetAttribute(domElement, AttrRadius, arcRadius); SetAttribute(domElement, AttrCenter, center); SetAttribute(domElement, AttrFirstPoint, firstPointId); SetAttribute(domElement, AttrSecondPoint, secondPointId); @@ -224,7 +224,7 @@ void VToolPointOfContact::RefreshDataInFile() SetAttribute(domElement, AttrName, point->name()); SetAttribute(domElement, AttrMx, toMM(point->mx())); SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrRadius, radius); + SetAttribute(domElement, AttrRadius, arcRadius); SetAttribute(domElement, AttrCenter, center); SetAttribute(domElement, AttrFirstPoint, firstPointId); SetAttribute(domElement, AttrSecondPoint, secondPointId); diff --git a/src/tools/drawTools/vtoolpointofcontact.h b/src/tools/drawTools/vtoolpointofcontact.h index 680f19a69..390451bea 100644 --- a/src/tools/drawTools/vtoolpointofcontact.h +++ b/src/tools/drawTools/vtoolpointofcontact.h @@ -51,7 +51,7 @@ public: * @param parent parent object. */ VToolPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &radius, const qint64 ¢er, + const QString &arcRadius, const qint64 ¢er, const qint64 &firstPointId, const qint64 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** @@ -66,7 +66,7 @@ public: * @param secondPoint second line point. * @return point intersection. */ - static QPointF FindPoint(const qreal &radius, const QPointF ¢er, const QPointF &firstPoint, + static QPointF FindPoint(const qreal &arcRadius, const QPointF ¢er, const QPointF &firstPoint, const QPointF &secondPoint); /** * @brief Create help create tool from GUI. @@ -93,7 +93,7 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const qint64 _id, const QString &radius, const qint64 ¢er, + static void Create(const qint64 _id, const QString &arcRadius, const qint64 ¢er, const qint64 &firstPointId, const qint64 &secondPointId, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); @@ -140,7 +140,7 @@ private: /** * @brief radius string with formula radius arc. */ - QString radius; + QString arcRadius; /** * @brief center id center arc point. */ diff --git a/src/tools/vtooldetail.cpp b/src/tools/vtooldetail.cpp index 8ac10239e..d96629519 100644 --- a/src/tools/vtooldetail.cpp +++ b/src/tools/vtooldetail.cpp @@ -385,6 +385,7 @@ void VToolDetail::RefreshGeometry() } template +//cppcheck-suppress unusedFunction void VToolDetail::InitTool(VMainGraphicsScene *scene, const VNodeDetail &node) { QHash* tools = doc->getTools(); diff --git a/src/widgets/doubledelegate.cpp b/src/widgets/doubledelegate.cpp index cf03ee353..ebad08516 100644 --- a/src/widgets/doubledelegate.cpp +++ b/src/widgets/doubledelegate.cpp @@ -30,6 +30,7 @@ #include +//cppcheck-suppress unusedFunction QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const { @@ -43,6 +44,7 @@ QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOption return editor; } +//cppcheck-suppress unusedFunction void DoubleSpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const { qreal value = index.model()->data(index, Qt::EditRole).toDouble(); @@ -52,6 +54,7 @@ void DoubleSpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &in spinBox->setValue(value); } +//cppcheck-suppress unusedFunction void DoubleSpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { QDoubleSpinBox *spinBox = qobject_cast(editor); @@ -62,6 +65,7 @@ void DoubleSpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *mo model->setData(index, value, Qt::EditRole); } +//cppcheck-suppress unusedFunction void DoubleSpinBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const { diff --git a/src/widgets/vmaingraphicsview.cpp b/src/widgets/vmaingraphicsview.cpp index d17023090..c65e2206a 100644 --- a/src/widgets/vmaingraphicsview.cpp +++ b/src/widgets/vmaingraphicsview.cpp @@ -42,6 +42,7 @@ VMainGraphicsView::VMainGraphicsView(QWidget *parent) this->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); } +//cppcheck-suppress unusedFunction void VMainGraphicsView::wheelEvent(QWheelEvent *event) { int numSteps = event->delta() / 8 / 15; // see QWheelEvent documentation