Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

[QtScript] registering and handling QPair

$
0
0
I have a few slots that return a QPair and I would like to call them from a script. I’m trying to register QPair but Q_DECLARE_METATYPE(QPair<bool,QString>) won’t compile. I’ve found this commit: http://gitorious.org/qtscript-smoke/qtscript-smoke/commit/3edb118abfbdd61f0de00e66cd45f65263f77900/diffs where is declared: /*     Allows a metatype to be declared for a type containing a single comma.     For example:     Q_DECLARE_METATYPE2(QList<QPair<QByteArray,QByteArray> >) */ #define Q_DECLARE_METATYPE2(TYPE1, TYPE2)                               \     QT_BEGIN_NAMESPACE                                                  \     template <>                                                         \     struct QMetaTypeId< TYPE1,TYPE2 >                                   \     {                                                                   \         enum { Defined = 1 };                                           \         static int qt_metatype_id()                                     \             {                                                           \                 static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \                 if (!metatype_id)                                       \                     metatype_id = qRegisterMetaType< TYPE1,TYPE2 >( #TYPE1 "," #TYPE2 );  \                 return metatype_id;                                     \             }                                                           \     };                                                                  \     QT_END_NAMESPACE This time Q_DECLARE_METATYPE2(QPair<bool,QString>) will compile but it triggers an infinitely recursive loop at execution. Any help will be much appreciated

Viewing all articles
Browse latest Browse all 18427

Trending Articles