From 3119c75981fb34915f795072720f2ff49efc6c2a Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 7 Nov 2013 16:40:39 +0200 Subject: [PATCH] Little optimization. --HG-- branch : develop --- container/vcontainer.cpp | 2 +- dialogs/dialogdetail.cpp | 2 +- dialogs/dialogtool.cpp | 2 +- geometry/vspline.cpp | 12 ++++++------ geometry/vspline.h | 11 ++++++----- geometry/vsplinepath.cpp | 4 ++-- geometry/vsplinepath.h | 4 ++-- tools/drawTools/vtoolnormal.cpp | 2 +- tools/drawTools/vtoolnormal.h | 5 +++-- tools/drawTools/vtoolpoint.cpp | 2 +- tools/drawTools/vtoolpoint.h | 2 +- tools/drawTools/vtoolspline.cpp | 4 ++-- tools/drawTools/vtoolspline.h | 4 ++-- tools/drawTools/vtoolsplinepath.cpp | 4 ++-- tools/drawTools/vtoolsplinepath.h | 4 ++-- tools/drawTools/vtooltriangle.cpp | 4 ++-- tools/drawTools/vtooltriangle.h | 4 ++-- tools/modelingTools/vmodelingpoint.cpp | 2 +- tools/modelingTools/vmodelingpoint.h | 2 +- tools/modelingTools/vmodelingspline.cpp | 2 +- tools/modelingTools/vmodelingspline.h | 2 +- tools/modelingTools/vmodelingsplinepath.cpp | 2 +- tools/modelingTools/vmodelingsplinepath.h | 2 +- tools/nodeDetails/vnodearc.cpp | 2 +- tools/nodeDetails/vnodearc.h | 4 ++-- tools/nodeDetails/vnodepoint.cpp | 4 ++-- tools/nodeDetails/vnodepoint.h | 4 ++-- tools/nodeDetails/vnodespline.cpp | 2 +- tools/nodeDetails/vnodespline.h | 5 +++-- tools/nodeDetails/vnodesplinepath.cpp | 5 +++-- tools/nodeDetails/vnodesplinepath.h | 2 +- tools/vtooldetail.cpp | 10 +++++----- widgets/vtablegraphicsview.cpp | 18 +++++++++++------- 33 files changed, 74 insertions(+), 66 deletions(-) diff --git a/container/vcontainer.cpp b/container/vcontainer.cpp index 3033bf1f1..5a50e0d95 100644 --- a/container/vcontainer.cpp +++ b/container/vcontainer.cpp @@ -163,7 +163,7 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const VDetail detail = GetDetail(idDetail); QVector points; QVector pointsEkv; - for (qint32 i = 0; i< detail.CountNode(); ++i) + for (ptrdiff_t i = 0; i< detail.CountNode(); ++i) { switch (detail[i].getTypeTool()) { diff --git a/dialogs/dialogdetail.cpp b/dialogs/dialogdetail.cpp index 2e64e986e..91d339552 100644 --- a/dialogs/dialogdetail.cpp +++ b/dialogs/dialogdetail.cpp @@ -188,7 +188,7 @@ void DialogDetail::setDetails(const VDetail &value) { details = value; ui.listWidget->clear(); - for (qint32 i = 0; i < details.CountNode(); ++i) + for (ptrdiff_t i = 0; i < details.CountNode(); ++i) { NewItem(details[i].getId(), details[i].getTypeTool(), details[i].getMode(), details[i].getTypeNode(), details[i].getMx(), details[i].getMy()); diff --git a/dialogs/dialogtool.cpp b/dialogs/dialogtool.cpp index a07413b69..2e4ea80f5 100644 --- a/dialogs/dialogtool.cpp +++ b/dialogs/dialogtool.cpp @@ -79,7 +79,7 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const return; } VDetail det = data->GetDetail(idDetail); - for (qint32 i = 0; i< det.CountNode(); ++i) + for (ptrdiff_t i = 0; i< det.CountNode(); ++i) { if (det[i].getTypeTool() == Tool::NodePoint || det[i].getTypeTool() == Tool::AlongLineTool || diff --git a/geometry/vspline.cpp b/geometry/vspline.cpp index 67ab29023..25b56b8db 100644 --- a/geometry/vspline.cpp +++ b/geometry/vspline.cpp @@ -76,7 +76,7 @@ void VSpline::ModifiSpl ( qint64 p1, qint64 p4, qreal angle1, qreal angle2, this->p3 = p4p3.p2(); } -void VSpline::ModifiSpl (qint64 p1, QPointF p2, QPointF p3, qint64 p4, qreal kCurve) +void VSpline::ModifiSpl (const qint64 &p1, const QPointF &p2, const QPointF &p3, const qint64 &p4, const qreal &kCurve) { this->p1 = p1; this->p2 = p2; @@ -278,7 +278,7 @@ QVector VSpline::GetPoints () const // } } -QVector VSpline::GetPoints (QPointF p1, QPointF p2, QPointF p3, QPointF p4) +QVector VSpline::GetPoints (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4) { QVector pvector; QVector x; @@ -298,7 +298,7 @@ QVector VSpline::GetPoints (QPointF p1, QPointF p2, QPointF p3, QPointF return pvector; } -qreal VSpline::LengthBezier ( QPointF p1, QPointF p2, QPointF p3, QPointF p4 ) const +qreal VSpline::LengthBezier ( const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 ) const { QPainterPath splinePath; QVector points = GetPoints (p1, p2, p3, p4); @@ -351,8 +351,8 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, double dx = x4-x1; double dy = y4-y1; - double d2 = fabs(((x2 - x4) * dy - (y2 - y4) * dx)); - double d3 = fabs(((x3 - x4) * dy - (y3 - y4) * dx)); + double d2 = fabs((x2 - x4) * dy - (y2 - y4) * dx); + double d3 = fabs((x3 - x4) * dy - (y3 - y4) * dx); double da1, da2, k; switch ((static_cast(d2 > curve_collinearity_epsilon) << 1) + @@ -747,7 +747,7 @@ QPainterPath VSpline::GetPath() const // this->ModifiSpl(P1, P2, P3, P4); //} -QVector VSpline::SplinePoints(QPointF p1, QPointF p4, qreal angle1, qreal angle2, qreal kAsm1, +QVector VSpline::SplinePoints(const QPointF &p1, const QPointF &p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve) { QLineF p1pX(p1.x(), p1.y(), p1.x() + 100, p1.y()); diff --git a/geometry/vspline.h b/geometry/vspline.h index abbc90121..a8245de01 100644 --- a/geometry/vspline.h +++ b/geometry/vspline.h @@ -79,7 +79,8 @@ public: * @param p3 друга контролююча точка сплайну. * @param p4 кінцева точка сплайну. */ - void ModifiSpl (qint64 p1, QPointF p2, QPointF p3, qint64 p4, qreal kCurve); + void ModifiSpl (const qint64 &p1, const QPointF &p2, const QPointF &p3, const qint64 &p4, + const qreal &kCurve); /** * @brief RotationSpl поворот сплайна навколо точки на кут в градусах проти годиникової стрілки. * @param pRotate точка навколо якої повертаємо. @@ -178,8 +179,8 @@ public: // void Mirror(const QPointF Pmirror); inline Draw::Draws getMode() const {return mode;} inline void setMode(const Draw::Draws &value) {mode = value;} - static QVector SplinePoints(QPointF p1, QPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, - qreal kCurve); + static QVector SplinePoints(const QPointF &p1, const QPointF &p4, qreal angle1, qreal angle2, qreal kAsm1, + qreal kAsm2, qreal kCurve); inline qint64 getIdObject() const {return idObject;} inline void setIdObject(const qint64 &value) {idObject = value;} VSpline &operator=(const VSpline &spl); @@ -192,7 +193,7 @@ protected: * @param p4 кінцева точка сплайну. * @return список точок. */ - static QVector GetPoints ( QPointF p1, QPointF p2, QPointF p3, QPointF p4 ); + static QVector GetPoints (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 ); private: /** * @brief p1 початкова точка сплайну @@ -232,7 +233,7 @@ private: * @param p4 кінцева точка сплайну. * @return дожина сплайну. */ - qreal LengthBezier ( QPointF p1, QPointF p2, QPointF p3, QPointF p4 ) const; + qreal LengthBezier (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 ) const; /** * @brief PointBezier_r знаходить точки сплайну по його чотирьом точках. * @param x1 х координата першої точки сплайну. diff --git a/geometry/vsplinepath.cpp b/geometry/vsplinepath.cpp index 01eb67bc4..df3baad54 100644 --- a/geometry/vsplinepath.cpp +++ b/geometry/vsplinepath.cpp @@ -32,7 +32,7 @@ VSplinePath::VSplinePath(const VSplinePath &splPath) : path(*splPath.GetPoint()), kCurve(splPath.getKCurve()), mode(splPath.getMode()), points(splPath.GetDataPoints()), idObject(splPath.getIdObject()){} -void VSplinePath::append(VSplinePoint point) +void VSplinePath::append(const VSplinePoint &point) { path.append(point); } @@ -104,7 +104,7 @@ qreal VSplinePath::GetLength() const return length; } -void VSplinePath::UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point) +void VSplinePath::UpdatePoint(qint32 indexSpline, const SplinePoint::Position &pos, const VSplinePoint &point) { if (indexSpline < 1 || indexSpline > Count()) { diff --git a/geometry/vsplinepath.h b/geometry/vsplinepath.h index 77d7c956d..412afb317 100644 --- a/geometry/vsplinepath.h +++ b/geometry/vsplinepath.h @@ -55,7 +55,7 @@ public: * @brief append додає точку сплайну до шляху. * @param point точка. */ - void append(VSplinePoint point); + void append(const VSplinePoint &point); qint32 Count() const; inline qint32 CountPoint() const {return path.size();} VSpline GetSpline(qint32 index) const; @@ -64,7 +64,7 @@ public: inline QVector GetSplinePath() const {return path;} qreal GetLength() const; inline QHash GetDataPoints() const {return points;} - void UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point); + void UpdatePoint(qint32 indexSpline, const SplinePoint::Position &pos, const VSplinePoint &point); VSplinePoint GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const; /** * @brief Clear очищає шлях сплайнів. diff --git a/tools/drawTools/vtoolnormal.cpp b/tools/drawTools/vtoolnormal.cpp index 138410b3e..4334eef3a 100644 --- a/tools/drawTools/vtoolnormal.cpp +++ b/tools/drawTools/vtoolnormal.cpp @@ -64,7 +64,7 @@ void VToolNormal::Create(QSharedPointer &dialog, VMainGraphicsScen } void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const QString typeLine, const QString pointName, + const qint64 &secondPointId, const QString &typeLine, const QString &pointName, const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) diff --git a/tools/drawTools/vtoolnormal.h b/tools/drawTools/vtoolnormal.h index 9ad7322c1..598496309 100644 --- a/tools/drawTools/vtoolnormal.h +++ b/tools/drawTools/vtoolnormal.h @@ -31,12 +31,13 @@ class VToolNormal : public VToolLinePoint public: VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &firstPointId, - const qint64 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); + const qint64 &secondPointId, const Tool::Sources &typeCreation, + QGraphicsItem * parent = 0); virtual void setDialog(); static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const QString typeLine, const QString pointName, + const qint64 &secondPointId, const QString &typeLine, const QString &pointName, const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); diff --git a/tools/drawTools/vtoolpoint.cpp b/tools/drawTools/vtoolpoint.cpp index e4b0368b6..37ac56ec9 100644 --- a/tools/drawTools/vtoolpoint.cpp +++ b/tools/drawTools/vtoolpoint.cpp @@ -36,7 +36,7 @@ VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphics RefreshPointGeometry(VAbstractTool::data.GetPoint(id)); } -void VToolPoint::NameChangePosition(const QPointF pos) +void VToolPoint::NameChangePosition(const QPointF &pos) { VPointF point = VAbstractTool::data.GetPoint(id); QPointF p = pos - this->pos(); diff --git a/tools/drawTools/vtoolpoint.h b/tools/drawTools/vtoolpoint.h index 993744961..8bcd8c0b0 100644 --- a/tools/drawTools/vtoolpoint.h +++ b/tools/drawTools/vtoolpoint.h @@ -33,7 +33,7 @@ public: virtual ~VToolPoint(){} static const QString TagName; public slots: - void NameChangePosition(const QPointF pos); + void NameChangePosition(const QPointF &pos); virtual void ChangedActivDraw(const QString &newName); virtual void FullUpdateFromGui(int result) = 0; virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); diff --git a/tools/drawTools/vtoolspline.cpp b/tools/drawTools/vtoolspline.cpp index a03cf5f9a..c2324bbe3 100644 --- a/tools/drawTools/vtoolspline.cpp +++ b/tools/drawTools/vtoolspline.cpp @@ -167,8 +167,8 @@ void VToolSpline::FullUpdateFromGui(int result) dialogSpline.clear(); } -void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position, - const QPointF pos) +void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const SplinePoint::Position &position, + const QPointF &pos) { Q_UNUSED(indexSpline); VSpline spl = VAbstractTool::data.GetSpline(id); diff --git a/tools/drawTools/vtoolspline.h b/tools/drawTools/vtoolspline.h index 9bcf09bc9..1960981e0 100644 --- a/tools/drawTools/vtoolspline.h +++ b/tools/drawTools/vtoolspline.h @@ -50,8 +50,8 @@ signals: public slots: virtual void FullUpdateFromFile (); virtual void FullUpdateFromGui ( int result ); - void ControlPointChangePosition ( const qint32 &indexSpline, SplinePoint::Position position, - const QPointF pos); + void ControlPointChangePosition (const qint32 &indexSpline, const SplinePoint::Position &position, + const QPointF &pos); virtual void ChangedActivDraw ( const QString &newName ); virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); virtual void SetFactor(qreal factor); diff --git a/tools/drawTools/vtoolsplinepath.cpp b/tools/drawTools/vtoolsplinepath.cpp index c6162d01d..230b9a696 100644 --- a/tools/drawTools/vtoolsplinepath.cpp +++ b/tools/drawTools/vtoolsplinepath.cpp @@ -156,8 +156,8 @@ void VToolSplinePath::FullUpdateFromGui(int result) dialogSplinePath.clear(); } -void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position, - const QPointF pos) +void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, const SplinePoint::Position &position, + const QPointF &pos) { VSplinePath splPath = VAbstractTool::data.GetSplinePath(id); VSpline spl = splPath.GetSpline(indexSpline); diff --git a/tools/drawTools/vtoolsplinepath.h b/tools/drawTools/vtoolsplinepath.h index 734615815..804eddedf 100644 --- a/tools/drawTools/vtoolsplinepath.h +++ b/tools/drawTools/vtoolsplinepath.h @@ -48,8 +48,8 @@ signals: public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); - void ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position, - const QPointF pos); + void ControlPointChangePosition(const qint32 &indexSpline, const SplinePoint::Position &position, + const QPointF &pos); virtual void ChangedActivDraw(const QString &newName); virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); virtual void SetFactor(qreal factor); diff --git a/tools/drawTools/vtooltriangle.cpp b/tools/drawTools/vtooltriangle.cpp index 683cf9a5a..94affbaea 100644 --- a/tools/drawTools/vtooltriangle.cpp +++ b/tools/drawTools/vtooltriangle.cpp @@ -101,8 +101,8 @@ void VToolTriangle::Create(const qint64 _id, const QString &pointName, const qin } } -QPointF VToolTriangle::FindPoint(const QPointF axisP1, const QPointF axisP2, const QPointF firstPoint, - const QPointF secondPoint) +QPointF VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, const QPointF &firstPoint, + const QPointF &secondPoint) { qreal c = QLineF(firstPoint, secondPoint).length(); qreal a = QLineF(axisP2, firstPoint).length(); diff --git a/tools/drawTools/vtooltriangle.h b/tools/drawTools/vtooltriangle.h index eed07c6a2..5990ef214 100644 --- a/tools/drawTools/vtooltriangle.h +++ b/tools/drawTools/vtooltriangle.h @@ -39,8 +39,8 @@ public: const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); - static QPointF FindPoint(const QPointF axisP1, const QPointF axisP2, const QPointF firstPoint, - const QPointF secondPoint); + static QPointF FindPoint(const QPointF &axisP1, const QPointF &axisP2, const QPointF &firstPoint, + const QPointF &secondPoint); static const QString ToolType; public slots: virtual void FullUpdateFromFile(); diff --git a/tools/modelingTools/vmodelingpoint.cpp b/tools/modelingTools/vmodelingpoint.cpp index 9c0e225da..948e1bb17 100644 --- a/tools/modelingTools/vmodelingpoint.cpp +++ b/tools/modelingTools/vmodelingpoint.cpp @@ -38,7 +38,7 @@ VModelingPoint::VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id, Q RefreshPointGeometry(VAbstractTool::data.GetModelingPoint(id)); } -void VModelingPoint::NameChangePosition(const QPointF pos) +void VModelingPoint::NameChangePosition(const QPointF &pos) { VPointF point = VAbstractTool::data.GetModelingPoint(id); QPointF p = pos - this->pos(); diff --git a/tools/modelingTools/vmodelingpoint.h b/tools/modelingTools/vmodelingpoint.h index 360db6153..33d446263 100644 --- a/tools/modelingTools/vmodelingpoint.h +++ b/tools/modelingTools/vmodelingpoint.h @@ -33,7 +33,7 @@ public: virtual ~VModelingPoint() {} static const QString TagName; public slots: - void NameChangePosition(const QPointF pos); + void NameChangePosition(const QPointF &pos); virtual void FullUpdateFromGui(int result) = 0; protected: qreal radius; diff --git a/tools/modelingTools/vmodelingspline.cpp b/tools/modelingTools/vmodelingspline.cpp index 40ebf04fc..d1ffd0640 100644 --- a/tools/modelingTools/vmodelingspline.cpp +++ b/tools/modelingTools/vmodelingspline.cpp @@ -163,7 +163,7 @@ void VModelingSpline::FullUpdateFromGui(int result) } void VModelingSpline::ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position, - const QPointF pos) + const QPointF &pos) { Q_UNUSED(indexSpline); VSpline spl = VAbstractTool::data.GetModelingSpline(id); diff --git a/tools/modelingTools/vmodelingspline.h b/tools/modelingTools/vmodelingspline.h index e52bb13b0..04d07348c 100644 --- a/tools/modelingTools/vmodelingspline.h +++ b/tools/modelingTools/vmodelingspline.h @@ -50,7 +50,7 @@ public slots: virtual void FullUpdateFromFile (); virtual void FullUpdateFromGui ( int result ); void ControlPointChangePosition (const qint32 &indexSpline, SplinePoint::Position position, - const QPointF pos); + const QPointF &pos); protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void AddToFile (); diff --git a/tools/modelingTools/vmodelingsplinepath.cpp b/tools/modelingTools/vmodelingsplinepath.cpp index 0a79618f8..c91e3bbc7 100644 --- a/tools/modelingTools/vmodelingsplinepath.cpp +++ b/tools/modelingTools/vmodelingsplinepath.cpp @@ -153,7 +153,7 @@ void VModelingSplinePath::FullUpdateFromGui(int result) } void VModelingSplinePath::ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position, - const QPointF pos) + const QPointF &pos) { VSplinePath splPath = VAbstractTool::data.GetModelingSplinePath(id); VSpline spl = splPath.GetSpline(indexSpline); diff --git a/tools/modelingTools/vmodelingsplinepath.h b/tools/modelingTools/vmodelingsplinepath.h index 6ae804c74..141bf5317 100644 --- a/tools/modelingTools/vmodelingsplinepath.h +++ b/tools/modelingTools/vmodelingsplinepath.h @@ -47,7 +47,7 @@ public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); void ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position, - const QPointF pos); + const QPointF &pos); protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void AddToFile(); diff --git a/tools/nodeDetails/vnodearc.cpp b/tools/nodeDetails/vnodearc.cpp index 77b654b23..254247d58 100644 --- a/tools/nodeDetails/vnodearc.cpp +++ b/tools/nodeDetails/vnodearc.cpp @@ -39,7 +39,7 @@ VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, } } -void VNodeArc::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, Draw::Draws typeobject, +void VNodeArc::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Draw::Draws &typeobject, const Document::Documents &parse, const Tool::Sources &typeCreation) { if (parse == Document::FullParse) diff --git a/tools/nodeDetails/vnodearc.h b/tools/nodeDetails/vnodearc.h index eb419e858..a580113d8 100644 --- a/tools/nodeDetails/vnodearc.h +++ b/tools/nodeDetails/vnodearc.h @@ -31,8 +31,8 @@ class VNodeArc :public VAbstractNode, public QGraphicsPathItem public: VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, Draw::Draws typeobject, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); - static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, - Draw::Draws typeobject, const Document::Documents &parse, const Tool::Sources &typeCreation); + static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Draw::Draws &typeobject, + const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString TagName; static const QString ToolType; public slots: diff --git a/tools/nodeDetails/vnodepoint.cpp b/tools/nodeDetails/vnodepoint.cpp index ddba6ebfd..734b0434e 100644 --- a/tools/nodeDetails/vnodepoint.cpp +++ b/tools/nodeDetails/vnodepoint.cpp @@ -44,7 +44,7 @@ VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 id } } -void VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Draws typeobject, +void VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, const Draw::Draws &typeobject, const Document::Documents &parse, const Tool::Sources &typeCreation) { if (parse == Document::FullParse) @@ -109,7 +109,7 @@ void VNodePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) } -void VNodePoint::NameChangePosition(const QPointF pos) +void VNodePoint::NameChangePosition(const QPointF &pos) { VPointF point = VAbstractTool::data.GetModelingPoint(id); QPointF p = pos - this->pos(); diff --git a/tools/nodeDetails/vnodepoint.h b/tools/nodeDetails/vnodepoint.h index eb4dbda0a..162e1f036 100644 --- a/tools/nodeDetails/vnodepoint.h +++ b/tools/nodeDetails/vnodepoint.h @@ -31,13 +31,13 @@ class VNodePoint: public VAbstractNode, public QGraphicsEllipseItem public: VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Draws typeobject, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0 ); - static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Draws typeobject, + static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, const Draw::Draws &typeobject, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString TagName; static const QString ToolType; public slots: virtual void FullUpdateFromFile(); - void NameChangePosition(const QPointF pos); + void NameChangePosition(const QPointF &pos); protected: qreal radius; VGraphicsSimpleTextItem *namePoint; diff --git a/tools/nodeDetails/vnodespline.cpp b/tools/nodeDetails/vnodespline.cpp index c78ebc5e6..53dcaa9b6 100644 --- a/tools/nodeDetails/vnodespline.cpp +++ b/tools/nodeDetails/vnodespline.cpp @@ -40,7 +40,7 @@ VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 } VNodeSpline *VNodeSpline::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Draws typeobject, const Document::Documents &parse, + const Draw::Draws &typeobject, const Document::Documents &parse, const Tool::Sources &typeCreation) { VNodeSpline *spl = 0; diff --git a/tools/nodeDetails/vnodespline.h b/tools/nodeDetails/vnodespline.h index bf7be5854..5e0f1cb7f 100644 --- a/tools/nodeDetails/vnodespline.h +++ b/tools/nodeDetails/vnodespline.h @@ -31,8 +31,9 @@ class VNodeSpline:public VAbstractNode, public QGraphicsPathItem public: VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); - static VNodeSpline *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject, - const Document::Documents &parse, const Tool::Sources &typeCreation); + static VNodeSpline *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, + const Draw::Draws &typeobject, const Document::Documents &parse, + const Tool::Sources &typeCreation); static const QString TagName; static const QString ToolType; public slots: diff --git a/tools/nodeDetails/vnodesplinepath.cpp b/tools/nodeDetails/vnodesplinepath.cpp index 985209598..a185cc4bd 100644 --- a/tools/nodeDetails/vnodesplinepath.cpp +++ b/tools/nodeDetails/vnodesplinepath.cpp @@ -25,7 +25,7 @@ const QString VNodeSplinePath::TagName = QStringLiteral("spline"); const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath"); VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Draws typeobject, const Tool::Sources &typeCreation, QGraphicsItem * parent) + Draw::Draws typeobject, const Tool::Sources &typeCreation, QGraphicsItem * parent) :VAbstractNode(doc, data, id, idSpline, typeobject), QGraphicsPathItem(parent) { RefreshGeometry(); @@ -40,7 +40,8 @@ VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, } void VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Draws typeobject, const Document::Documents &parse, const Tool::Sources &typeCreation) + const Draw::Draws &typeobject, const Document::Documents &parse, + const Tool::Sources &typeCreation) { if (parse == Document::FullParse) { diff --git a/tools/nodeDetails/vnodesplinepath.h b/tools/nodeDetails/vnodesplinepath.h index e2fa1dbea..596701428 100644 --- a/tools/nodeDetails/vnodesplinepath.h +++ b/tools/nodeDetails/vnodesplinepath.h @@ -31,7 +31,7 @@ class VNodeSplinePath : public VAbstractNode, public QGraphicsPathItem public: VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); - static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject, + static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, const Draw::Draws &typeobject, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString TagName; static const QString ToolType; diff --git a/tools/vtooldetail.cpp b/tools/vtooldetail.cpp index 7d8983511..419224977 100644 --- a/tools/vtooldetail.cpp +++ b/tools/vtooldetail.cpp @@ -40,7 +40,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, sceneDetails(scene) { VDetail detail = data->GetDetail(id); - for (qint32 i = 0; i< detail.CountNode(); ++i) + for (ptrdiff_t i = 0; i< detail.CountNode(); ++i) { switch (detail[i].getTypeTool()) { @@ -127,7 +127,7 @@ void VToolDetail::Create(QSharedPointer &dialog, VMainGraphicsScen { VDetail detail = dialog->getDetails(); VDetail det; - for (qint32 i = 0; i< detail.CountNode(); ++i) + for (ptrdiff_t i = 0; i< detail.CountNode(); ++i) { qint64 id = 0; switch (detail[i].getTypeTool()) @@ -252,7 +252,7 @@ void VToolDetail::FullUpdateFromGui(int result) domElement.setAttribute(AttrClosed, QString().setNum(det.getClosed())); domElement.setAttribute(AttrWidth, QString().setNum(det.getWidth())); RemoveAllChild(domElement); - for (qint32 i = 0; i < det.CountNode(); ++i) + for (ptrdiff_t i = 0; i < det.CountNode(); ++i) { AddNode(domElement, det[i]); } @@ -275,7 +275,7 @@ void VToolDetail::AddToFile() AddAttribute(domElement, AttrClosed, detail.getClosed()); AddAttribute(domElement, AttrWidth, detail.getWidth()); - for (qint32 i = 0; i < detail.CountNode(); ++i) + for (ptrdiff_t i = 0; i < detail.CountNode(); ++i) { AddNode(domElement, detail[i]); } @@ -371,7 +371,7 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolDetail::RemoveReferens() { VDetail detail = VAbstractTool::data.GetDetail(id); - for (qint32 i = 0; i< detail.CountNode(); ++i) + for (ptrdiff_t i = 0; i< detail.CountNode(); ++i) { doc->DecrementReferens(detail[i].getId()); } diff --git a/widgets/vtablegraphicsview.cpp b/widgets/vtablegraphicsview.cpp index c6716255e..8bc74f639 100644 --- a/widgets/vtablegraphicsview.cpp +++ b/widgets/vtablegraphicsview.cpp @@ -50,9 +50,11 @@ void VTableGraphicsView::MirrorItem() { for ( qint32 i = 0; i < list.count(); ++i ) { - QRectF itemRectOld = list.at(i)->sceneBoundingRect(); + QGraphicsItem *item = list.at(i); + Q_ASSERT(item != 0); + QRectF itemRectOld = item->sceneBoundingRect(); //Get the current transform - QTransform transform(list.at(i)->transform()); + QTransform transform(item->transform()); qreal m11 = transform.m11(); // Horizontal scaling qreal m12 = transform.m12(); // Vertical shearing @@ -71,12 +73,12 @@ void VTableGraphicsView::MirrorItem() transform.setMatrix(m11, m12, m13, m21, m22, m23, m31, m32, m33); // Set the items transformation - list.at(i)->setTransform(transform); - QRectF itemRectNew = list.at(i)->sceneBoundingRect(); + item->setTransform(transform); + QRectF itemRectNew = item->sceneBoundingRect(); qreal dx, dy; dx = itemRectOld.center().x()-itemRectNew.center().x(); dy = itemRectOld.center().y()-itemRectNew.center().y(); - list.at(i)->moveBy(dx, dy); + item->moveBy(dx, dy); } } } @@ -154,8 +156,10 @@ void VTableGraphicsView::rotateIt() { for ( qint32 i = 0; i < list.count(); ++i ) { - list.at(i)->setTransformOriginPoint(list.at(i)->boundingRect().center()); - list.at(i)->setRotation(list.at(i)->rotation() + 180); + QGraphicsItem *item = list.at(i); + Q_ASSERT(item != 0); + item->setTransformOriginPoint(item->boundingRect().center()); + item->setRotation(item->rotation() + 180); } } }