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);
}
//T obj = dynamic_cast<T>(gObj);
T obj = qobject_cast<T>(gObj);
T obj = dynamic_cast<T>(gObj);
//T obj = qobject_cast<T>(gObj);
Q_ASSERT(obj != 0);
return obj;
}

View file

@ -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 конструктор по замовчуванню.

View file

@ -29,18 +29,18 @@
#include "vdetail.h"
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){}
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)
{
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)

View file

@ -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

View file

@ -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())
{
}

View file

@ -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);

View file

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

View file

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

View file

@ -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 конструктор по замовчуванню.