summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2013-03-29 18:08:15 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-01 21:33:29 +0200
commit620f911fd8456351019bcc116f740501d88a0537 (patch)
tree042aa0ed5a376b06d02f60eecf63148f97261985 /src/corelib/kernel
parent11ad8c8bd9e641e317ff9262c6e6b891ba9307ea (diff)
Update the QMetaMethod::tag() documentation due to moc expanding macros
Since 34a3b63dc7d3b09342647537d378f5a55d0c81f0 (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>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qmetaobject.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index b581be821b..00d20d9300 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -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
{