summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qmetatype.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2014-08-03 14:56:34 +0200
committerOlivier Goffart <ogoffart@woboq.com>2014-11-16 13:37:58 +0100
commit78e0e72eb5ec2c5b107523b8af48fdedd599bba7 (patch)
treec8ab8bc884ba7f6d5f8458393c229165ef128271 /src/corelib/kernel/qmetatype.cpp
parentfd05f26d803a4d7f7e8c4be6ee75128eee21ff61 (diff)
Let QMetaType know which types are Q_GADGET
This is required so we can take a QVariant and detect that it contains a Q_GADGET and then use method like QMetaType::metaObject and QMetaProperty::write with the QVariant::data Change-Id: I3603692e4e84426e10bf59949e3def3ea4947bec Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/corelib/kernel/qmetatype.cpp')
-rw-r--r--src/corelib/kernel/qmetatype.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index 63f181cdac..ee86867249 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -283,10 +283,11 @@ struct DefinedTypesFilter {
\value MovableType An instance of a type having this attribute can be safely moved by memcpy.
\omitvalue SharedPointerToQObject
\omitvalue IsEnumeration
- \omitvalue PointerToQObject
+ \value PointerToQObject This type is a pointer to a derived of QObject
\omitvalue WeakPointerToQObject
\omitvalue TrackingPointerToQObject
\omitvalue WasDeclaredAsMetaType
+ \value IsGadget This type is a Q_GADGET and it's corresponding QMetaObject can be accessed with QMetaType::metaObject Since 5.5.
*/
/*!
@@ -363,8 +364,19 @@ struct DefinedTypesFilter {
/*!
\fn const QMetaObject *QMetaType::metaObject() const
- \since 5.0
- \internal
+ \since 5.5
+
+ return a QMetaObject relative to this type.
+
+ If the type is a pointer type to a subclass of QObject, flags contains
+ QMetaType::PointerToQObject and this function returns the corresponding QMetaObject. This can
+ be used to in combinaison with QMetaObject::construct to create QObject of this type.
+
+ If the type is a Q_GADGET, flags contains QMetaType::IsGadget, and this function returns its
+ QMetaObject. This can be used to retrieve QMetaMethod and QMetaProperty and use them on a
+ pointer of this type. (given by QVariant::data for example)
+
+ \sa QMetaType::metaObjectForType(), QMetaType::flags()
*/
/*!
@@ -2025,7 +2037,9 @@ private:
/*!
\since 5.0
- Returns QMetaObject of a given \a type, if the \a type is a pointer to type derived from QObject.
+ returns QMetaType::metaObject for \a type
+
+ \sa metaObject()
*/
const QMetaObject *QMetaType::metaObjectForType(int type)
{