Simplify the creation of QMetaTypeId specializations.

Change-Id: I07405f91b6f73a4e129859ca45a983d3ec7029ab
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
This commit is contained in:
Stephen Kelly 2012-07-02 10:21:54 +02:00 committed by Qt by Nokia
parent 8368557b9c
commit 3e5b98f4ea
2 changed files with 7 additions and 11 deletions

View File

@ -708,12 +708,13 @@ inline int qRegisterMetaTypeStreamOperators()
}; \ }; \
QT_END_NAMESPACE QT_END_NAMESPACE
#define Q_DECLARE_BUILTIN_METATYPE(TYPE, NAME) \
#define Q_DECLARE_BUILTIN_METATYPE(TYPE, METATYPEID, NAME) \
QT_BEGIN_NAMESPACE \ QT_BEGIN_NAMESPACE \
template<> struct QMetaTypeId2<TYPE> \ template<> struct QMetaTypeId2<NAME> \
{ \ { \
enum { Defined = 1, MetaType = QMetaType::NAME }; \ enum { Defined = 1, MetaType = METATYPEID }; \
static inline Q_DECL_CONSTEXPR int qt_metatype_id() { return QMetaType::NAME; } \ static inline Q_DECL_CONSTEXPR int qt_metatype_id() { return METATYPEID; } \
}; \ }; \
QT_END_NAMESPACE QT_END_NAMESPACE
@ -946,12 +947,7 @@ inline const QMetaObject *QMetaType::metaObject() const
QT_END_NAMESPACE QT_END_NAMESPACE
#define QT_DECLARE_BUILTIN_METATYPE_ITER(MetaTypeName, MetaTypeId, Name) \ QT_FOR_EACH_STATIC_TYPE(Q_DECLARE_BUILTIN_METATYPE)
Q_DECLARE_BUILTIN_METATYPE(Name, MetaTypeName)
QT_FOR_EACH_STATIC_TYPE(QT_DECLARE_BUILTIN_METATYPE_ITER)
#undef QT_DECLARE_BUILTIN_METATYPE_ITER
QT_END_HEADER QT_END_HEADER

View File

@ -123,7 +123,7 @@ protected:
QT_END_NAMESPACE QT_END_NAMESPACE
Q_DECLARE_BUILTIN_METATYPE(QDBusConnectionInterface::RegisterServiceReply, UInt) Q_DECLARE_BUILTIN_METATYPE(UInt, QMetaType::UInt, QDBusConnectionInterface::RegisterServiceReply)
QT_END_HEADER QT_END_HEADER