#define Q_DECLARE_METATYPE(TYPE) \
QT_BEGIN_NAMESPACE \
template <> \
struct QMetaTypeId< TYPE > \
{ \
enum { Defined = 1 }; \
static int qt_metatype_id() \
{ \
...
} \
}; \
QT_END_NAMESPACE
#define Q_DECLARE_METATYPE(TYPE) \
QT_BEGIN_NAMESPACE \
template <> \
struct QMetaTypeId< TYPE > \
{ \
enum { Defined = 1 }; \
static int qt_metatype_id() \
{ \
...
} \
}; \
QT_END_NAMESPACE
To copy to clipboard, switch view to plain text mode
As you can see this macro specializes template class QMetaTypeId, which is indirectly used inside QVariant
template <typename T>
inline void qVariantSetValue
(QVariant &v,
const T
&t
) {
...
const uint type = qMetaTypeId<T>(reinterpret_cast<T *>(0));
...
template <typename T>
inline void qVariantSetValue(QVariant &v, const T &t)
{
...
const uint type = qMetaTypeId<T>(reinterpret_cast<T *>(0));
...
To copy to clipboard, switch view to plain text mode
Bookmarks