diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 76cee612ce..e4f1052673 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -631,30 +631,30 @@ void qRegisterMetaTypeStreamOperators(const char *typeName #endif // QT_NO_DATASTREAM template -inline Q_DECL_CONSTEXPR int qMetaTypeId( -#ifndef Q_QDOC - T * /* dummy */ = 0 -#endif -) +inline Q_DECL_CONSTEXPR int qMetaTypeId() { Q_STATIC_ASSERT_X(QMetaTypeId2::Defined, "Type is not registered, please use the Q_DECLARE_METATYPE macro to make it known to Qt's meta-object system"); return QMetaTypeId2::qt_metatype_id(); } template -inline Q_DECL_CONSTEXPR int qRegisterMetaType( -#if !defined(Q_QDOC) && !defined(Q_CC_SUN) - T * dummy = 0 -#endif -) +inline Q_DECL_CONSTEXPR int qRegisterMetaType() { -#ifdef Q_CC_SUN - return qMetaTypeId(static_cast(0)); -#else - return qMetaTypeId(dummy); -#endif + return qMetaTypeId(); } +#if QT_DEPRECATED_SINCE(5, 1) && !defined(Q_QDOC) +// There used to be a T *dummy = 0 argument in Qt 4.0 to support MSVC6 +template +QT_DEPRECATED inline Q_DECL_CONSTEXPR int qMetaTypeId(T *) +{ return qMetaTypeId(); } +#ifndef Q_CC_SUN +template +QT_DEPRECATED inline Q_DECL_CONSTEXPR int qRegisterMetaType(T *) +{ return qRegisterMetaType(); } +#endif +#endif + template struct QMetaTypeIdQObject { diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 172ce29050..6f212f5000 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -484,7 +484,7 @@ public: template inline QVariant qVariantFromValue(const T &t) { - return QVariant(qMetaTypeId(reinterpret_cast(0)), &t, QTypeInfo::isPointer); + return QVariant(qMetaTypeId(), &t, QTypeInfo::isPointer); } template <> @@ -494,7 +494,7 @@ template inline void qVariantSetValue(QVariant &v, const T &t) { //if possible we reuse the current QVariant private - const uint type = qMetaTypeId(reinterpret_cast(0)); + const uint type = qMetaTypeId(); QVariant::Private &d = v.data_ptr(); if (v.isDetached() && (type == d.type || (type <= uint(QVariant::Char) && d.type <= uint(QVariant::Char)))) { d.type = type; @@ -568,7 +568,7 @@ namespace QtPrivate { { static T metaType(const QVariant &v) { - const int vid = qMetaTypeId(static_cast(0)); + const int vid = qMetaTypeId(); if (vid == v.userType()) return *reinterpret_cast(v.constData()); if (vid < int(QMetaType::User)) { diff --git a/src/dbus/qdbusreply.h b/src/dbus/qdbusreply.h index 1d73e61cc4..7b4a4ebcf8 100644 --- a/src/dbus/qdbusreply.h +++ b/src/dbus/qdbusreply.h @@ -69,7 +69,7 @@ public: } inline QDBusReply& operator=(const QDBusMessage &reply) { - QVariant data(qMetaTypeId(&m_data), reinterpret_cast(0)); + QVariant data(qMetaTypeId(), reinterpret_cast(0)); qDBusReplyFill(reply, m_error, data); m_data = qvariant_cast(data); return *this;