[Qt-interest] dynamic properties

ami guru dosto.walla at gmail.com
Thu Feb 5 16:01:45 CET 2009


Hello forum,


"Dynamic properties are specific to an object. In other words, two objects
of the same class can have a different list of dynamic properties. All
objects of the same class share the same metaObject and thus, the same
static properties."

"It is possible to store/load properties on a QObject without having them
explicitly defined."


 The property name and value may not be necessary to be explicitly defined.
But what about their corresponding type.

Isnt that necessary for the type to be defined as well. If it is then is
that in the following way:



**********************************''
class SFVec3f
{

 public:
 SFVec3f()
   : x(0.0f),y(0.0f),z(0.0f)
    {

    }

 SFVec3f(float _x,float _y,float _z)
  : x(_x),y(_y),z(_z)
  {
  }


  SFVec3f(const SFVec3f &_vec)
  {
    this->x = _vec.x;
    this->y = _vec.y;
    this->z = _vec.z;
  }


  bool operator ==(const SFVec3f &other) const
  {
    return x == other.x && y == other.y && z == other.z;
  }


  bool operator !=(const SFVec3f &other) const
  {
    return x != other.x || y != other.y || z != other.z;
  }


  float x,y,z;
};

Q_DECLARE_METATYPE(SFVec3f)

*************************************




Regards

Sajjad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090205/2f851736/attachment.html 


More information about the Qt-interest-old mailing list