From 2f38c3fa0449d55230b26c5e993fcb746ef2883e Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sun, 10 Aug 2014 19:45:41 +0200 Subject: [PATCH] Document Q_GADGET [ChangeLog][QtCore] Classes with the Q_GADGET function can now have properties and invokable methods. QMetaMethod and QMetaProperty have new overloads that can be used with a pointer to a gadget. The QMetaType system also gained knowledge of types with the Q_GADGET macro Change-Id: I017475f3809181c64fdd66f899e461ad27f5ae47 Reviewed-by: Simon Hausmann --- src/corelib/kernel/qobject.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index bd06e8d87b..98e3f6b5bd 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -4251,15 +4251,28 @@ QDebug qt_QMetaEnum_debugOperator(QDebug &dbg, int value, const QMetaObject *met \note This macro requires the class to be a subclass of QObject. Use Q_GADGET instead of Q_OBJECT to enable the meta object system's support - for enums in a class that is not a QObject subclass. Q_GADGET makes a - class member, \c{staticMetaObject}, available. - \c{staticMetaObject} is of type QMetaObject and provides access to the - enums declared with Q_ENUMS. - Q_GADGET is provided only for C++. + for enums in a class that is not a QObject subclass. \sa {Meta-Object System}, {Signals and Slots}, {Qt's Property System} */ +/*! + \macro Q_GADGET + \relates QObject + + The Q_GADGET macro is a lighter version of the Q_OBJECT macro for classes + that do not inherit from QObject but still want to use some of the + reflection capabilities offered by QMetaObject. Just like the Q_OBJECT + macro, it must appear in the private section of a class definition. + + Q_GADGETs can have Q_ENUM, Q_PROPERTY and Q_INVOKABLE, but they cannot have + signals or slots + + Q_GADGET makes a class member, \c{staticMetaObject}, available. + \c{staticMetaObject} is of type QMetaObject and provides access to the + enums declared with Q_ENUMS. +*/ + /*! \macro Q_SIGNALS \relates QObject