On Friday, December 28, 2012 08:36:21 Glen Mabey wrote: > #define Q_DECLARE_METATYPE_2(h1,h2) \ > QT_BEGIN_NAMESPACE \ > template <> struct QMetaTypeId< h1,h2 > { \ > enum { Defined = 1 }; \ > static int qt_metatype_id() { \ > static QBasicAtomicInt metatype_id = > Q_BASIC_ATOMIC_INITIALIZER(0); \ if (!metatype_id.load()) > metatype_id.storeRelease(qRegisterMetaType< h1,h2 >( #h1 "," #h2, > reinterpret_cast< h1,h2 *>(quintptr(-1)))); \ return > metatype_id.loadAcquire(); \ > } \ > }; \ > QT_END_NAMESPACE > > This seems like a hack to me, but it works great with all of the compilers > I've tried it with (32/64-bit g++ on linux and mac; mingw, MSVC 2008, > 2010).
> Does anyone foresee a big objection to this approach? Yes. At least, QNDArray is not part of the typeName() of the metatypes. For testing, you can probably use this just after the QNDArray definition: Q_DECLARE_METATYPE_TEMPLATE_2ARG(QNDArray) but if this class is going to end up in Qt, then you would need to extend the QT_FOR_EACH_AUTOMATIC_TEMPLATE_2ARG(F) macro to deal with it. Thanks, -- Stephen Kelly <stephen.ke...@kdab.com> | Software Engineer KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090 KDAB - Qt Experts - Platform-Independent Software Solutions
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development