doc: clang-qdoc must not see certain function declarations

The macro Q_DECLARE_INTERFACE declared some qobject_cast() functions
that clang-qdoc must not see in the contexts where the macro is used.
This update prevents that from happening by ensuring that Q_CLANG_QDOC
is not defined when the macro is defined.

This update also adds a \fn command for a declaration of qobject_cast()
that was missing in the documentation. There are two versions of the
function, one with a const parameter and one with a non-const parameter,
and they both share one qdoc comment.

Change-Id: Ic74d0aaae62767cd0391474ee95ae3f4f820b06e
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
bb10
Martin Smith 2018-01-23 12:19:33 +01:00
parent f28d0d8ae8
commit 4ca0d76454
2 changed files with 4 additions and 2 deletions

View File

@ -1093,7 +1093,9 @@ QObjectPrivate::Connection::~Connection()
\sa metaObject()
*/
/*! \fn template <class T> T *qobject_cast<T *>(QObject *object)
/*!
\fn template <class T> T qobject_cast(QObject *object)
\fn template <class T> T qobject_cast(const QObject *object)
\relates QObject
Returns the given \a object cast to type T if the object is of type

View File

@ -517,7 +517,7 @@ inline T qobject_cast(const QObject *object)
template <class T> inline const char * qobject_interface_iid()
{ return nullptr; }
#ifndef Q_MOC_RUN
#if !defined(Q_MOC_RUN) && !defined(Q_CLANG_QDOC)
# define Q_DECLARE_INTERFACE(IFace, IId) \
template <> inline const char *qobject_interface_iid<IFace *>() \
{ return IId; } \