summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-11-21 11:10:50 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-11-23 12:44:54 +0000
commit0ef76c77b8deb3ab18faac5138de174e06b84bc6 (patch)
tree75cb58fe5bda29f769359aa254f573adc97c9443 /src/corelib/kernel
parentb6dae38c278764339956abd1edde2b7f2a47ab1d (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). Change-Id: I1e30572f1c91f58b290cb9b4b07433af99a1db6f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 5806ecf5cb24cf39ea2608d42246eafbaa817582) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qmetatype.cpp1
-rw-r--r--src/corelib/kernel/qmetatype.h5
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)
};
};