From 3b1a654581f41d7dd1157edfffa874cc767ecfc9 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 31 Dec 2013 10:44:54 +0200 Subject: [PATCH] Fixed vera++ warnings. --HG-- branch : feature --- src/container/vcontainer.cpp | 18 +++--- src/dialogs/dialogcutspline.h | 5 +- src/dialogs/dialogcutsplinepath.h | 5 +- src/dialogs/dialognormal.h | 2 +- src/dialogs/dialogpointofintersection.h | 2 +- src/dialogs/dialogtool.cpp | 14 ++--- src/dialogs/dialogtriangle.h | 2 +- src/dialogs/dialoguniondetails.cpp | 6 +- src/dialogs/dialoguniondetails.h | 9 +-- src/geometry/varc.cpp | 4 +- src/geometry/varc.h | 2 +- src/geometry/vdetail.cpp | 1 - src/geometry/vspline.cpp | 11 ++-- src/geometry/vsplinepath.cpp | 6 +- src/mainwindow.cpp | 2 +- src/tools/drawTools/vtoolcutspline.cpp | 2 +- src/tools/drawTools/vtoolcutsplinepath.cpp | 26 ++++---- src/tools/vtooluniondetails.cpp | 69 ++++++++++++---------- src/widgets/vitem.cpp | 3 +- src/widgets/vsimplespline.cpp | 6 +- 20 files changed, 106 insertions(+), 89 deletions(-) diff --git a/src/container/vcontainer.cpp b/src/container/vcontainer.cpp index 937d586e6..af07753d7 100644 --- a/src/container/vcontainer.cpp +++ b/src/container/vcontainer.cpp @@ -36,7 +36,7 @@ qint64 VContainer::_id = 0; VContainer::VContainer() :base(QHash()), gObjects(QHash()), standartTable(QHash()), incrementTable(QHash()), - lengthLines(QHash()),lineAngles(QHash()), lengthSplines(QHash()), + lengthLines(QHash()), lineAngles(QHash()), lengthSplines(QHash()), lengthArcs(QHash()), details(QHash()) { SetSize(500); @@ -77,24 +77,24 @@ void VContainer::setData(const VContainer &data) while (i.hasNext()) { i.next(); - switch(i.value()->getType()) + switch (i.value()->getType()) { - case(GObject::Arc): + case (GObject::Arc): { CopyGObject(data, i.key()); break; } - case(GObject::Point): + case (GObject::Point): { CopyGObject(data, i.key()); break; } - case(GObject::Spline): + case (GObject::Spline): { CopyGObject(data, i.key()); break; } - case(GObject::SplinePath): + case (GObject::SplinePath): { CopyGObject(data, i.key()); break; @@ -560,7 +560,7 @@ void VContainer::UpdateObject(QHash &obj, const qint64 &id, val poi { Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); Q_ASSERT(point != 0); - point->setId(id); + point->setId(id); // if (gObjects.contains(id)) // { // delete gObjects.value(id); @@ -625,7 +625,7 @@ void VContainer::Clear() void VContainer::ClearObject() { - if(gObjects.size()>0) + if (gObjects.size()>0) { qDeleteAll(gObjects); } @@ -715,7 +715,7 @@ void VContainer::UpdateGObject(qint64 id, VGObject* obj) UpdateObject(gObjects, id, obj); } -void VContainer::UpdateDetail(qint64 id,VDetail detail) +void VContainer::UpdateDetail(qint64 id, VDetail detail) { Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); details[id] = detail; diff --git a/src/dialogs/dialogcutspline.h b/src/dialogs/dialogcutspline.h index 85209cb24..a08f1c305 100644 --- a/src/dialogs/dialogcutspline.h +++ b/src/dialogs/dialogcutspline.h @@ -31,8 +31,9 @@ #include "dialogtool.h" -namespace Ui { -class DialogCutSpline; +namespace Ui +{ + class DialogCutSpline; } class DialogCutSpline : public DialogTool diff --git a/src/dialogs/dialogcutsplinepath.h b/src/dialogs/dialogcutsplinepath.h index 5069688f6..89342a917 100644 --- a/src/dialogs/dialogcutsplinepath.h +++ b/src/dialogs/dialogcutsplinepath.h @@ -31,8 +31,9 @@ #include "dialogtool.h" -namespace Ui { -class DialogCutSplinePath; +namespace Ui +{ + class DialogCutSplinePath; } class DialogCutSplinePath : public DialogTool diff --git a/src/dialogs/dialognormal.h b/src/dialogs/dialognormal.h index 9beb035a1..556a8b9a2 100644 --- a/src/dialogs/dialognormal.h +++ b/src/dialogs/dialognormal.h @@ -96,7 +96,7 @@ public: */ inline qint64 getFirstPointId() const {return firstPointId;} /** - * @brief setFirstPointId set id of first point + * @brief setFirstPointId set id of first point * @param value id * @param id don't show this id in list */ diff --git a/src/dialogs/dialogpointofintersection.h b/src/dialogs/dialogpointofintersection.h index 49d7e0f12..4a184a544 100644 --- a/src/dialogs/dialogpointofintersection.h +++ b/src/dialogs/dialogpointofintersection.h @@ -66,7 +66,7 @@ public: */ inline qint64 getFirstPointId() const {return firstPointId;} /** - * @brief setFirstPointId set id of first point + * @brief setFirstPointId set id of first point * @param value id * @param id don't show this id in list. */ diff --git a/src/dialogs/dialogtool.cpp b/src/dialogs/dialogtool.cpp index d37e59330..46cab17e7 100644 --- a/src/dialogs/dialogtool.cpp +++ b/src/dialogs/dialogtool.cpp @@ -75,7 +75,7 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const if (i.key() != id) { VGObject *obj = i.value(); - if(obj->getType() == GObject::Point && obj->getMode() == Draw::Calculation) + if (obj->getType() == GObject::Point && obj->getMode() == Draw::Calculation) { const VPointF *point = data->GeometricObject(i.key()); box->addItem(point->name(), i.key()); @@ -93,12 +93,12 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, const qint64 &id, ComboMode while (i.hasNext()) { i.next(); - if(cut == ComboMode::CutSpline) + if (cut == ComboMode::CutSpline) { if (i.key() != id + 1 && i.key() != id + 2) { VGObject *obj = i.value(); - if(obj->getType() == GObject::Spline && obj->getMode() == Draw::Calculation) + if (obj->getType() == GObject::Spline && obj->getMode() == Draw::Calculation) { const VSpline *spl = data->GeometricObject(i.key()); box->addItem(spl->name(), i.key()); @@ -110,7 +110,7 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, const qint64 &id, ComboMode if (i.key() != id) { VGObject *obj = i.value(); - if(obj->getType() == GObject::Spline && obj->getMode() == Draw::Calculation) + if (obj->getType() == GObject::Spline && obj->getMode() == Draw::Calculation) { const VSpline *spl = data->GeometricObject(i.key()); box->addItem(spl->name(), i.key()); @@ -129,12 +129,12 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const qint64 &id, Combo while (i.hasNext()) { i.next(); - if(cut == ComboMode::CutSpline) + if (cut == ComboMode::CutSpline) { if (i.key() != id + 1 && i.key() != id + 2) { VGObject *obj = i.value(); - if(obj->getType() == GObject::SplinePath && obj->getMode() == Draw::Calculation) + if (obj->getType() == GObject::SplinePath && obj->getMode() == Draw::Calculation) { const VSplinePath *splPath = data->GeometricObject(i.key()); box->addItem(splPath->name(), i.key()); @@ -146,7 +146,7 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const qint64 &id, Combo if (i.key() != id) { VGObject *obj = i.value(); - if(obj->getType() == GObject::SplinePath && obj->getMode() == Draw::Calculation) + if (obj->getType() == GObject::SplinePath && obj->getMode() == Draw::Calculation) { const VSplinePath *splPath = data->GeometricObject(i.key()); box->addItem(splPath->name(), i.key()); diff --git a/src/dialogs/dialogtriangle.h b/src/dialogs/dialogtriangle.h index e75d83a8c..0335aa9c4 100644 --- a/src/dialogs/dialogtriangle.h +++ b/src/dialogs/dialogtriangle.h @@ -78,7 +78,7 @@ public: */ inline qint64 getFirstPointId() const {return firstPointId;} /** - * @brief setFirstPointId set id of first point + * @brief setFirstPointId set id of first point * @param value id * @param id don't show this point in list */ diff --git a/src/dialogs/dialoguniondetails.cpp b/src/dialogs/dialoguniondetails.cpp index 181551334..f6ce3501f 100644 --- a/src/dialogs/dialoguniondetails.cpp +++ b/src/dialogs/dialoguniondetails.cpp @@ -47,7 +47,7 @@ DialogUnionDetails::~DialogUnionDetails() void DialogUnionDetails::ChoosedObject(qint64 id, const Scene::Scenes &type) { - if(numberD == 0) + if (numberD == 0) { ChoosedDetail(id, type, d1, d1P1, d1P2); } @@ -98,13 +98,13 @@ void DialogUnionDetails::ChoosedDetail(const qint64 &id, const Scene::Scenes &ty } if (numberP == 1) { - if(id == p1) + if (id == p1) { return; } p2 = id; ++numberD; - if(numberD > 1) + if (numberD > 1) { ++numberP; emit ToolTip(""); diff --git a/src/dialogs/dialoguniondetails.h b/src/dialogs/dialoguniondetails.h index 8b4ed6798..edfb9a9ed 100644 --- a/src/dialogs/dialoguniondetails.h +++ b/src/dialogs/dialoguniondetails.h @@ -31,16 +31,17 @@ #include "dialogtool.h" -namespace Ui { -class DialogUnionDetails; +namespace Ui +{ + class DialogUnionDetails; } class DialogUnionDetails : public DialogTool { Q_OBJECT public: - explicit DialogUnionDetails(const VContainer *data, QWidget *parent = 0); - ~DialogUnionDetails(); + explicit DialogUnionDetails(const VContainer *data, QWidget *parent = 0); + ~DialogUnionDetails(); inline qint64 getD1() const {return d1;} inline qint64 getD2() const {return d2;} inline qint64 getD1P1() const {return d1P1;} diff --git a/src/geometry/varc.cpp b/src/geometry/varc.cpp index 674c92dd4..4613c243a 100644 --- a/src/geometry/varc.cpp +++ b/src/geometry/varc.cpp @@ -40,8 +40,8 @@ VArc::VArc () VArc::VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2, QString formulaF2, qint64 idObject, Draw::Draws mode) - : VGObject(GObject::Arc, idObject, mode), f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2), radius(radius), - formulaRadius(formulaRadius),center(center) + : VGObject(GObject::Arc, idObject, mode), f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2), + radius(radius), formulaRadius(formulaRadius), center(center) { //TODO Change name of arc in formula. Name now not unique. _name = QString ("Arc_%1").arg(this->GetCenter().name()); diff --git a/src/geometry/varc.h b/src/geometry/varc.h index 379360356..dd54e5fe1 100644 --- a/src/geometry/varc.h +++ b/src/geometry/varc.h @@ -143,7 +143,7 @@ public: * @param number * @return */ - QVector SplOfArc( qint32 number ) const; + QVector SplOfArc( qint32 number ) const; virtual QString name() const{return _name;} private: /** diff --git a/src/geometry/vdetail.cpp b/src/geometry/vdetail.cpp index 8244be9be..759107312 100644 --- a/src/geometry/vdetail.cpp +++ b/src/geometry/vdetail.cpp @@ -111,4 +111,3 @@ void VDetail::setId(const qint64 &id) { _id = id; } - diff --git a/src/geometry/vspline.cpp b/src/geometry/vspline.cpp index 46768147a..f37ba220e 100644 --- a/src/geometry/vspline.cpp +++ b/src/geometry/vspline.cpp @@ -74,8 +74,8 @@ VSpline::VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm } VSpline::VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, qint64 idObject, Draw::Draws mode) - :VGObject(GObject::Spline, idObject, mode), p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1), kAsm2(1), - kCurve(1) + :VGObject(GObject::Spline, idObject, mode), p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1), + kAsm2(1), kCurve(1) { CreateName(); @@ -145,7 +145,7 @@ QLineF::IntersectType VSpline::CrossingSplLine ( const QLineF &line, QPointF *in qreal VSpline::LengthT(qreal t) const { - if(t < 0 || t > 1) + if (t < 0 || t > 1) { qWarning()<<"Wrong value t."; return 0; @@ -180,7 +180,7 @@ qreal VSpline::LengthT(qreal t) const QPointF VSpline::CutSpline ( qreal length, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3 ) const { //Always need return two splines, so we must correct wrong length. - if(length < GetLength()*0.02) + if (length < GetLength()*0.02) { length = GetLength()*0.02; } @@ -199,7 +199,8 @@ QPointF VSpline::CutSpline ( qreal length, QPointF &spl1p2, QPointF &spl1p3, QPo { parT = parT + step; qreal splLength = LengthT(parT); - if(splLength >= length || parT > 1){ + if (splLength >= length || parT > 1) + { break; } } diff --git a/src/geometry/vsplinepath.cpp b/src/geometry/vsplinepath.cpp index 98b6f666a..e028b461a 100644 --- a/src/geometry/vsplinepath.cpp +++ b/src/geometry/vsplinepath.cpp @@ -174,14 +174,14 @@ const VSplinePoint &VSplinePath::at(ptrdiff_t indx) const QPointF VSplinePath::CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3) const { - if(Count() < 2) + if (Count() < 2) { throw VException(tr("Can't cut spline path with one point")); } //Always need return two spline paths, so we must correct wrong length. qreal fullLength = GetLength(); - if(length < fullLength * 0.02) + if (length < fullLength * 0.02) { length = fullLength * 0.02; } @@ -196,7 +196,7 @@ QPointF VSplinePath::CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF VSpline spl = VSpline(path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(), path[i].KAsm1(), kCurve); fullLength += spl.GetLength(); - if(fullLength > length) + if (fullLength > length) { p1 = i-1; p2 = i; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 0b9497304..e330fa982 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1084,7 +1084,7 @@ void MainWindow::SetEnableTool(bool enable) { bool drawTools = false; bool modelingTools = false; - if(mode == Draw::Calculation) + if (mode == Draw::Calculation) { drawTools = enable; } diff --git a/src/tools/drawTools/vtoolcutspline.cpp b/src/tools/drawTools/vtoolcutspline.cpp index cf2927c93..f05e012d1 100644 --- a/src/tools/drawTools/vtoolcutspline.cpp +++ b/src/tools/drawTools/vtoolcutspline.cpp @@ -259,7 +259,7 @@ void VToolCutSpline::RefreshSpline(VSimpleSpline *spline, qint64 splid, SimpleSp QPainterPath path; path.addPath(spl->GetPath()); path.setFillRule( Qt::WindingFill ); - if(tr == SimpleSpline::FirstPoint) + if (tr == SimpleSpline::FirstPoint) { path.translate(-spl->GetP1().toQPointF().x(), -spl->GetP1().toQPointF().y()); } diff --git a/src/tools/drawTools/vtoolcutsplinepath.cpp b/src/tools/drawTools/vtoolcutsplinepath.cpp index 2083c82e6..277119865 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/tools/drawTools/vtoolcutsplinepath.cpp @@ -120,13 +120,15 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons Q_ASSERT(splPath1); VSplinePath *splPath2 = new VSplinePath(); Q_ASSERT(splPath2); - for(qint32 i = 0; i < splPath->CountPoint(); i++) + for (qint32 i = 0; i < splPath->CountPoint(); i++) { - if(i <= p1 && i < p2){ - if(i == p1) + if (i <= p1 && i < p2) + { + if (i == p1) { splPath1->append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1(), spl1.GetKasm1())); - VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2()+180, spl2.GetKasm1()); + VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2()+180, + spl2.GetKasm1()); splPath1->append(cutPoint); continue; } @@ -134,7 +136,7 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons } else { - if(i == p2) + if (i == p2) { VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1(), spl2.GetKasm1()); splPath2->append(cutPoint); @@ -169,13 +171,15 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons Q_ASSERT(splPath1 != 0); VSplinePath *splPath2 = new VSplinePath(); Q_ASSERT(splPath2 != 0); - for(qint32 i = 0; i < splPath->CountPoint(); i++) + for (qint32 i = 0; i < splPath->CountPoint(); i++) { - if(i <= p1 && i < p2){ - if(i == p1) + if (i <= p1 && i < p2) + { + if (i == p1) { splPath1->append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1(), spl1.GetKasm1())); - VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2()+180, spl2.GetKasm1()); + VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2()+180, + spl2.GetKasm1()); splPath1->append(cutPoint); continue; } @@ -183,7 +187,7 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons } else { - if(i == p2) + if (i == p2) { VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1(), spl2.GetKasm1()); splPath2->append(cutPoint); @@ -326,7 +330,7 @@ void VToolCutSplinePath::RefreshSpline(VSimpleSpline *spline, qint64 splPathid, QPainterPath path; path.addPath(splPath->GetPath()); path.setFillRule( Qt::WindingFill ); - if(tr == SimpleSpline::FirstPoint) + if (tr == SimpleSpline::FirstPoint) { VSpline spl = splPath->GetSpline(1); path.translate(-spl.GetP1().toQPointF().x(), -spl.GetP1().toQPointF().y()); diff --git a/src/tools/vtooluniondetails.cpp b/src/tools/vtooluniondetails.cpp index dbd97c297..92b4ea5e6 100644 --- a/src/tools/vtooluniondetails.cpp +++ b/src/tools/vtooluniondetails.cpp @@ -63,7 +63,7 @@ VToolUnionDetails::VToolUnionDetails(VDomDocument *doc, VContainer *data, const void VToolUnionDetails::CorectPoints(const VDetail &detail, qint64 &p1, qint64 &p2) { - if(p1 == p2) + if (p1 == p2) { qWarning()<<"Union points equal."; return; @@ -72,21 +72,21 @@ void VToolUnionDetails::CorectPoints(const VDetail &detail, qint64 &p1, qint64 & bool p2flag = false; for (ptrdiff_t i = 0; i< detail.CountNode(); ++i) { - if(detail.at(i).getTypeTool() == Tool::NodePoint) + if (detail.at(i).getTypeTool() == Tool::NodePoint) { - if(p1 == detail.at(i).getId()) + if (p1 == detail.at(i).getId()) { p1flag = true; } - if(p2 == detail.at(i).getId()) + if (p2 == detail.at(i).getId()) { p2flag = true; } - if(p1flag == true && p2flag == false) + if (p1flag == true && p2flag == false) { return; } - if(p2flag == true && p1flag == false) + if (p2flag == true && p1flag == false) { qint64 p = p1; p1 = p2; @@ -108,7 +108,7 @@ void VToolUnionDetails::AddToNewDetail(VContainer *data, VDetail newDetail, cons { case (Tool::NodePoint): { - if( qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && (pRotate == 0)) + if ( qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && (pRotate == 0)) { id = det.at(i).getId(); } @@ -125,7 +125,7 @@ void VToolUnionDetails::AddToNewDetail(VContainer *data, VDetail newDetail, cons break; case (Tool::NodeArc): { - if(qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) + if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) { id = det.at(i).getId(); } @@ -156,7 +156,7 @@ void VToolUnionDetails::AddToNewDetail(VContainer *data, VDetail newDetail, cons break; case (Tool::NodeSpline): { - if(qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) + if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) { id = det.at(i).getId(); } @@ -188,7 +188,7 @@ void VToolUnionDetails::AddToNewDetail(VContainer *data, VDetail newDetail, cons break; case (Tool::NodeSplinePath): { - if(qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) + if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) { id = det.at(i).getId(); } @@ -205,22 +205,26 @@ void VToolUnionDetails::AddToNewDetail(VContainer *data, VDetail newDetail, cons VPointF *p1 = new VPointF(spline.GetP1()); Q_ASSERT(p1 != 0); - BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), + angle); qint64 idP1 = data->AddGObject(p1); VPointF p2 = VPointF(spline.GetP2()); - BiasRotatePoint(&p2, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(&p2, dx, dy, data->GeometricObject(pRotate)->toQPointF(), + angle); VPointF p3 = VPointF(spline.GetP3()); - BiasRotatePoint(&p3, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(&p3, dx, dy, data->GeometricObject(pRotate)->toQPointF(), + angle); VPointF *p4 = new VPointF(spline.GetP4()); Q_ASSERT(p4 != 0); - BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), + angle); qint64 idP4 = data->AddGObject(p4); VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve()); - if(i==1) + if (i==1) { path->append(VSplinePoint(*p1, splinePath->at(i-1).KAsm1(), spl.GetAngle1(), splinePath->at(i-1).KAsm1())); @@ -252,7 +256,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c { case (Tool::NodePoint): { - if(qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) + if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) { ++idCount; } @@ -268,7 +272,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c break; case (Tool::NodeArc): { - if(qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) + if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) { ++idCount; } @@ -281,7 +285,8 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c BiasRotatePoint(&p2, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); VPointF *center = new VPointF(arc->GetCenter()); Q_ASSERT(center != 0); - BiasRotatePoint(center, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(center, dx, dy, data->GeometricObject(pRotate)->toQPointF(), + angle); QLineF l1(center->toQPointF(), p1.toQPointF()); QLineF l2(center->toQPointF(), p2.toQPointF()); @@ -296,7 +301,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c break; case (Tool::NodeSpline): { - if(qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) + if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) { ++idCount; } @@ -329,7 +334,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c break; case (Tool::NodeSplinePath): { - if(qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) + if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) { ++idCount; } @@ -346,22 +351,26 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c VPointF *p1 = new VPointF(spline.GetP1()); Q_ASSERT(p1 != 0); - BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), + angle); qint64 idP1 = data->AddGObject(p1); VPointF p2 = VPointF(spline.GetP2()); - BiasRotatePoint(&p2, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(&p2, dx, dy, data->GeometricObject(pRotate)->toQPointF(), + angle); VPointF p3 = VPointF(spline.GetP3()); - BiasRotatePoint(&p3, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(&p3, dx, dy, data->GeometricObject(pRotate)->toQPointF(), + angle); VPointF *p4 = new VPointF(spline.GetP4()); Q_ASSERT(p4 != 0); - BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), + angle); qint64 idP4 = data->AddGObject(p4); VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve()); - if(i==1) + if (i==1) { path->append(VSplinePoint(*p1, splinePath->at(i-1).KAsm1(), spl.GetAngle1(), splinePath->at(i-1).KAsm1())); @@ -386,10 +395,10 @@ void VToolUnionDetails::BiasRotatePoint(VPointF *point, const qreal &dx, const q { point->setX(point->x()+dx); point->setY(point->y()+dy); - QLineF l(pRotate, point->toQPointF()); - l.setAngle(angle); - point->setX(l.p2().x()); - point->setY(l.p2().y()); + QLineF line(pRotate, point->toQPointF()); + line.setAngle(angle); + point->setX(line.p2().x()); + point->setY(line.p2().y()); } void VToolUnionDetails::Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, @@ -439,7 +448,7 @@ void VToolUnionDetails::Create(const qint64 _id, const VDetail &d1, const VDetai } - if(typeCreation == Tool::FromGui) + if (typeCreation == Tool::FromGui) { //Update corected points qint64 d1P1 = unionDetails->getD1P1(); diff --git a/src/widgets/vitem.cpp b/src/widgets/vitem.cpp index 536761501..f42b9a4d2 100644 --- a/src/widgets/vitem.cpp +++ b/src/widgets/vitem.cpp @@ -40,7 +40,8 @@ VItem::VItem (const QPainterPath & path, int numInList, QGraphicsItem * parent ) void VItem::checkItemChange() { QRectF rect; - if(paper == 0){ + if (paper == 0) + { qDebug()<<"Don't set paper for detail!!!!"; rect = this->scene()->sceneRect(); } diff --git a/src/widgets/vsimplespline.cpp b/src/widgets/vsimplespline.cpp index a610f8fc0..c77be792a 100644 --- a/src/widgets/vsimplespline.cpp +++ b/src/widgets/vsimplespline.cpp @@ -32,7 +32,7 @@ VSimpleSpline::VSimpleSpline(qint64 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent) :QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor) { - if(factor == 0) + if (factor == 0) { setPen(QPen(Qt::black, widthHairLine)); } @@ -56,7 +56,7 @@ void VSimpleSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VSimpleSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - if(factor == 0) + if (factor == 0) { this->setPen(QPen(*currentColor, widthMainLine)); } @@ -69,7 +69,7 @@ void VSimpleSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VSimpleSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - if(factor == 0) + if (factor == 0) { this->setPen(QPen(*currentColor, widthHairLine)); }