Simplify the creation of QMetaTypeId specializations.
authorStephen Kelly <stephen.kelly@kdab.com>
Mon, 2 Jul 2012 08:21:54 +0000 (10:21 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 3 Jul 2012 12:54:42 +0000 (14:54 +0200)
Change-Id: I07405f91b6f73a4e129859ca45a983d3ec7029ab
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
src/corelib/kernel/qmetatype.h
src/dbus/qdbusconnectioninterface.h

index 79514c8..f11f58b 100644 (file)
@@ -708,12 +708,13 @@ inline int qRegisterMetaTypeStreamOperators()
     };                                                                  \
     QT_END_NAMESPACE
 
-#define Q_DECLARE_BUILTIN_METATYPE(TYPE, NAME) \
+
+#define Q_DECLARE_BUILTIN_METATYPE(TYPE, METATYPEID, NAME) \
     QT_BEGIN_NAMESPACE \
-    template<> struct QMetaTypeId2<TYPE> \
+    template<> struct QMetaTypeId2<NAME> \
     { \
-        enum { Defined = 1, MetaType = QMetaType::NAME }; \
-        static inline Q_DECL_CONSTEXPR int qt_metatype_id() { return QMetaType::NAME; } \
+        enum { Defined = 1, MetaType = METATYPEID }; \
+        static inline Q_DECL_CONSTEXPR int qt_metatype_id() { return METATYPEID; } \
     }; \
     QT_END_NAMESPACE
 
@@ -946,12 +947,7 @@ inline const QMetaObject *QMetaType::metaObject() const
 QT_END_NAMESPACE
 
 
-#define QT_DECLARE_BUILTIN_METATYPE_ITER(MetaTypeName, MetaTypeId, Name) \
-    Q_DECLARE_BUILTIN_METATYPE(Name, MetaTypeName)
-
-QT_FOR_EACH_STATIC_TYPE(QT_DECLARE_BUILTIN_METATYPE_ITER)
-
-#undef QT_DECLARE_BUILTIN_METATYPE_ITER
+QT_FOR_EACH_STATIC_TYPE(Q_DECLARE_BUILTIN_METATYPE)
 
 
 QT_END_HEADER
index e822edd..1f11d8c 100644 (file)
@@ -123,7 +123,7 @@ protected:
 
 QT_END_NAMESPACE
 
-Q_DECLARE_BUILTIN_METATYPE(QDBusConnectionInterface::RegisterServiceReply, UInt)
+Q_DECLARE_BUILTIN_METATYPE(UInt, QMetaType::UInt, QDBusConnectionInterface::RegisterServiceReply)
 
 QT_END_HEADER