[Qt-interest] register custom type

Jorge Abrines curruscataphractus at gmail.com
Fri Jan 23 12:46:01 CET 2009


Yes, only if you want (or need) to use with signals/slots, meta object property 
mechanism or QVariant conversion.

Regards,

Jorge

ami guru wrote:
> Hello forum,
> 
> 
> I have registered a custom type in the following way:
> 
> 
> ******************************************
> 
> struct SFVec3f
> {
> 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)
> 
> 
> 
> *****************************************'
> 
> 
> Now i need to register another type which is acyually array of SFVec3f
> 
> I was wondering if it is correct to do  that in the following way:
> 
> 
> ****************************************
> 
> struct MFVec3f
> {
>   MFVec3f()
>   {
> 
>   }
> 
> 
>   MFVec3f(const MFVec3f &_vec)
>   {
> 
>   }
> 
>   QVector<SFVec3f> sfvec3fArray;
> };
> 
> 
> Q_DECLARE_METATYPE(MFVec3f)
> 
> 
> ***************************************
> 
> 
> 
> 
> Regards
> Sajjad
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest



More information about the Qt-interest-old mailing list