From 6669a0a15ae297652b31b761417eae405ea35d1c Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 30 Dec 2013 21:33:30 +0200 Subject: [PATCH] dynamic_cast instead qobject_cast. --HG-- branch : feature --- src/container/vcontainer.h | 4 ++-- src/geometry/varc.h | 3 +-- src/geometry/vdetail.cpp | 6 +++--- src/geometry/vdetail.h | 3 +-- src/geometry/vgobject.cpp | 6 +++--- src/geometry/vgobject.h | 3 +-- src/geometry/vpointf.h | 1 - src/geometry/vspline.h | 1 - src/geometry/vsplinepath.h | 3 +-- 9 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/container/vcontainer.h b/src/container/vcontainer.h index 0511196be..da8e1b40d 100644 --- a/src/container/vcontainer.h +++ b/src/container/vcontainer.h @@ -78,8 +78,8 @@ public: { throw VExceptionBadId(tr("Can't find object"), id); } - //T obj = dynamic_cast(gObj); - T obj = qobject_cast(gObj); + T obj = dynamic_cast(gObj); + //T obj = qobject_cast(gObj); Q_ASSERT(obj != 0); return obj; } diff --git a/src/geometry/varc.h b/src/geometry/varc.h index e1af9dda1..379360356 100644 --- a/src/geometry/varc.h +++ b/src/geometry/varc.h @@ -42,8 +42,7 @@ class QPainterPath; */ class VArc: public VGObject { - Q_OBJECT - //Q_DECLARE_TR_FUNCTIONS(VArc) + Q_DECLARE_TR_FUNCTIONS(VArc) public: /** * @brief VArc конструктор по замовчуванню. diff --git a/src/geometry/vdetail.cpp b/src/geometry/vdetail.cpp index 86b3129bd..8244be9be 100644 --- a/src/geometry/vdetail.cpp +++ b/src/geometry/vdetail.cpp @@ -29,18 +29,18 @@ #include "vdetail.h" VDetail::VDetail() - :QObject(), _id(0), nodes(QVector()), name(QString()), mx(0), my(0), supplement(true), closed(true), + :_id(0), nodes(QVector()), name(QString()), mx(0), my(0), supplement(true), closed(true), width(10){} VDetail::VDetail(const QString &name, const QVector &nodes) - :QObject(), _id(0), nodes(QVector()), name(name), mx(0), my(0), supplement(true), closed(true), + :_id(0), nodes(QVector()), name(name), mx(0), my(0), supplement(true), closed(true), width(10) { this->nodes = nodes; } VDetail::VDetail(const VDetail &detail) - :QObject(), _id(0), nodes(detail.getNodes()), name(detail.getName()), mx(detail.getMx()), my(detail.getMy()), + :_id(0), nodes(detail.getNodes()), name(detail.getName()), mx(detail.getMx()), my(detail.getMy()), supplement(detail.getSupplement()), closed(detail.getClosed()), width(detail.getWidth()){} VDetail &VDetail::operator =(const VDetail &detail) diff --git a/src/geometry/vdetail.h b/src/geometry/vdetail.h index b862e9e3d..ffb362f1f 100644 --- a/src/geometry/vdetail.h +++ b/src/geometry/vdetail.h @@ -54,9 +54,8 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Detail::Equidistants) /** * @brief The VDetail class */ -class VDetail :public QObject +class VDetail { - Q_OBJECT public: /** * @brief VDetail diff --git a/src/geometry/vgobject.cpp b/src/geometry/vgobject.cpp index ddec0e5f0..94d025598 100644 --- a/src/geometry/vgobject.cpp +++ b/src/geometry/vgobject.cpp @@ -29,17 +29,17 @@ #include "vgobject.h" VGObject::VGObject() - :QObject(), _id(0), type(GObject::Point), idObject(0), _name(QString()), mode(Draw::Calculation) + :_id(0), type(GObject::Point), idObject(0), _name(QString()), mode(Draw::Calculation) { } VGObject::VGObject(const GObject::Type &type, const qint64 &idObject, const Draw::Draws &mode) - :QObject(), _id(0), type(type), idObject(idObject), _name(QString()), mode(mode) + :_id(0), type(type), idObject(idObject), _name(QString()), mode(mode) { } VGObject::VGObject(const VGObject &obj) - :QObject(), _id(obj.id()), type(obj.getType()), idObject(obj.getIdObject()), _name(obj.name()), mode(obj.getMode()) + :_id(obj.id()), type(obj.getType()), idObject(obj.getIdObject()), _name(obj.name()), mode(obj.getMode()) { } diff --git a/src/geometry/vgobject.h b/src/geometry/vgobject.h index b71a5496b..eb904c072 100644 --- a/src/geometry/vgobject.h +++ b/src/geometry/vgobject.h @@ -45,9 +45,8 @@ namespace GObject } Q_DECLARE_OPERATORS_FOR_FLAGS(GObject::Types) -class VGObject :public QObject +class VGObject { - Q_OBJECT public: VGObject(); VGObject(const GObject::Type &type, const qint64 &idObject = 0, const Draw::Draws &mode = Draw::Calculation); diff --git a/src/geometry/vpointf.h b/src/geometry/vpointf.h index ffa62b7be..63da46ba7 100644 --- a/src/geometry/vpointf.h +++ b/src/geometry/vpointf.h @@ -39,7 +39,6 @@ */ class VPointF:public VGObject { - Q_OBJECT public: /** * @brief VPointF creat empty point diff --git a/src/geometry/vspline.h b/src/geometry/vspline.h index 18db98a62..7575c370a 100644 --- a/src/geometry/vspline.h +++ b/src/geometry/vspline.h @@ -45,7 +45,6 @@ class QString; */ class VSpline :public VGObject { - Q_OBJECT public: /** * @brief VSpline default constructor diff --git a/src/geometry/vsplinepath.h b/src/geometry/vsplinepath.h index bbd4b2792..d5bc1af2c 100644 --- a/src/geometry/vsplinepath.h +++ b/src/geometry/vsplinepath.h @@ -51,8 +51,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS( SplinePoint::Positions ) */ class VSplinePath :public VGObject { - Q_OBJECT - //Q_DECLARE_TR_FUNCTIONS(VSplinePath) + Q_DECLARE_TR_FUNCTIONS(VSplinePath) public: /** * @brief VSplinePath конструктор по замовчуванню.