diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-11-21 11:10:50 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-11-23 09:57:00 +0100 |
commit | 5806ecf5cb24cf39ea2608d42246eafbaa817582 (patch) | |
tree | baa3730d032995aa8a5635ff39b76e9498562e95 /src/corelib/kernel | |
parent | 54875be84de059374920e4c0deacd13a41caaa13 (diff) |
QMetaType: Track whether type is QML list type
This information is required in the QML engine to handle list properties
(instances of QQmlListproperty<T> and list<T> types from QML).
Pick-to: 6.0.0 6.0
Change-Id: I1e30572f1c91f58b290cb9b4b07433af99a1db6f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qmetatype.cpp | 1 | ||||
-rw-r--r-- | src/corelib/kernel/qmetatype.h | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index d4ab51d323..ab3e47d4b1 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -420,6 +420,7 @@ Q_GLOBAL_STATIC(QMetaTypeCustomRegistry, customTypeRegistry) \omitvalue TrackingPointerToQObject \omitvalue IsGadget \omit This type is a Q_GADGET and it's corresponding QMetaObject can be accessed with QMetaType::metaObject Since 5.5. \endomit \omitvalue PointerToGadget + \omitvalue IsQmlListType */ /*! diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 8ef1bb8faa..e453c61d77 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -362,6 +362,7 @@ public: IsGadget = 0x200, PointerToGadget = 0x400, IsPointer = 0x800, + IsQmlList =0x1000, // used in the QML engine to recognize QQmlListProperty<T> and list<T> }; Q_DECLARE_FLAGS(TypeFlags, TypeFlag) @@ -1070,6 +1071,9 @@ namespace QtPrivate { template <typename Result, typename... Args> struct IsPointerToTypeDerivedFromQObject<Result(*)(Args...)> { enum { Value = false }; }; + template<typename T> + inline constexpr bool IsQmlListType = false; + template<typename T, bool = std::is_enum<T>::value> constexpr bool IsUnsignedEnum = false; template<typename T> @@ -1090,6 +1094,7 @@ namespace QtPrivate { | (IsPointerToGadgetHelper<T>::IsGadgetOrDerivedFrom ? QMetaType::PointerToGadget : 0) | (QTypeInfo<T>::isPointer ? QMetaType::IsPointer : 0) | (IsUnsignedEnum<T> ? QMetaType::IsUnsignedEnumeration : 0) + | (IsQmlListType<T> ? QMetaType::IsQmlList : 0) }; }; |