Update the QMetaMethod::tag() documentation due to moc expanding macros
Since 34a3b63dc7
(Qt 5.0), moc expands
macros to their defined values. This broke the example of tagging a
method: in Qt 4, it never expanded anything, so the tag was always
visible and extracted. Now it's necessary to avoid defining it to empty
when moc is run.
Change-Id: I89967f7f993cf8e14119b086f4dd5573b348646d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
parent
11ad8c8bd9
commit
620f911fd8
@ -1854,7 +1854,10 @@ const char *QMetaMethod::typeName() const
|
||||
way in the function declaration:
|
||||
|
||||
\code
|
||||
#define THISISTESTTAG // tag text
|
||||
#ifndef Q_MOC_RUN
|
||||
// define the tag text
|
||||
# define THISISTESTTAG
|
||||
#endif
|
||||
...
|
||||
private slots:
|
||||
THISISTESTTAG void testFunc();
|
||||
@ -1871,8 +1874,13 @@ const char *QMetaMethod::typeName() const
|
||||
qDebug() << mm.tag(); // prints THISISTESTTAG
|
||||
\endcode
|
||||
|
||||
For the moment,
|
||||
\c moc doesn't support any special tags.
|
||||
For the moment, \c moc will extract and record all tags, but it will not
|
||||
handle any of them specially.
|
||||
|
||||
\note Since Qt 5.0, \c moc expands preprocessor macros, so it is necessary
|
||||
to surround the definition with \c #ifndef \c Q_MOC_RUN, as shown in the
|
||||
example above. This was not required in Qt 4. The code as shown above works
|
||||
with Qt 4 too.
|
||||
*/
|
||||
const char *QMetaMethod::tag() const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user