dynamic_cast instead qobject_cast.

--HG--
branch : feature
This commit is contained in:
dismine 2013-12-30 21:33:30 +02:00
parent 92e0541b12
commit 6669a0a15a
9 changed files with 12 additions and 18 deletions

View File

@ -78,8 +78,8 @@ public:
{ {
throw VExceptionBadId(tr("Can't find object"), id); throw VExceptionBadId(tr("Can't find object"), id);
} }
//T obj = dynamic_cast<T>(gObj); T obj = dynamic_cast<T>(gObj);
T obj = qobject_cast<T>(gObj); //T obj = qobject_cast<T>(gObj);
Q_ASSERT(obj != 0); Q_ASSERT(obj != 0);
return obj; return obj;
} }

View File

@ -42,8 +42,7 @@ class QPainterPath;
*/ */
class VArc: public VGObject class VArc: public VGObject
{ {
Q_OBJECT Q_DECLARE_TR_FUNCTIONS(VArc)
//Q_DECLARE_TR_FUNCTIONS(VArc)
public: public:
/** /**
* @brief VArc конструктор по замовчуванню. * @brief VArc конструктор по замовчуванню.

View File

@ -29,18 +29,18 @@
#include "vdetail.h" #include "vdetail.h"
VDetail::VDetail() VDetail::VDetail()
:QObject(), _id(0), nodes(QVector<VNodeDetail>()), name(QString()), mx(0), my(0), supplement(true), closed(true), :_id(0), nodes(QVector<VNodeDetail>()), name(QString()), mx(0), my(0), supplement(true), closed(true),
width(10){} width(10){}
VDetail::VDetail(const QString &name, const QVector<VNodeDetail> &nodes) VDetail::VDetail(const QString &name, const QVector<VNodeDetail> &nodes)
:QObject(), _id(0), nodes(QVector<VNodeDetail>()), name(name), mx(0), my(0), supplement(true), closed(true), :_id(0), nodes(QVector<VNodeDetail>()), name(name), mx(0), my(0), supplement(true), closed(true),
width(10) width(10)
{ {
this->nodes = nodes; this->nodes = nodes;
} }
VDetail::VDetail(const VDetail &detail) 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()){} supplement(detail.getSupplement()), closed(detail.getClosed()), width(detail.getWidth()){}
VDetail &VDetail::operator =(const VDetail &detail) VDetail &VDetail::operator =(const VDetail &detail)

View File

@ -54,9 +54,8 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Detail::Equidistants)
/** /**
* @brief The VDetail class * @brief The VDetail class
*/ */
class VDetail :public QObject class VDetail
{ {
Q_OBJECT
public: public:
/** /**
* @brief VDetail * @brief VDetail

View File

@ -29,17 +29,17 @@
#include "vgobject.h" #include "vgobject.h"
VGObject::VGObject() 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) 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) 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())
{ {
} }

View File

@ -45,9 +45,8 @@ namespace GObject
} }
Q_DECLARE_OPERATORS_FOR_FLAGS(GObject::Types) Q_DECLARE_OPERATORS_FOR_FLAGS(GObject::Types)
class VGObject :public QObject class VGObject
{ {
Q_OBJECT
public: public:
VGObject(); VGObject();
VGObject(const GObject::Type &type, const qint64 &idObject = 0, const Draw::Draws &mode = Draw::Calculation); VGObject(const GObject::Type &type, const qint64 &idObject = 0, const Draw::Draws &mode = Draw::Calculation);

View File

@ -39,7 +39,6 @@
*/ */
class VPointF:public VGObject class VPointF:public VGObject
{ {
Q_OBJECT
public: public:
/** /**
* @brief VPointF creat empty point * @brief VPointF creat empty point

View File

@ -45,7 +45,6 @@ class QString;
*/ */
class VSpline :public VGObject class VSpline :public VGObject
{ {
Q_OBJECT
public: public:
/** /**
* @brief VSpline default constructor * @brief VSpline default constructor

View File

@ -51,8 +51,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS( SplinePoint::Positions )
*/ */
class VSplinePath :public VGObject class VSplinePath :public VGObject
{ {
Q_OBJECT Q_DECLARE_TR_FUNCTIONS(VSplinePath)
//Q_DECLARE_TR_FUNCTIONS(VSplinePath)
public: public:
/** /**
* @brief VSplinePath конструктор по замовчуванню. * @brief VSplinePath конструктор по замовчуванню.