Page 1 of 1

Support QVector and QVector3D

PostPosted: Tue Dec 01, 2015 9:23 am
by behtgod
Is there any way to support QVector and QVector3D?
for example:
t.data(&MyClass::VectorData,"pixel_spacing");

The type of the VectorData is QVector3D or QVector

Re: Support QVector and QVector3D

PostPosted: Wed Dec 02, 2015 8:32 pm
by qxorm
Hello,

Yes it is possible : please read this chapter of the QxOrm manual : http://www.qxorm.com/qxorm_en/manual.html#manual_460

The more important part is : you have to specialize QxConvert_ToVariant and QxConvert_FromVariant template, like this (just replace ExtObject3D by QVector or QVector3D) :
Code: Select all
namespace qx {
namespace cvt {
namespace detail {

template <> struct QxConvert_ToVariant< ExtObject3D > {
static inline QVariant toVariant(const ExtObject3D & t, const QString & format, int index)
{ /* Here I convert from ExtObject3D to QVariant */ } };

template <> struct QxConvert_FromVariant< ExtObject3D > {
static inline qx_bool fromVariant(const QVariant & v, ExtObject3D & t, const QString & format, int index)
{ /* Here I convert from QVariant to ExtObject3D */; return qx_bool(true); } };

} // namespace detail
} // namespace cvt
} // namespace qx

Re: Support QVector and QVector3D

PostPosted: Sun Apr 03, 2016 3:37 am
by behtgod
Thank you very much.