diff options
Diffstat (limited to 'src/corelib/kernel/qmetatype.cpp')
-rw-r--r-- | src/corelib/kernel/qmetatype.cpp | 54 |
1 files changed, 48 insertions, 6 deletions
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 9fc0659cf2..21254108e3 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -252,6 +252,7 @@ struct DefinedTypesFilter { \value QPolygon QPolygon \value QPolygonF QPolygonF \value QColor QColor + \value QColorSpace QColorSpace (introduced in Qt 5.15) \value QSizeF QSizeF \value QRectF QRectF \value QLine QLine @@ -298,7 +299,7 @@ struct DefinedTypesFilter { \value QCborMap QCborMap \value QCborSimpleType QCborSimpleType \value QModelIndex QModelIndex - \value QPersistentModelIndex QPersistentModelIndex (since 5.5) + \value QPersistentModelIndex QPersistentModelIndex (introduced in Qt 5.5) \value QUuid QUuid \value QByteArrayList QByteArrayList @@ -456,7 +457,7 @@ struct DefinedTypesFilter { \deprecated Constructs a value of the given type which is a copy of \a copy. - The default value for \a copy is 0. + The default value for \a copy is \nullptr. Deprecated, use the static function QMetaType::create(int type, const void *copy) instead. @@ -506,6 +507,31 @@ struct DefinedTypesFilter { Destructs this object. */ +/*! + \fn template<typename T> QMetaType QMetaType::fromType() + \since 5.15 + + Returns the QMetaType corresponding to the type in the template parameter. +*/ + +/*! \fn bool operator==(const QMetaType &a, const QMetaType &b) + \since 5.15 + \relates QMetaType + \overload + + Returns \c true if the QMetaType \a a represents the same type + as the QMetaType \a b, otherwise returns \c false. +*/ + +/*! \fn bool operator!=(const QMetaType &a, const QMetaType &b) + \since 5.15 + \relates QMetaType + \overload + + Returns \c true if the QMetaType \a a represents a different type + than the QMetaType \a b, otherwise returns \c false. +*/ + #define QT_ADD_STATIC_METATYPE(MetaTypeName, MetaTypeId, RealName) \ { #RealName, sizeof(#RealName) - 1, MetaTypeId }, @@ -931,7 +957,7 @@ constexpr MetaTypeOffsets<QtPrivate::Indexes<QMetaType::HighestInternalId + 1>:: pointer if no matching type was found. The returned pointer must not be deleted. - \sa type(), isRegistered(), Type + \sa type(), isRegistered(), Type, name() */ const char *QMetaType::typeName(int typeId) { @@ -951,6 +977,20 @@ const char *QMetaType::typeName(int typeId) #undef QT_METATYPE_TYPEID_TYPENAME_CONVERTER } +/*! + \since 5.15 + + Returns the type name associated with this QMetaType, or a null + pointer if no matching type was found. The returned pointer must not be + deleted. + + \sa typeName() +*/ +QByteArray QMetaType::name() const +{ + return QMetaType::typeName(m_typeId); +} + /* Similar to QMetaType::type(), but only looks in the static set of types. */ @@ -1114,8 +1154,8 @@ static int registerNormalizedType(const NS(QByteArray) &normalizedTypeName, QCustomTypeInfo inf; inf.typeName = normalizedTypeName; #ifndef QT_NO_DATASTREAM - inf.loadOp = 0; - inf.saveOp = 0; + inf.loadOp = nullptr; + inf.saveOp = nullptr; #endif inf.alias = -1; inf.typedConstructor = typedConstructor; @@ -1956,7 +1996,7 @@ public: return Q_LIKELY(qMetaTypeWidgetsHelper) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].metaObject : nullptr; - return 0; + return nullptr; } }; @@ -2215,6 +2255,8 @@ QMetaType QMetaType::typeInfo(const int type) \since 5.0 Constructs a QMetaType object that contains all information about type \a typeId. + + \note The default parameter was added in Qt 5.15. */ QMetaType::QMetaType(const int typeId) : m_typeId(typeId) |