From ea072a35f4dcf4602569e731469cf1d18ad1cd60 Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 12 Sep 2013 16:25:24 +0300 Subject: [PATCH] Fix some warning after checking cppcheck. --- Valentina.pro | 2 - container/calculator.h | 12 +- container/vcontainer.cpp | 14 +-- container/vcontainer.h | 19 +-- dialogs/dialogarc.cpp | 2 +- dialogs/dialogincrements.cpp | 1 - dialogs/dialogincrements.h | 2 - dialogs/dialoglineintersect.cpp | 2 +- dialogs/dialogtool.cpp | 2 +- dialogs/dialogtool.h | 2 +- geometry/varc.cpp | 6 +- geometry/varc.h | 2 +- geometry/vspline.cpp | 136 ++++++++++----------- geometry/vspline.h | 12 +- geometry/vsplinepath.cpp | 8 +- geometry/vsplinepath.h | 2 +- mainwindow.cpp | 2 - tools/drawTools/vtoollinepoint.cpp | 4 +- tools/modelingTools/vmodelinglinepoint.cpp | 4 +- tools/nodeDetails/vnodearc.cpp | 2 +- tools/nodeDetails/vnodepoint.cpp | 2 +- tools/nodeDetails/vnodespline.cpp | 2 +- tools/nodeDetails/vnodesplinepath.cpp | 2 +- tools/vdatatool.cpp | 2 +- tools/vdatatool.h | 2 +- widgets/delegate.cpp | 10 +- widgets/delegate.h | 74 ----------- widgets/doubledelegate.cpp | 10 +- 28 files changed, 126 insertions(+), 214 deletions(-) delete mode 100644 widgets/delegate.h diff --git a/Valentina.pro b/Valentina.pro index b1ee66c45..edcdca4ad 100644 --- a/Valentina.pro +++ b/Valentina.pro @@ -24,7 +24,6 @@ SOURCES += main.cpp\ dialogs/dialogincrements.cpp \ container/vstandarttablecell.cpp \ container/vincrementtablerow.cpp \ - widgets/delegate.cpp \ widgets/doubledelegate.cpp \ dialogs/dialogendline.cpp \ tools/drawTools/vtoolendline.cpp \ @@ -103,7 +102,6 @@ HEADERS += mainwindow.h \ dialogs/dialogincrements.h \ container/vstandarttablecell.h \ container/vincrementtablerow.h \ - widgets/delegate.h \ widgets/doubledelegate.h \ dialogs/dialogendline.h \ tools/drawTools/vtoolendline.h \ diff --git a/container/calculator.h b/container/calculator.h index 45f8d0025..78c9c246f 100644 --- a/container/calculator.h +++ b/container/calculator.h @@ -79,7 +79,7 @@ private: * @param c символ. * @return true - належить рядку, false - не належить рядку. */ - bool StrChr(QString string, QChar c); + static bool StrChr(QString string, QChar c); /** * @brief putback повертає зчитану лексему назад у потік. */ @@ -120,13 +120,13 @@ private: * @param r перший елемент. * @param h другий елемент. */ - void arith(QChar o, qreal *r, qreal *h); + static void arith(QChar o, qreal *r, qreal *h); /** * @brief unary метод зміни знаку. * @param o символ знаку. * @param r елемент. */ - void unary(QChar o, qreal *r); + static void unary(QChar o, qreal *r); /** * @brief find_var метод знаходить змінну за іменем. * @param s ім'я змінної. @@ -139,19 +139,19 @@ private: * @param s ім'я лексеми. * @return внутрішній номер лексеми. */ - char look_up(QString s); + static char look_up(QString s); /** * @brief isdelim повертає "істино", якщо с розділювач. * @param c символ. * @return розділювач, або ні. */ - bool isdelim(QChar c); + static bool isdelim(QChar c); /** * @brief iswhite перевіряє чи с пробіл чи табуляція. * @param c символ. * @return так або ні. */ - bool iswhite(QChar c); + static bool iswhite(QChar c); }; #endif // CALCULATOR_H diff --git a/container/vcontainer.cpp b/container/vcontainer.cpp index 3cc8da9f4..a7f820704 100644 --- a/container/vcontainer.cpp +++ b/container/vcontainer.cpp @@ -18,7 +18,7 @@ VContainer::VContainer():base(QMap()), points(QMap -val VContainer::GetObject(const QMap &obj, key id)const{ +val VContainer::GetObject(const QMap &obj, key id){ if(obj.contains(id)){ return obj.value(id); } else { @@ -134,13 +134,13 @@ qint64 VContainer::getId(){ } qint64 VContainer::getNextId(){ - ++_id; + this->_id++; return _id; } void VContainer::UpdateId(qint64 newId){ - if(newId > _id){ - _id = newId; + if(newId > this->_id){ + this->_id = newId; } } @@ -316,14 +316,14 @@ QPainterPath VContainer::Equidistant(QVector points, const Detail::Equi return ekv; } -QLineF VContainer::ParallelLine(const QLineF &line, qreal width) const{ +QLineF VContainer::ParallelLine(const QLineF &line, qreal width){ Q_ASSERT(width > 0); QLineF paralel = QLineF (SingleParallelPoint(line, 90, width), SingleParallelPoint(QLineF(line.p2(), line.p1()), -90, width)); return paralel; } -QPointF VContainer::SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width) const{ +QPointF VContainer::SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width){ Q_ASSERT(width > 0); QLineF l = line; l.setAngle( l.angle() + angle ); diff --git a/container/vcontainer.h b/container/vcontainer.h index d85b2880a..eeaff8bf6 100644 --- a/container/vcontainer.h +++ b/container/vcontainer.h @@ -23,7 +23,7 @@ public: * @brief VContainer */ VContainer(); - const VContainer &operator=(const VContainer &data); + VContainer &operator=(const VContainer &data); VContainer(const VContainer &data); void setData(const VContainer &data); /** @@ -44,7 +44,7 @@ public: VSplinePath GetSplinePath(qint64 id) const; VSplinePath GetModelingSplinePath(qint64 id) const; VDetail GetDetail(qint64 id) const; - qint64 getId(); + static qint64 getId(); qint64 AddPoint(const VPointF& point); qint64 AddModelingPoint(const VPointF& point); qint64 AddDetail(const VDetail& detail); @@ -101,7 +101,7 @@ public: qint32 growth() const; qreal FindVar(const QString& name, bool *ok)const; bool IncrementTableContains(const QString& name); - qint64 getNextId(); + static qint64 getNextId(); void RemoveIncrementTableRow(const QString& name); const QMap *DataPoints() const; const QMap *DataModelingPoints() const; @@ -119,13 +119,13 @@ public: const QMap *DataSplinePaths() const; const QMap *DataModelingSplinePaths() const; const QMap *DataDetails() const; - void UpdateId(qint64 newId); + static void UpdateId(qint64 newId); void IncrementReferens(qint64 id, Scene::Type obj, Draw::Mode mode = Draw::Calculation); QPainterPath ContourPath(qint64 idDetail) const; QPainterPath Equidistant(QVector points, const Detail::Equidistant &eqv, const qreal &width)const; - QLineF ParallelLine(const QLineF &line, qreal width ) const; - QPointF SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width)const; + static QLineF ParallelLine(const QLineF &line, qreal width ); + static QPointF SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width); QVector EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width)const; void PrepareDetails(QVector & list)const; private: @@ -146,9 +146,10 @@ private: QMap splinePaths; QMap modelingSplinePaths; QMap details; - template val GetObject(const QMap &obj, key id) const; - template void UpdateObject(QMap &obj, const qint64 &id, const val& point); - template qint64 AddObject(QMap &obj, const val& value); + template static val GetObject(const QMap &obj, key id); + template static void UpdateObject(QMap &obj, const qint64 &id, + const val& point); + template static qint64 AddObject(QMap &obj, const val& value); void CreateManTableIGroup (); QVector GetReversePoint(const QVector &points)const; qreal GetLengthContour(const QVector &contour, const QVector &newPoints)const; diff --git a/dialogs/dialogarc.cpp b/dialogs/dialogarc.cpp index f2e9dd15e..6dda5d861 100644 --- a/dialogs/dialogarc.cpp +++ b/dialogs/dialogarc.cpp @@ -169,7 +169,7 @@ void DialogArc::F2Changed(){ void DialogArc::CheckState(){ Q_CHECK_PTR(bOk); - bOk->setEnabled(flagRadius & flagF1 & flagF2); + bOk->setEnabled(flagRadius && flagF1 && flagF2); } void DialogArc::EvalRadius(){ diff --git a/dialogs/dialogincrements.cpp b/dialogs/dialogincrements.cpp index 4d148a322..7f9d19237 100644 --- a/dialogs/dialogincrements.cpp +++ b/dialogs/dialogincrements.cpp @@ -2,7 +2,6 @@ #include "ui_dialogincrements.h" #include #include -#include "widgets/delegate.h" #include "widgets/doubledelegate.h" #include "container/vincrementtablerow.h" diff --git a/dialogs/dialogincrements.h b/dialogs/dialogincrements.h index 3a257643f..9bfaba61f 100644 --- a/dialogs/dialogincrements.h +++ b/dialogs/dialogincrements.h @@ -1,8 +1,6 @@ #ifndef DIALOGINCREMENTS_H #define DIALOGINCREMENTS_H -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Weffc++" #include "dialogtool.h" #include #include "xml/vdomdocument.h" diff --git a/dialogs/dialoglineintersect.cpp b/dialogs/dialoglineintersect.cpp index 5369b7eb9..6a1576776 100644 --- a/dialogs/dialoglineintersect.cpp +++ b/dialogs/dialoglineintersect.cpp @@ -133,7 +133,7 @@ void DialogLineIntersect::P2Line2Changed(int index){ void DialogLineIntersect::CheckState(){ Q_CHECK_PTR(bOk); - bOk->setEnabled(flagName & flagPoint); + bOk->setEnabled(flagName && flagPoint); } bool DialogLineIntersect::CheckIntersecion(){ diff --git a/dialogs/dialogtool.cpp b/dialogs/dialogtool.cpp index 1b75e1abb..a84913a83 100644 --- a/dialogs/dialogtool.cpp +++ b/dialogs/dialogtool.cpp @@ -175,7 +175,7 @@ qint64 DialogTool::getCurrentPointId(QComboBox *box) const{ void DialogTool::CheckState(){ Q_CHECK_PTR(bOk); - bOk->setEnabled(flagFormula & flagName); + bOk->setEnabled(flagFormula && flagName); } diff --git a/dialogs/dialogtool.h b/dialogs/dialogtool.h index 0e82003da..8eabfa4ec 100644 --- a/dialogs/dialogtool.h +++ b/dialogs/dialogtool.h @@ -82,7 +82,7 @@ protected: void setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 &value, const qint64 &id) const; qint64 getCurrentPointId(QComboBox *box) const; DialogTool(const DialogTool &dialog); - const DialogTool &operator=(const DialogTool &dialog); + DialogTool &operator=(const DialogTool &dialog); }; #endif // DIALOGTOOL_H diff --git a/geometry/varc.cpp b/geometry/varc.cpp index 75876efc3..36d43ad5c 100644 --- a/geometry/varc.cpp +++ b/geometry/varc.cpp @@ -19,7 +19,7 @@ VArc::VArc(const VArc &arc): f1(arc.GetF1()), formulaF1(arc.GetFormulaF1()), f2( idObject(arc.getIdObject()){ } -const VArc &VArc::operator =(const VArc &arc){ +VArc &VArc::operator =(const VArc &arc){ this->points = arc.GetDataPoints(); this->f1 = arc.GetF1(); this->formulaF1 = arc.GetFormulaF1(); @@ -29,6 +29,8 @@ const VArc &VArc::operator =(const VArc &arc){ this->formulaRadius = arc.GetFormulaRadius(); this->center = arc.GetCenter(); this->mode = arc.getMode(); + this->_referens = 0; + this->idObject = arc.getIdObject(); return *this; } @@ -168,8 +170,8 @@ QVector VArc::SplOfArc(qint32 number) const{ anglF2 = f2 - 90 ; } if ( i + 1 == number ){ - return VSpline::SplinePoints(GetP1 (), GetP2 (), anglF1, anglF2, 1., 1., 1.); f1 = f2; + return VSpline::SplinePoints(GetP1 (), GetP2 (), anglF1, anglF2, 1., 1., 1.); } } return QVector(); diff --git a/geometry/varc.h b/geometry/varc.h index c32391c64..6c55c9977 100644 --- a/geometry/varc.h +++ b/geometry/varc.h @@ -27,7 +27,7 @@ public: qreal f1, QString formulaF1, qreal f2 , QString formulaF2, Draw::Mode mode = Draw::Calculation, qint64 idObject = 0); VArc(const VArc &arc); - const VArc& operator= (const VArc &arc); + VArc& operator= (const VArc &arc); /** * @brief GetF1 повертає початковий кут дуги. * @return повертає кут в градусах. diff --git a/geometry/vspline.cpp b/geometry/vspline.cpp index c306c5632..26067de0e 100644 --- a/geometry/vspline.cpp +++ b/geometry/vspline.cpp @@ -234,29 +234,29 @@ QLineF::IntersectType VSpline::CrossingSplLine ( const QLineF &line, QPointF *in // CutSpline ( length, curFir, curSec ); //} -void VSpline::PutAlongSpl (QPointF &moveP, qreal move ) const{ - if ( GetLength () < move ){ - qDebug()<<"Довжина більше довжини сплайну."; - qDebug()< VSpline::GetPoints () const{ return GetPoints(GetPointP1().toQPointF(), p2, p3, GetPointP4().toQPointF()); @@ -637,7 +637,7 @@ void VSpline::decrementReferens(){ 2 - 1 real root + complex roots imaginary part is zero (i.e. 2 real roots). */ -qint32 VSpline::Cubic(qreal *x, qreal a, qreal b, qreal c)const{ +qint32 VSpline::Cubic(qreal *x, qreal a, qreal b, qreal c){ qreal q,r,r2,q3; q = (a*a - 3.*b)/9.; @@ -676,56 +676,56 @@ qint32 VSpline::Cubic(qreal *x, qreal a, qreal b, qreal c)const{ } } -qreal VSpline::calc_t (qreal curve_coord1, qreal curve_coord2, qreal curve_coord3, - qreal curve_coord4, qreal point_coord) const{ - qreal P1, P2, P3, P4, Bt; - qreal a, b, c, d, ret_t; +//qreal VSpline::calc_t (qreal curve_coord1, qreal curve_coord2, qreal curve_coord3, +// qreal curve_coord4, qreal point_coord) const{ +// qreal P1, P2, P3, P4, Bt; +// qreal a, b, c, d, ret_t; - qreal *t = static_cast(malloc(3*sizeof(qreal))); - P1 = curve_coord1; - P2 = curve_coord2; - P3 = curve_coord3; - P4 = curve_coord4; - Bt = point_coord; +// qreal *t = static_cast(malloc(3*sizeof(qreal))); +// P1 = curve_coord1; +// P2 = curve_coord2; +// P3 = curve_coord3; +// P4 = curve_coord4; +// Bt = point_coord; - a = -P1 + 3*P2 - 3*P3 + P4; - b = 3*P1 - 6*P2 + 3*P3; - c = -3*P1 + 3*P2; - d = -Bt + P1; +// a = -P1 + 3*P2 - 3*P3 + P4; +// b = 3*P1 - 6*P2 + 3*P3; +// c = -3*P1 + 3*P2; +// d = -Bt + P1; - if(Cubic(t, b/a, c/a, d/a) == 3){ - ret_t = t[2]; - } else { - ret_t = t[0]; - } - /* - * Повертається три значення, але експереминтально знайдено що шукане - * значення знаходиться в третьому. - */ +// if(Cubic(t, b/a, c/a, d/a) == 3){ +// ret_t = t[2]; +// } else { +// ret_t = t[0]; +// } +// /* +// * Повертається три значення, але експереминтально знайдено що шукане +// * значення знаходиться в третьому. +// */ - free(t); - if(ret_t<0 || ret_t>1){ - qDebug()<<"Неправильне значення параметра. фунція calc_t"; - throw"Неправильне значення параметра. фунція calc_t"; - } - return ret_t; -} +// free(t); +// if(ret_t<0 || ret_t>1){ +// qDebug()<<"Неправильне значення параметра. фунція calc_t"; +// throw"Неправильне значення параметра. фунція calc_t"; +// } +// return ret_t; +//} /* * Функція знаходить підходяще значення параметна t якому відповідає точка на сплайні. */ -qreal VSpline::param_t (QPointF pBt)const{ - qreal t_x, t_y; - t_x = calc_t (GetPointP1().x(), p2.x(), p3.x(), GetPointP4().x(), pBt.x()); - t_y = calc_t (GetPointP1().y(), p2.y(), p3.y(), GetPointP4().y(), pBt.y()); - /* - * Порівнюємо значення по х і по у і визначаємо найбільше. Це значення і - * буде шуканим. - */ - if(t_x>t_y) - return t_x; - else - return t_y; -} +//qreal VSpline::param_t (QPointF pBt)const{ +// qreal t_x, t_y; +// t_x = calc_t (GetPointP1().x(), p2.x(), p3.x(), GetPointP4().x(), pBt.x()); +// t_y = calc_t (GetPointP1().y(), p2.y(), p3.y(), GetPointP4().y(), pBt.y()); +// /* +// * Порівнюємо значення по х і по у і визначаємо найбільше. Це значення і +// * буде шуканим. +// */ +// if(t_x>t_y) +// return t_x; +// else +// return t_y; +//} //void VSpline::Mirror(const QPointF Pmirror){ // QPointF P1 = p1; @@ -779,7 +779,7 @@ void VSpline::setIdObject(const qint64 &value){ idObject = value; } -const VSpline &VSpline::operator =(const VSpline &spline){ +VSpline &VSpline::operator =(const VSpline &spline){ this->p1 = spline.GetP1 (); this->p2 = spline.GetP2 (); this->p3 = spline.GetP3 (); diff --git a/geometry/vspline.h b/geometry/vspline.h index 7c4604a56..d9cbd96fe 100644 --- a/geometry/vspline.h +++ b/geometry/vspline.h @@ -143,7 +143,7 @@ public: * @param moveP точка яка розміщується на сплайні. * @param move довжина від початку сплайну. */ - void PutAlongSpl ( QPointF &moveP, qreal move ) const; +// void PutAlongSpl ( QPointF &moveP, qreal move ) const; /** * @brief GetPoints повертає точки з яких складається сплайн. * @return список точок. @@ -168,7 +168,7 @@ public: qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve); qint64 getIdObject() const; void setIdObject(const qint64 &value); - const VSpline &operator=(const VSpline &spl); + VSpline &operator=(const VSpline &spl); protected: /** * @brief GetPoints повертає точки з яких складається сплайн. @@ -254,7 +254,7 @@ private: * @param c коефіцієнт. * @return повертає корені рівняння. */ - qint32 Cubic(qreal *x, qreal a, qreal b, qreal c)const; + static qint32 Cubic(qreal *x, qreal a, qreal b, qreal c); /** * @brief calc_t знаходить параметр t якому відповідає точка на сплайні. * @param curve_coord1 координата Х або У кривої. @@ -264,14 +264,14 @@ private: * @param point_coord координата Х або У точки на кривій. * @return */ - qreal calc_t (qreal curve_coord1, qreal curve_coord2, qreal curve_coord3, - qreal curve_coord4, qreal point_coord)const; +// static qreal calc_t (qreal curve_coord1, qreal curve_coord2, qreal curve_coord3, +// qreal curve_coord4, qreal point_coord)const; /** * @brief param_t знаходить підходяще значення параметра t якому відповідає точка на сплайні * @param pBt точка для якої шукається значення параметра t. * @return підходяще значення t. */ - qreal param_t (QPointF pBt)const; +// qreal param_t (QPointF pBt)const; }; #endif // VSPLINE_H diff --git a/geometry/vsplinepath.cpp b/geometry/vsplinepath.cpp index 1057b180b..6b105b4f8 100644 --- a/geometry/vsplinepath.cpp +++ b/geometry/vsplinepath.cpp @@ -101,14 +101,14 @@ void VSplinePath::UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSp } } -VSplinePoint VSplinePath::GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos){ +VSplinePoint VSplinePath::GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const{ if(indexSpline < 1 || indexSpline > Count()){ throw "Такого сплайну немає."; } if(pos == SplinePoint::FirstPoint){ - return path[indexSpline-1]; + return path.at(indexSpline-1); } else { - return path[indexSpline]; + return path.at(indexSpline); } } @@ -133,6 +133,8 @@ VSplinePath &VSplinePath::operator =(const VSplinePath &path){ this->kCurve = path.getKCurve(); this->mode = path.getMode(); this->points = path.GetDataPoints(); + this->_referens = 0; + this->idObject = path.getIdObject(); return *this; } diff --git a/geometry/vsplinepath.h b/geometry/vsplinepath.h index c96ef4f59..fb7b0cc65 100644 --- a/geometry/vsplinepath.h +++ b/geometry/vsplinepath.h @@ -43,7 +43,7 @@ public: qreal GetLength() const; const QMap *GetDataPoints() const; void UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point); - VSplinePoint GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos); + VSplinePoint GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const; /** * @brief Clear очищає шлях сплайнів. */ diff --git a/mainwindow.cpp b/mainwindow.cpp index 984cb7f86..5426125b8 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -88,7 +88,6 @@ void MainWindow::ActionNewDraw(){ dlg->resize(300,100); dlg->setTextValue(nDraw); while(1){ - bOk = false; bOk = dlg->exec(); nameDraw = dlg->textValue(); if(!bOk || nameDraw.isEmpty()){ @@ -145,7 +144,6 @@ void MainWindow::OptionDraw(){ dlg->resize(300,100); dlg->setTextValue(nDraw); while(1){ - bOk = false; bOk = dlg->exec(); nameDraw = dlg->textValue(); if(!bOk || nameDraw.isEmpty()){ diff --git a/tools/drawTools/vtoollinepoint.cpp b/tools/drawTools/vtoollinepoint.cpp index 3c96b37d9..b11a3c520 100644 --- a/tools/drawTools/vtoollinepoint.cpp +++ b/tools/drawTools/vtoollinepoint.cpp @@ -8,7 +8,7 @@ VToolLinePoint::VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 //Лінія, що з'єднує дві точки QPointF point1 = data->GetPoint(basePointId).toQPointF(); QPointF point2 = data->GetPoint(id).toQPointF(); - mainLine = new QGraphicsLineItem(QLineF(point1 - point2, point2 - point2), this); + mainLine = new QGraphicsLineItem(QLineF(point1 - point2, 0), this); mainLine->setPen(QPen(Qt::black, widthHairLine)); mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true); if(typeLine == "none"){ @@ -32,7 +32,7 @@ void VToolLinePoint::RefreshGeometry(){ VToolPoint::RefreshPointGeometry(VDrawTool::data.GetPoint(id)); QPointF point = VDrawTool::data.GetPoint(id).toQPointF(); QPointF basePoint = VDrawTool::data.GetPoint(basePointId).toQPointF(); - mainLine->setLine(QLineF(basePoint - point, point - point)); + mainLine->setLine(QLineF(basePoint - point, 0)); if(typeLine == "none"){ mainLine->setVisible(false); } else { diff --git a/tools/modelingTools/vmodelinglinepoint.cpp b/tools/modelingTools/vmodelinglinepoint.cpp index cee9233b8..535e0d244 100644 --- a/tools/modelingTools/vmodelinglinepoint.cpp +++ b/tools/modelingTools/vmodelinglinepoint.cpp @@ -8,7 +8,7 @@ VModelingLinePoint::VModelingLinePoint(VDomDocument *doc, VContainer *data, cons //Лінія, що з'єднує дві точки QPointF point1 = data->GetModelingPoint(basePointId).toQPointF(); QPointF point2 = data->GetModelingPoint(id).toQPointF(); - mainLine = new QGraphicsLineItem(QLineF(point1 - point2, point2 - point2), this); + mainLine = new QGraphicsLineItem(QLineF(point1 - point2, 0), this); mainLine->setPen(QPen(Qt::black, widthHairLine)); mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true); if(typeLine == "none"){ @@ -22,7 +22,7 @@ void VModelingLinePoint::RefreshGeometry(){ VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetModelingPoint(id)); QPointF point = VModelingTool::data.GetModelingPoint(id).toQPointF(); QPointF basePoint = VModelingTool::data.GetModelingPoint(basePointId).toQPointF(); - mainLine->setLine(QLineF(basePoint - point, point - point)); + mainLine->setLine(QLineF(basePoint - point, 0)); if(typeLine == "none"){ mainLine->setVisible(false); } else { diff --git a/tools/nodeDetails/vnodearc.cpp b/tools/nodeDetails/vnodearc.cpp index 231cb73c6..2dd564198 100644 --- a/tools/nodeDetails/vnodearc.cpp +++ b/tools/nodeDetails/vnodearc.cpp @@ -15,7 +15,7 @@ VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, VNodeArc *VNodeArc::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, Draw::Mode typeobject, Document::Enum parse, Tool::Enum typeCreation){ - VNodeArc *arc; + VNodeArc *arc = 0; if(parse == Document::FullParse){ arc = new VNodeArc(doc, data, id, idArc, typeobject, typeCreation); doc->AddTool(id, arc); diff --git a/tools/nodeDetails/vnodepoint.cpp b/tools/nodeDetails/vnodepoint.cpp index 60eab97aa..748b35f05 100644 --- a/tools/nodeDetails/vnodepoint.cpp +++ b/tools/nodeDetails/vnodepoint.cpp @@ -20,7 +20,7 @@ VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 id VNodePoint *VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Mode typeobject, Document::Enum parse, Tool::Enum typeCreation){ - VNodePoint *point; + VNodePoint *point = 0; if(parse == Document::FullParse){ point = new VNodePoint(doc, data, id, idPoint, typeobject, typeCreation); doc->AddTool(id, point); diff --git a/tools/nodeDetails/vnodespline.cpp b/tools/nodeDetails/vnodespline.cpp index 6d791b8fe..65acbe7a6 100644 --- a/tools/nodeDetails/vnodespline.cpp +++ b/tools/nodeDetails/vnodespline.cpp @@ -15,7 +15,7 @@ VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 VNodeSpline *VNodeSpline::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Mode typeobject, Document::Enum parse, Tool::Enum typeCreation){ - VNodeSpline *spl; + VNodeSpline *spl = 0; if(parse == Document::FullParse){ spl = new VNodeSpline(doc, data, id, idSpline, typeobject, typeCreation); doc->AddTool(id, spl); diff --git a/tools/nodeDetails/vnodesplinepath.cpp b/tools/nodeDetails/vnodesplinepath.cpp index d8ced7d9a..abad0222a 100644 --- a/tools/nodeDetails/vnodesplinepath.cpp +++ b/tools/nodeDetails/vnodesplinepath.cpp @@ -17,7 +17,7 @@ VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, VNodeSplinePath *VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Mode typeobject, Document::Enum parse, Tool::Enum typeCreation){ - VNodeSplinePath *splPath; + VNodeSplinePath *splPath = 0; if(parse == Document::FullParse){ splPath = new VNodeSplinePath(doc, data, id, idSpline, typeobject, typeCreation); doc->AddTool(id, splPath); diff --git a/tools/vdatatool.cpp b/tools/vdatatool.cpp index 5d57a56d3..257eaa0bf 100644 --- a/tools/vdatatool.cpp +++ b/tools/vdatatool.cpp @@ -7,7 +7,7 @@ VDataTool::VDataTool(VContainer *data, QObject *parent) : VDataTool::~VDataTool(){ } -const VDataTool &VDataTool::operator =(const VDataTool &tool){ +VDataTool &VDataTool::operator =(const VDataTool &tool){ data = tool.getData(); return *this; } diff --git a/tools/vdatatool.h b/tools/vdatatool.h index f4934ec42..b2fd2d2fe 100644 --- a/tools/vdatatool.h +++ b/tools/vdatatool.h @@ -10,7 +10,7 @@ class VDataTool : public QObject public: explicit VDataTool(VContainer *data, QObject *parent = 0); virtual ~VDataTool(); - const VDataTool& operator= (const VDataTool &tool); + VDataTool& operator= (const VDataTool &tool); VContainer getData() const; void setData(const VContainer *value); diff --git a/widgets/delegate.cpp b/widgets/delegate.cpp index d07798e08..f3b2d0de5 100644 --- a/widgets/delegate.cpp +++ b/widgets/delegate.cpp @@ -45,14 +45,8 @@ using a spin box widget. */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Weffc++" -#pragma GCC diagnostic ignored "-Wconversion" -#pragma GCC diagnostic ignored "-Wsign-conversion" -#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" - #include - #include "delegate.h" -#pragma GCC diagnostic pop +#include +#include "delegate.h" SpinBoxDelegate::SpinBoxDelegate(QObject *parent) : QItemDelegate(parent) diff --git a/widgets/delegate.h b/widgets/delegate.h deleted file mode 100644 index 663e41414..000000000 --- a/widgets/delegate.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). - ** Contact: http://www.qt-project.org/legal - ** - ** This file is part of the examples of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:BSD$ - ** You may use this file under the terms of the BSD license as follows: - ** - ** "Redistribution and use in source and binary forms, with or without - ** modification, are permitted provided that the following conditions are - ** met: - ** * Redistributions of source code must retain the above copyright - ** notice, this list of conditions and the following disclaimer. - ** * Redistributions in binary form must reproduce the above copyright - ** notice, this list of conditions and the following disclaimer in - ** the documentation and/or other materials provided with the - ** distribution. - ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names - ** of its contributors may be used to endorse or promote products derived - ** from this software without specific prior written permission. - ** - ** - ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - ** - ** $QT_END_LICENSE$ - ** - ****************************************************************************/ - - #ifndef DELEGATE_H - #define DELEGATE_H - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Weffc++" -#pragma GCC diagnostic ignored "-Wconversion" -#pragma GCC diagnostic ignored "-Wsign-conversion" -#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" - #include - #include - #include - #include - #include -#pragma GCC diagnostic pop - - class SpinBoxDelegate : public QItemDelegate - { - Q_OBJECT - - public: - SpinBoxDelegate(QObject *parent = 0); - - QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, - const QModelIndex &index) const; - - void setEditorData(QWidget *editor, const QModelIndex &index) const; - void setModelData(QWidget *editor, QAbstractItemModel *model, - const QModelIndex &index) const; - - void updateEditorGeometry(QWidget *editor, - const QStyleOptionViewItem &option, const QModelIndex &index) const; - }; - - #endif diff --git a/widgets/doubledelegate.cpp b/widgets/doubledelegate.cpp index 149d44b0f..3b0932624 100644 --- a/widgets/doubledelegate.cpp +++ b/widgets/doubledelegate.cpp @@ -45,14 +45,8 @@ using a spin box widget. */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Weffc++" -#pragma GCC diagnostic ignored "-Wconversion" -#pragma GCC diagnostic ignored "-Wsign-conversion" -#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" - #include - #include "doubledelegate.h" -#pragma GCC diagnostic pop +#include +#include "doubledelegate.h" DoubleSpinBoxDelegate::DoubleSpinBoxDelegate(QObject *parent) : QItemDelegate(parent)