QMetaType: improve docs and comments

Change-Id: I7bcc8cec95eb5abda75d936732b1113b943622dc
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Olivier Goffart 2015-02-10 09:37:21 +01:00 committed by Olivier Goffart (Woboq GmbH)
parent 9ddfa43e02
commit 2ad8c14d38
2 changed files with 6 additions and 3 deletions

View File

@ -381,15 +381,15 @@ struct DefinedTypesFilter {
return a QMetaObject relative to this type.
If the type is a pointer type to a subclass of QObject, flags contains
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
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)
If the type is an enumaration, flags contains QMetaType::IsEnumeration, and this function
If the type is an enumeration, flags() contains QMetaType::IsEnumeration, and this function
returns the QMetaObject of the enclosing object if the enum was registered as a Q_ENUM or 0
otherwise

View File

@ -1369,6 +1369,9 @@ namespace QtPrivate
template<typename T>
struct IsQEnumHelper {
static const T &declval();
// If the type was declared with Q_ENUM, the friend qt_getEnumMetaObject(T) declared in the
// Q_ENUM macro will be chosen by ADL, and the return type will be QMetaObject*.
// Otherwise the chosen overload will be qt_getEnumMetaObject(...) which returne 'char'
enum { Value = sizeof(qt_getEnumMetaObject(declval())) == sizeof(QMetaObject*) };
};