diff options
Diffstat (limited to 'src/corelib/kernel/qmetatype.h')
-rw-r--r-- | src/corelib/kernel/qmetatype.h | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 825f767425..7628f5f6b3 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -151,6 +151,13 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId(); F(QVariantHash, 28, QVariantHash) \ F(QByteArrayList, 49, QByteArrayList) \ +#if QT_CONFIG(shortcut) +#define QT_FOR_EACH_STATIC_KEYSEQUENCE_CLASS(F)\ + F(QKeySequence, 75, QKeySequence) +#else +#define QT_FOR_EACH_STATIC_KEYSEQUENCE_CLASS(F) +#endif + #define QT_FOR_EACH_STATIC_GUI_CLASS(F)\ F(QFont, 64, QFont) \ F(QPixmap, 65, QPixmap) \ @@ -163,7 +170,7 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId(); F(QRegion, 72, QRegion) \ F(QBitmap, 73, QBitmap) \ F(QCursor, 74, QCursor) \ - F(QKeySequence, 75, QKeySequence) \ + QT_FOR_EACH_STATIC_KEYSEQUENCE_CLASS(F) \ F(QPen, 76, QPen) \ F(QTextLength, 77, QTextLength) \ F(QTextFormat, 78, QTextFormat) \ @@ -180,10 +187,6 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId(); #define QT_FOR_EACH_STATIC_WIDGETS_CLASS(F)\ F(QSizePolicy, 121, QSizePolicy) \ -// ### FIXME kill that set -#define QT_FOR_EACH_STATIC_HACKS_TYPE(F)\ - F(QMetaTypeId2<qreal>::MetaType, -1, qreal) - // F is a tuple: (QMetaType::TypeName, QMetaType::TypeNameID, AliasingType, "RealType") #define QT_FOR_EACH_STATIC_ALIAS_TYPE(F)\ F(ULong, -1, ulong, "unsigned long") \ @@ -200,10 +203,11 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId(); F(UInt, -1, uint, "quint32") \ F(LongLong, -1, qlonglong, "qint64") \ F(ULongLong, -1, qulonglong, "quint64") \ + F(QVariantList, -1, QVariantList, "QVector<QVariant>") \ F(QVariantList, -1, QVariantList, "QList<QVariant>") \ F(QVariantMap, -1, QVariantMap, "QMap<QString,QVariant>") \ F(QVariantHash, -1, QVariantHash, "QHash<QString,QVariant>") \ - F(QByteArrayList, -1, QByteArrayList, "QList<QByteArray>") \ + F(QByteArrayList, -1, QByteArrayList, "QVector<QByteArray>") \ #define QT_FOR_EACH_STATIC_TYPE(F)\ QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(F)\ @@ -218,7 +222,6 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId(); TypeName = Id, #define QT_FOR_EACH_AUTOMATIC_TEMPLATE_1ARG(F) \ - F(QList) \ F(QVector) \ F(QQueue) \ F(QStack) \ @@ -500,7 +503,7 @@ public: typedef void (*Deleter)(void *); typedef void *(*Creator)(const void *); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if 1 || QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt6: fix this typedef void (*Destructor)(void *); typedef void *(*Constructor)(void *, const void *); // TODO Qt6: remove me #endif @@ -748,8 +751,6 @@ private: static bool registerDebugStreamOperatorFunction(const QtPrivate::AbstractDebugStreamFunction *f, int type); #endif -// ### Qt6: FIXME: Remove the special Q_CC_MSVC handling, it was introduced to maintain BC. -#if !defined(Q_NO_TEMPLATE_FRIENDS) && !defined(Q_CC_MSVC) #ifndef Q_CLANG_QDOC template<typename, bool> friend struct QtPrivate::ValueTypeIsMetaType; template<typename, typename> friend struct QtPrivate::ConverterMemberFunction; @@ -759,9 +760,6 @@ private: template<typename, bool> friend struct QtPrivate::IsMetaTypePair; template<typename, typename> friend struct QtPrivate::MetaTypeSmartPointerHelper; #endif -#else -public: -#endif static bool registerConverterFunction(const QtPrivate::AbstractConverterFunction *f, int from, int to); static void unregisterConverterFunction(int from, int to); private: @@ -1009,10 +1007,6 @@ struct ContainerAPI : CapabilitiesImpl<T> }; template<typename T> -struct ContainerAPI<QList<T> > : CapabilitiesImpl<QList<T> > -{ static int size(const QList<T> *t) { return t->size(); } }; - -template<typename T> struct ContainerAPI<QVector<T> > : CapabilitiesImpl<QVector<T> > { static int size(const QVector<T> *t) { return t->size(); } }; @@ -1658,6 +1652,23 @@ namespace QtPrivate static bool registerConverter(int) { return false; } }; + template<class T> + struct Qt5CompatibilityHook + { + static inline void postRegister(int, const QByteArray &) {}; + }; + + Q_CORE_EXPORT void qt5CompatibilityHookPostRegister(int id, const QByteArray &normalizedTypeName); + + template<class T> + struct Qt5CompatibilityHook<QVector<T>> + { + static inline void postRegister(int id, const QByteArray &normalizedTypeName) + { + qt5CompatibilityHookPostRegister(id, normalizedTypeName); + } + }; + Q_CORE_EXPORT bool isBuiltinType(const QByteArray &type); } // namespace QtPrivate @@ -1784,6 +1795,7 @@ int qRegisterNormalizedMetaType(const QT_PREPEND_NAMESPACE(QByteArray) &normaliz QtPrivate::AssociativeContainerConverterHelper<T>::registerConverter(id); QtPrivate::MetaTypePairHelper<T>::registerConverter(id); QtPrivate::MetaTypeSmartPointerHelper<T>::registerConverter(id); + QtPrivate::Qt5CompatibilityHook<T>::postRegister(id, normalizedTypeName); } return id; @@ -2007,7 +2019,7 @@ typedef QHash<QString, QVariant> QVariantHash; #ifdef Q_CLANG_QDOC class QByteArrayList; #else -typedef QList<QByteArray> QByteArrayList; +typedef QVector<QByteArray> QByteArrayList; #endif #define Q_DECLARE_METATYPE_TEMPLATE_1ARG(SINGLE_ARG_TEMPLATE) \ |