doc: Fix tr() documentation issue

The declaration of tr() in the Q_OBJECT macro interferes with the
tr() declaration in the QObject class. This update fixes that bug
by resetting QT_TR_FUNCTIONS to be empty and by ensuring that the
tr() declaration in class QObject is seen by clang when qdoc is
running.

Change-Id: If55339fc417f3eee1a1e1ce3df75a18af443d630
Task-number: QTBUG-75864
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
This commit is contained in:
Martin Smith 2019-06-12 15:37:06 +02:00 committed by Paul Wicking
parent 762d4afdc1
commit 8d2df3002b
2 changed files with 6 additions and 1 deletions

View File

@ -117,6 +117,7 @@ public:
class Q_CORE_EXPORT QObject
{
Q_OBJECT
Q_PROPERTY(QString objectName READ objectName WRITE setObjectName NOTIFY objectNameChanged)
Q_DECLARE_PRIVATE(QObject)
@ -127,7 +128,7 @@ public:
virtual bool event(QEvent *event);
virtual bool eventFilter(QObject *watched, QEvent *event);
#if defined(QT_NO_TRANSLATION)
#if defined(QT_NO_TRANSLATION) || defined(Q_CLANG_QDOC)
static QString tr(const char *sourceText, const char * = nullptr, int = -1)
{ return QString::fromUtf8(sourceText); }
#if QT_DEPRECATED_SINCE(5, 0)

View File

@ -146,6 +146,10 @@ class QString;
# define QT_TR_FUNCTIONS
#endif
#ifdef Q_CLANG_QDOC
#define QT_TR_FUNCTIONS
#endif
// ### Qt6: remove
#define Q_OBJECT_CHECK /* empty, unused since Qt 5.2 */